2 Unix SMB/CIFS implementation.
3 SMB request interface structures
4 Copyright (C) Andrew Tridgell 2003
5 Copyright (C) James J Myers 2003 <myersjj@samba.org>
6 Copyright (C) James Peach 2007
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LIBCLI_RAW_INTERFACES_H__
23 #define __LIBCLI_RAW_INTERFACES_H__
25 #include "source4/libcli/raw/smb.h"
26 #include "../libcli/smb/smb_common.h"
27 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
28 #include "librpc/gen_ndr/smb2_lease_struct.h"
30 /* this structure is just a wrapper for a string, the only reason we
31 bother with this is that it allows us to check the length provided
32 on the wire in testsuite test code to ensure that we are
33 terminating names in the same way that win2003 is. The *ONLY* time
34 you should ever look at the 'private_length' field in this
35 structure is inside compliance test code, in all other cases just
36 use the null terminated char* as the definitive definition of the
39 also note that this structure is only used in packets where there
40 is an explicit length provided on the wire (hence the name). That
41 length is placed in 'private_length'. For packets where the length
42 is always determined by NULL or packet termination a normal char*
43 is used in the structure definition.
45 struct smb_wire_string
{
46 uint32_t private_length
;
51 * SMB2 uses a 16Byte handle,
52 * (we can maybe use struct GUID later)
58 struct smb2_lease_break
{
59 struct smb2_lease current_lease
;
60 uint16_t new_epoch
; /* only for v2 leases */
62 uint32_t new_lease_state
;
63 uint32_t break_reason
; /* should be 0 */
64 uint32_t access_mask_hint
; /* should be 0 */
65 uint32_t share_mask_hint
; /* should be 0 */
71 * a generic container for file handles or file pathes
72 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
74 union smb_handle_or_path
{
77 * the qpathinfo and setpathinfo
82 * this is used as file handle in SMB
87 * this is used as file handle in SMB2
89 struct smb2_handle handle
;
92 * this is used as generic file handle for the NTVFS layer
94 struct ntvfs_handle
*ntvfs
;
98 a generic container for file handles
102 * this is used as file handle in SMB
107 * this is used as file handle in SMB2
109 struct smb2_handle handle
;
112 * this is used as generic file handle for the NTVFS layer
114 struct ntvfs_handle
*ntvfs
;
118 this header defines the structures and unions used between the SMB
119 parser and the backends.
122 /* struct used for SMBlseek call */
126 union smb_handle file
;
128 int32_t offset
; /* signed */
136 /* struct used in unlink() call */
147 /* struct used in chkpath() call */
156 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
158 /* union used in mkdir() call */
162 enum smb_mkdir_level level
;
166 enum smb_mkdir_level level
;
173 enum smb_mkdir_level level
;
176 unsigned int num_eas
;
177 struct ea_struct
*eas
;
182 /* struct used in rmdir() call */
189 /* struct used in rename() call */
190 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
194 enum smb_rename_level level
;
197 /* SMBrename interface */
199 enum smb_rename_level level
;
202 const char *pattern1
;
203 const char *pattern2
;
209 /* SMBntrename interface */
211 enum smb_rename_level level
;
215 uint16_t flags
; /* see RENAME_FLAG_* */
216 uint32_t cluster_size
;
217 const char *old_name
;
218 const char *new_name
;
222 /* NT TRANS rename interface */
224 enum smb_rename_level level
;
227 union smb_handle file
;
228 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
229 const char *new_name
;
234 enum smb_tcon_level
{
240 /* union used in tree connect call */
242 /* generic interface */
244 enum smb_tcon_level level
;
247 /* SMBtcon interface */
249 enum smb_tcon_level level
;
253 const char *password
;
262 /* SMBtconX interface */
264 enum smb_tcon_level level
;
275 uint32_t guest_max_access
;
282 /* SMB2 TreeConnect */
283 struct smb2_tree_connect
{
284 enum smb_tcon_level level
;
287 /* static body buffer 8 (0x08) bytes */
289 /* uint16_t path_ofs */
290 /* uint16_t path_size */
292 const char *path
; /* as non-terminated UTF-16 on the wire */
295 /* static body buffer 16 (0x10) bytes */
296 /* uint16_t buffer_code; 0x10 */
300 uint32_t capabilities
;
301 uint32_t access_mask
;
303 /* extracted from the SMB2 header */
310 enum smb_sesssetup_level
{
313 RAW_SESSSETUP_SPNEGO
,
317 /* union used in session_setup call */
318 union smb_sesssetup
{
319 /* the pre-NT1 interface */
321 enum smb_sesssetup_level level
;
343 /* the NT1 interface */
345 enum smb_sesssetup_level level
;
352 uint32_t capabilities
;
370 /* the SPNEGO interface */
372 enum smb_sesssetup_level level
;
379 uint32_t capabilities
;
383 const char *workgroup
;
395 /* SMB2 SessionSetup */
396 struct smb2_session_setup
{
397 enum smb_sesssetup_level level
;
400 /* static body 24 (0x18) bytes */
402 uint8_t security_mode
;
403 uint32_t capabilities
;
405 /* uint16_t secblob_ofs */
406 /* uint16_t secblob_size */
407 uint64_t previous_sessionid
;
412 /* body buffer 8 (0x08) bytes */
413 uint16_t session_flags
;
414 /* uint16_t secblob_ofs */
415 /* uint16_t secblob_size */
419 /* extracted from the SMB2 header */
425 /* Note that the specified enum values are identical to the actual info-levels used
428 enum smb_fileinfo_level
{
429 RAW_FILEINFO_GENERIC
= 0xF000,
430 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
431 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
432 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
433 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
434 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
435 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
436 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
437 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
438 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
439 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
440 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
441 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
442 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
443 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
444 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
445 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
446 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
447 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
448 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
449 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
450 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
451 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
452 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
453 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
454 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
455 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
456 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
457 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
458 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
459 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
460 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
461 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
462 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
463 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
464 RAW_FILEINFO_NORMALIZED_NAME_INFORMATION
= SMB_QFILEINFO_NORMALIZED_NAME_INFORMATION
,
465 /* SMB2 specific levels */
466 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
467 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201,
468 RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION
= 0x1501
471 /* union used in qfileinfo() and qpathinfo() backend calls */
473 /* generic interface:
474 * matches RAW_FILEINFO_GENERIC */
476 enum smb_fileinfo_level level
;
478 union smb_handle_or_path file
;
483 unsigned int num_eas
;
486 struct smb_wire_string name
;
496 struct smb_wire_string fname
;
497 struct smb_wire_string alt_fname
;
498 uint8_t delete_pending
;
500 uint64_t compressed_size
;
504 uint8_t cluster_shift
;
506 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
509 uint32_t alignment_requirement
;
510 uint32_t reparse_tag
;
511 unsigned int num_streams
;
512 struct stream_struct
{
515 struct smb_wire_string stream_name
;
521 /* SMBgetatr interface:
522 * matches RAW_FILEINFO_GETATTR */
524 enum smb_fileinfo_level level
;
526 union smb_handle_or_path file
;
535 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
537 enum smb_fileinfo_level level
;
539 union smb_handle_or_path file
;
549 } getattre
, standard
;
551 /* trans2 RAW_FILEINFO_EA_SIZE interface */
553 enum smb_fileinfo_level level
;
555 union smb_handle_or_path file
;
568 /* trans2 RAW_FILEINFO_EA_LIST interface */
570 enum smb_fileinfo_level level
;
572 union smb_handle_or_path file
;
573 unsigned int num_names
;
575 struct smb_wire_string name
;
580 unsigned int num_eas
;
581 struct ea_struct
*eas
;
585 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
587 enum smb_fileinfo_level level
;
589 union smb_handle_or_path file
;
590 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
591 uint8_t continue_flags
;
593 struct smb_ea_list out
;
596 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
597 only valid for a QPATHNAME call - no returned data */
599 enum smb_fileinfo_level level
;
601 union smb_handle_or_path file
;
605 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
607 enum smb_fileinfo_level level
;
609 union smb_handle_or_path file
;
621 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
623 enum smb_fileinfo_level level
;
625 union smb_handle_or_path file
;
636 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
638 enum smb_fileinfo_level level
;
640 union smb_handle_or_path file
;
647 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
648 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
649 /* RAW_FILEINFO_NORMALIZED_NAME_INFORMATION interface */
650 /* RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION interface */
652 enum smb_fileinfo_level level
;
654 union smb_handle_or_path file
;
657 struct smb_wire_string fname
;
659 } name_info
, alt_name_info
, normalized_name_info
;
661 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
663 enum smb_fileinfo_level level
;
665 union smb_handle_or_path file
;
676 uint8_t delete_pending
;
679 struct smb_wire_string fname
;
683 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
685 enum smb_fileinfo_level level
;
687 union smb_handle_or_path file
;
699 uint8_t delete_pending
;
704 uint32_t access_mask
;
707 uint32_t alignment_requirement
;
708 struct smb_wire_string fname
;
712 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
714 enum smb_fileinfo_level level
;
716 union smb_handle_or_path file
;
718 struct stream_information
{
719 unsigned int num_streams
;
720 struct stream_struct
*streams
;
724 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
726 enum smb_fileinfo_level level
;
728 union smb_handle_or_path file
;
731 uint64_t compressed_size
;
735 uint8_t cluster_shift
;
739 /* RAW_FILEINFO_UNIX_BASIC interface */
741 enum smb_fileinfo_level level
;
743 union smb_handle_or_path file
;
746 uint64_t end_of_file
;
748 NTTIME status_change_time
;
757 uint64_t permissions
;
762 /* RAW_FILEINFO_UNIX_INFO2 interface */
764 enum smb_fileinfo_level level
;
766 union smb_handle_or_path file
;
769 uint64_t end_of_file
;
771 NTTIME status_change_time
;
780 uint64_t permissions
;
788 /* RAW_FILEINFO_UNIX_LINK interface */
790 enum smb_fileinfo_level level
;
792 union smb_handle_or_path file
;
795 struct smb_wire_string link_dest
;
799 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
801 enum smb_fileinfo_level level
;
803 union smb_handle_or_path file
;
808 } internal_information
;
810 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
812 enum smb_fileinfo_level level
;
814 union smb_handle_or_path file
;
817 uint32_t access_flags
;
819 } access_information
;
821 /* RAW_FILEINFO_POSITION_INFORMATION interface */
823 enum smb_fileinfo_level level
;
825 union smb_handle_or_path file
;
830 } position_information
;
832 /* RAW_FILEINFO_MODE_INFORMATION interface */
834 enum smb_fileinfo_level level
;
836 union smb_handle_or_path file
;
843 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
845 enum smb_fileinfo_level level
;
847 union smb_handle_or_path file
;
850 uint32_t alignment_requirement
;
852 } alignment_information
;
854 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
856 enum smb_fileinfo_level level
;
858 union smb_handle_or_path file
;
869 } network_open_information
;
872 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
874 enum smb_fileinfo_level level
;
876 union smb_handle_or_path file
;
880 uint32_t reparse_tag
;
882 } attribute_tag_information
;
884 /* RAW_FILEINFO_SEC_DESC */
886 enum smb_fileinfo_level level
;
888 union smb_handle_or_path file
;
889 uint32_t secinfo_flags
;
892 struct security_descriptor
*sd
;
898 enum smb_setfileinfo_level
{
899 RAW_SFILEINFO_GENERIC
= 0xF000,
900 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
901 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
902 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
903 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
904 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
905 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
906 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
907 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
908 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
909 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
910 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
911 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
912 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
913 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
914 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
915 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
916 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
917 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
918 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
919 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
920 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
921 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
922 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
923 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
924 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
925 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
926 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
927 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
928 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
929 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
930 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
931 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
932 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
933 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
934 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
935 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
937 /* cope with breakage in SMB2 */
938 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
941 /* union used in setfileinfo() and setpathinfo() calls */
942 union smb_setfileinfo
{
943 /* generic interface */
945 enum smb_setfileinfo_level level
;
947 union smb_handle_or_path file
;
951 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
953 enum smb_setfileinfo_level level
;
955 union smb_handle_or_path file
;
961 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
962 also RAW_SFILEINFO_STANDARD */
964 enum smb_setfileinfo_level level
;
966 union smb_handle_or_path file
;
970 /* notice that size, alloc_size and attrib are not settable,
971 unlike the corresponding qfileinfo level */
973 } setattre
, standard
;
975 /* RAW_SFILEINFO_EA_SET interface */
977 enum smb_setfileinfo_level level
;
979 union smb_handle_or_path file
;
980 unsigned int num_eas
;
981 struct ea_struct
*eas
;
985 /* RAW_SFILEINFO_BASIC_INFO and
986 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
988 enum smb_setfileinfo_level level
;
990 union smb_handle_or_path file
;
1000 /* RAW_SFILEINFO_DISPOSITION_INFO and
1001 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1003 enum smb_setfileinfo_level level
;
1005 union smb_handle_or_path file
;
1006 bool delete_on_close
;
1010 /* RAW_SFILEINFO_ALLOCATION_INFO and
1011 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1013 enum smb_setfileinfo_level level
;
1015 union smb_handle_or_path file
;
1016 /* w2k3 rounds this up to nearest 4096 */
1017 uint64_t alloc_size
;
1021 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1022 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1024 enum smb_setfileinfo_level level
;
1026 union smb_handle_or_path file
;
1031 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1033 enum smb_setfileinfo_level level
;
1035 union smb_handle_or_path file
;
1038 const char *new_name
;
1040 } rename_information
;
1042 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1044 enum smb_setfileinfo_level level
;
1046 union smb_handle_or_path file
;
1049 const char *new_name
;
1053 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1055 enum smb_setfileinfo_level level
;
1057 union smb_handle_or_path file
;
1060 } position_information
;
1062 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1064 enum smb_setfileinfo_level level
;
1066 union smb_handle_or_path file
;
1067 /* valid values seem to be 0, 2, 4 and 6 */
1072 /* RAW_SFILEINFO_UNIX_BASIC interface */
1074 enum smb_setfileinfo_level level
;
1076 union smb_handle_or_path file
;
1077 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1078 uint64_t end_of_file
;
1080 NTTIME status_change_time
;
1089 uint64_t permissions
;
1094 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1096 enum smb_setfileinfo_level level
;
1098 union smb_handle_or_path file
;
1099 uint64_t end_of_file
;
1101 NTTIME status_change_time
;
1110 uint64_t permissions
;
1113 uint32_t file_flags
;
1114 uint32_t flags_mask
;
1118 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1120 enum smb_setfileinfo_level level
;
1122 union smb_handle_or_path file
;
1123 const char *link_dest
;
1125 } unix_link
, unix_hlink
;
1127 /* RAW_SFILEINFO_SEC_DESC */
1129 enum smb_setfileinfo_level level
;
1131 union smb_handle_or_path file
;
1132 uint32_t secinfo_flags
;
1133 struct security_descriptor
*sd
;
1137 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1139 enum smb_setfileinfo_level level
;
1141 union smb_handle_or_path file
;
1142 struct smb_ea_list eas
;
1144 } full_ea_information
;
1148 enum smb_fsinfo_level
{
1149 RAW_QFS_GENERIC
= 0xF000,
1150 RAW_QFS_DSKATTR
, /* SMBdskattr */
1151 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1152 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1153 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1154 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1155 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1156 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1157 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1158 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1159 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1160 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1161 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1162 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1163 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1164 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
,
1165 RAW_QFS_SECTOR_SIZE_INFORMATION
= SMB_QFS_SECTOR_SIZE_INFORMATION
,
1169 /* union for fsinfo() backend call. Note that there are no in
1170 structures, as this call only contains out parameters */
1172 /* generic interface */
1174 enum smb_fsinfo_level level
;
1175 struct smb2_handle handle
; /* only for smb2 */
1178 uint32_t block_size
;
1179 uint64_t blocks_total
;
1180 uint64_t blocks_free
;
1183 uint32_t serial_number
;
1185 uint32_t max_file_component_length
;
1186 uint32_t device_type
;
1187 uint32_t device_characteristics
;
1188 uint64_t quota_soft
;
1189 uint64_t quota_hard
;
1190 uint64_t quota_flags
;
1197 /* SMBdskattr interface */
1199 enum smb_fsinfo_level level
;
1202 uint16_t units_total
;
1203 uint16_t blocks_per_unit
;
1204 uint16_t block_size
;
1205 uint16_t units_free
;
1209 /* trans2 RAW_QFS_ALLOCATION interface */
1211 enum smb_fsinfo_level level
;
1215 uint32_t sectors_per_unit
;
1216 uint32_t total_alloc_units
;
1217 uint32_t avail_alloc_units
;
1218 uint16_t bytes_per_sector
;
1222 /* TRANS2 RAW_QFS_VOLUME interface */
1224 enum smb_fsinfo_level level
;
1227 uint32_t serial_number
;
1228 struct smb_wire_string volume_name
;
1232 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1234 enum smb_fsinfo_level level
;
1235 struct smb2_handle handle
; /* only for smb2 */
1239 uint32_t serial_number
;
1240 struct smb_wire_string volume_name
;
1244 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1246 enum smb_fsinfo_level level
;
1247 struct smb2_handle handle
; /* only for smb2 */
1250 uint64_t total_alloc_units
;
1251 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1252 uint32_t sectors_per_unit
;
1253 uint32_t bytes_per_sector
;
1257 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1259 enum smb_fsinfo_level level
;
1260 struct smb2_handle handle
; /* only for smb2 */
1263 uint32_t device_type
;
1264 uint32_t characteristics
;
1269 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1271 enum smb_fsinfo_level level
;
1272 struct smb2_handle handle
; /* only for smb2 */
1276 uint32_t max_file_component_length
;
1277 struct smb_wire_string fs_type
;
1282 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1284 enum smb_fsinfo_level level
;
1287 uint16_t major_version
;
1288 uint16_t minor_version
;
1289 uint64_t capability
;
1293 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1295 enum smb_fsinfo_level level
;
1296 struct smb2_handle handle
; /* only for smb2 */
1299 uint64_t unknown
[3];
1300 uint64_t quota_soft
;
1301 uint64_t quota_hard
;
1302 uint64_t quota_flags
;
1304 } quota_information
;
1306 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1308 enum smb_fsinfo_level level
;
1309 struct smb2_handle handle
; /* only for smb2 */
1312 uint64_t total_alloc_units
;
1313 uint64_t call_avail_alloc_units
;
1314 uint64_t actual_avail_alloc_units
;
1315 uint32_t sectors_per_unit
;
1316 uint32_t bytes_per_sector
;
1318 } full_size_information
;
1320 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1322 enum smb_fsinfo_level level
;
1323 struct smb2_handle handle
; /* only for smb2 */
1327 uint64_t unknown
[6];
1329 } objectid_information
;
1331 /* trans2 RAW_QFS_SECTOR_SIZE_INFORMATION interface */
1333 enum smb_fsinfo_level level
;
1334 struct smb2_handle handle
; /* only for smb2 */
1337 uint32_t logical_bytes_per_sector
;
1338 uint32_t phys_bytes_per_sector_atomic
;
1339 uint32_t phys_bytes_per_sector_perf
;
1340 uint32_t fs_effective_phys_bytes_per_sector_atomic
;
1342 uint32_t byte_off_sector_align
;
1343 uint32_t byte_off_partition_align
;
1349 enum smb_setfsinfo_level
{
1350 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1352 union smb_setfsinfo
{
1353 /* generic interface */
1355 enum smb_setfsinfo_level level
;
1358 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1360 enum smb_setfsinfo_level level
;
1363 uint16_t major_version
;
1364 uint16_t minor_version
;
1365 uint64_t capability
;
1370 enum smb_open_level
{
1379 RAW_OPEN_NTTRANS_CREATE
,
1380 RAW_OPEN_OPENX_READX
,
1381 RAW_OPEN_NTCREATEX_READX
,
1385 /* the generic interface is defined to be equal to the NTCREATEX interface */
1386 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1388 /* union for open() backend call */
1391 * because the *.out.file structs are not aligned to the same offset for each level
1392 * we provide a hepler macro that should be used to find the current smb_handle structure
1394 #define SMB_OPEN_OUT_FILE(op, file) do { \
1395 switch (op->generic.level) { \
1396 case RAW_OPEN_OPEN: \
1397 file = &op->openold.out.file; \
1399 case RAW_OPEN_OPENX: \
1400 file = &op->openx.out.file; \
1402 case RAW_OPEN_MKNEW: \
1403 file = &op->mknew.out.file; \
1405 case RAW_OPEN_CREATE: \
1406 file = &op->create.out.file; \
1408 case RAW_OPEN_CTEMP: \
1409 file = &op->ctemp.out.file; \
1411 case RAW_OPEN_SPLOPEN: \
1412 file = &op->splopen.out.file; \
1414 case RAW_OPEN_NTCREATEX: \
1415 file = &op->ntcreatex.out.file; \
1417 case RAW_OPEN_T2OPEN: \
1418 file = &op->t2open.out.file; \
1420 case RAW_OPEN_NTTRANS_CREATE: \
1421 file = &op->nttrans.out.file; \
1423 case RAW_OPEN_OPENX_READX: \
1424 file = &op->openxreadx.out.file; \
1426 case RAW_OPEN_NTCREATEX_READX: \
1427 file = &op->ntcreatexreadx.out.file; \
1429 case RAW_OPEN_SMB2: \
1430 file = &op->smb2.out.file; \
1433 /* this must be a programmer error */ \
1438 /* SMBNTCreateX, nttrans and generic interface */
1440 enum smb_open_level level
;
1443 union smb_handle root_fid
;
1444 uint32_t access_mask
;
1445 uint64_t alloc_size
;
1447 uint32_t share_access
;
1448 uint32_t open_disposition
;
1449 uint32_t create_options
;
1450 uint32_t impersonation
;
1451 uint8_t security_flags
;
1452 /* NOTE: fname can also be a pointer to a
1453 uint64_t file_id if create_options has the
1454 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1457 /* these last 2 elements are only used in the
1458 NTTRANS varient of the call */
1459 struct security_descriptor
*sec_desc
;
1460 struct smb_ea_list
*ea_list
;
1462 /* some optional parameters from the SMB2 varient */
1463 bool query_maximal_access
;
1464 bool query_on_disk_id
;
1466 /* private flags for internal use only */
1467 uint8_t private_flags
;
1470 union smb_handle file
;
1471 uint8_t oplock_level
;
1472 uint32_t create_action
;
1478 uint64_t alloc_size
;
1482 uint8_t is_directory
;
1484 /* optional return values matching SMB2 tagged
1485 values in the call */
1486 uint32_t maximal_access
;
1487 uint8_t on_disk_id
[32];
1489 } ntcreatex
, nttrans
, generic
;
1491 /* TRANS2_OPEN interface */
1493 enum smb_open_level level
;
1497 uint16_t search_attrs
;
1498 uint16_t file_attrs
;
1504 unsigned int num_eas
;
1505 struct ea_struct
*eas
;
1508 union smb_handle file
;
1520 /* SMBopen interface */
1522 enum smb_open_level level
;
1525 uint16_t search_attrs
;
1529 union smb_handle file
;
1537 /* SMBopenX interface */
1539 enum smb_open_level level
;
1543 uint16_t search_attrs
; /* not honoured by win2003 */
1544 uint16_t file_attrs
;
1545 time_t write_time
; /* not honoured by win2003 */
1547 uint32_t size
; /* note that this sets the
1548 initial file size, not
1549 just allocation size */
1550 uint32_t timeout
; /* not honoured by win2003 */
1554 union smb_handle file
;
1562 uint32_t unique_fid
;
1563 uint32_t access_mask
;
1568 /* SMBmknew interface */
1570 enum smb_open_level level
;
1577 union smb_handle file
;
1581 /* SMBctemp interface */
1583 enum smb_open_level level
;
1587 const char *directory
;
1590 union smb_handle file
;
1591 /* temp name, relative to directory */
1596 /* SMBsplopen interface */
1598 enum smb_open_level level
;
1600 uint16_t setup_length
;
1605 union smb_handle file
;
1610 /* chained OpenX/ReadX interface */
1612 enum smb_open_level level
;
1616 uint16_t search_attrs
; /* not honoured by win2003 */
1617 uint16_t file_attrs
;
1618 time_t write_time
; /* not honoured by win2003 */
1620 uint32_t size
; /* note that this sets the
1621 initial file size, not
1622 just allocation size */
1623 uint32_t timeout
; /* not honoured by win2003 */
1633 union smb_handle file
;
1641 uint32_t unique_fid
;
1642 uint32_t access_mask
;
1648 uint16_t compaction_mode
;
1653 /* chained NTCreateX/ReadX interface */
1655 enum smb_open_level level
;
1658 union smb_handle root_fid
;
1659 uint32_t access_mask
;
1660 uint64_t alloc_size
;
1662 uint32_t share_access
;
1663 uint32_t open_disposition
;
1664 uint32_t create_options
;
1665 uint32_t impersonation
;
1666 uint8_t security_flags
;
1667 /* NOTE: fname can also be a pointer to a
1668 uint64_t file_id if create_options has the
1669 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1679 union smb_handle file
;
1680 uint8_t oplock_level
;
1681 uint32_t create_action
;
1687 uint64_t alloc_size
;
1691 uint8_t is_directory
;
1696 uint16_t compaction_mode
;
1701 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1702 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1703 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1704 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1707 struct smb2_create
{
1708 enum smb_open_level level
;
1710 /* static body buffer 56 (0x38) bytes */
1711 uint8_t security_flags
; /* SMB2_SECURITY_* */
1712 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1713 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1714 uint64_t create_flags
;
1716 uint32_t desired_access
;
1717 uint32_t file_attributes
;
1718 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1719 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1720 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1722 /* uint16_t fname_ofs */
1723 /* uint16_t fname_size */
1724 /* uint32_t blob_ofs; */
1725 /* uint32_t blob_size; */
1730 /* now some optional parameters - encoded as tagged blobs */
1731 struct smb_ea_list eas
;
1732 uint64_t alloc_size
;
1733 struct security_descriptor
*sec_desc
;
1735 struct smb2_handle
*durable_handle
;
1737 /* data for durable handle v2 */
1738 bool durable_open_v2
;
1739 struct GUID create_guid
;
1740 bool persistent_open
;
1742 struct smb2_handle
*durable_handle_v2
;
1744 bool query_maximal_access
;
1746 bool query_on_disk_id
;
1747 struct smb2_lease
*lease_request
;
1748 struct smb2_lease
*lease_request_v2
;
1750 struct GUID
*app_instance_id
;
1752 /* and any additional blobs the caller wants */
1753 struct smb2_create_blobs blobs
;
1756 union smb_handle file
;
1758 /* static body buffer 88 (0x58) bytes */
1759 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1760 uint8_t oplock_level
;
1762 uint32_t create_action
;
1767 uint64_t alloc_size
;
1771 /* struct smb2_handle handle;*/
1772 /* uint32_t blob_ofs; */
1773 /* uint32_t blob_size; */
1775 /* optional return values matching tagged values in the call */
1776 uint32_t maximal_access_status
;
1777 uint32_t maximal_access
;
1778 uint8_t on_disk_id
[32];
1779 struct smb2_lease lease_response
;
1780 struct smb2_lease lease_response_v2
;
1783 /* durable handle v2 */
1784 bool durable_open_v2
;
1785 bool persistent_open
;
1788 /* tagged blobs in the reply */
1789 struct smb2_create_blobs blobs
;
1796 enum smb_read_level
{
1804 #define RAW_READ_GENERIC RAW_READ_READX
1806 /* union for read() backend call
1808 note that .infoX.out.data will be allocated before the backend is
1809 called. It will be big enough to hold the maximum size asked for
1812 /* SMBreadX (and generic) interface */
1814 enum smb_read_level level
;
1816 union smb_handle file
;
1818 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1821 bool read_for_execute
;
1826 uint16_t compaction_mode
;
1829 uint16_t data_offset
;
1833 /* SMBreadbraw interface */
1835 enum smb_read_level level
;
1837 union smb_handle file
;
1850 /* SMBlockandread interface */
1852 enum smb_read_level level
;
1854 union smb_handle file
;
1865 /* SMBread interface */
1867 enum smb_read_level level
;
1869 union smb_handle file
;
1882 enum smb_read_level level
;
1884 union smb_handle file
;
1886 /* static body buffer 48 (0x30) bytes */
1887 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1892 /* struct smb2_handle handle; */
1896 /* the docs give no indication of what
1897 these channel variables are for */
1898 uint16_t channel_offset
;
1899 uint16_t channel_length
;
1902 /* static body buffer 16 (0x10) bytes */
1903 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1904 /* uint8_t data_ofs; */
1905 /* uint8_t reserved; */
1906 /* uint32_t data_size; */
1917 enum smb_write_level
{
1918 RAW_WRITE_WRITEUNLOCK
,
1921 RAW_WRITE_WRITECLOSE
,
1926 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1928 /* union for write() backend call
1931 /* SMBwriteX interface */
1933 enum smb_write_level level
;
1935 union smb_handle file
;
1940 const uint8_t *data
;
1948 /* SMBwriteunlock interface */
1950 enum smb_write_level level
;
1952 union smb_handle file
;
1956 const uint8_t *data
;
1963 /* SMBwrite interface */
1965 enum smb_write_level level
;
1967 union smb_handle file
;
1971 const uint8_t *data
;
1978 /* SMBwriteclose interface */
1980 enum smb_write_level level
;
1982 union smb_handle file
;
1986 const uint8_t *data
;
1993 /* SMBsplwrite interface */
1995 enum smb_write_level level
;
1997 union smb_handle file
;
1999 const uint8_t *data
;
2005 enum smb_write_level level
;
2007 union smb_handle file
;
2009 /* static body buffer 48 (0x30) bytes */
2010 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2011 /* uint16_t data_ofs; */
2012 /* uint32_t data_size; */
2014 /* struct smb2_handle handle; */
2015 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2016 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2022 /* static body buffer 17 (0x11) bytes */
2023 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2026 uint64_t unknown1
; /* 0x0000000000000000 */
2032 enum smb_lock_level
{
2040 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2042 /* union for lock() backend call
2045 /* SMBlockingX and generic interface */
2047 enum smb_lock_level level
;
2049 union smb_handle file
;
2054 struct smb_lock_entry
{
2055 uint32_t pid
; /* 16 bits in SMB1 */
2058 } *locks
; /* unlocks are first in the arrray */
2062 /* SMBlock and SMBunlock interface */
2064 enum smb_lock_level level
;
2066 union smb_handle file
;
2074 enum smb_lock_level level
;
2076 union smb_handle file
;
2078 /* static body buffer 48 (0x30) bytes */
2079 /* uint16_t buffer_code; 0x30 */
2080 uint16_t lock_count
;
2081 uint32_t lock_sequence
;
2082 /* struct smb2_handle handle; */
2083 struct smb2_lock_element
*locks
;
2086 /* static body buffer 4 (0x04) bytes */
2087 /* uint16_t buffer_code; 0x04 */
2094 enum smb_lock_level level
;
2096 union smb_handle file
;
2098 /* static body buffer 24 (0x18) bytes */
2099 uint8_t oplock_level
;
2102 /* struct smb2_handle handle; */
2106 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2107 struct smb2_lease_break_ack
{
2110 struct smb2_lease lease
;
2112 } smb2_lease_break_ack
;
2116 enum smb_close_level
{
2124 union for close() backend call
2127 /* generic interface */
2129 enum smb_close_level level
;
2131 union smb_handle file
;
2133 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2141 uint64_t alloc_size
;
2147 /* SMBclose interface */
2149 enum smb_close_level level
;
2151 union smb_handle file
;
2156 /* SMBsplclose interface - empty! */
2158 enum smb_close_level level
;
2160 union smb_handle file
;
2166 enum smb_close_level level
;
2168 union smb_handle file
;
2170 /* static body buffer 24 (0x18) bytes */
2171 /* uint16_t buffer_code; 0x18 */
2172 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2176 /* static body buffer 60 (0x3C) bytes */
2177 /* uint16_t buffer_code; 0x3C */
2184 uint64_t alloc_size
;
2192 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2195 union for lpq() backend
2198 /* generic interface */
2200 enum smb_lpq_level level
;
2205 /* SMBsplretq interface */
2207 enum smb_lpq_level level
;
2215 uint16_t restart_idx
;
2227 enum smb_ioctl_level
{
2231 RAW_IOCTL_SMB2_NO_HANDLE
2235 union for ioctl() backend
2238 /* generic interface */
2240 enum smb_ioctl_level level
;
2242 union smb_handle file
;
2246 /* struct for SMBioctl */
2248 enum smb_ioctl_level level
;
2250 union smb_handle file
;
2259 /* struct for NT ioctl call */
2261 enum smb_ioctl_level level
;
2263 union smb_handle file
;
2277 enum smb_ioctl_level level
;
2279 union smb_handle file
;
2281 /* static body buffer 56 (0x38) bytes */
2282 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2285 /*struct smb2_handle handle;*/
2286 /* uint32_t out_ofs; */
2287 /* uint32_t out_size; */
2288 uint32_t max_input_response
;
2289 /* uint32_t in_ofs; */
2290 /* uint32_t in_size; */
2291 uint32_t max_output_response
;
2300 union smb_handle file
;
2302 /* static body buffer 48 (0x30) bytes */
2303 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2306 /* struct smb2_handle handle; */
2307 /* uint32_t in_ofs; */
2308 /* uint32_t in_size; */
2309 /* uint32_t out_ofs; */
2310 /* uint32_t out_size; */
2321 enum smb_flush_level
{
2328 /* struct for SMBflush */
2330 enum smb_flush_level level
;
2332 union smb_handle file
;
2336 /* SMBflush with 0xFFFF wildcard fnum */
2338 enum smb_flush_level level
;
2343 enum smb_flush_level level
;
2345 union smb_handle file
;
2355 /* struct for SMBcopy */
2370 /* struct for transact/transact2 call */
2378 uint8_t setup_count
;
2380 const char *trans_name
; /* SMBtrans only */
2386 uint8_t setup_count
;
2393 /* struct for nttransact2 call */
2394 struct smb_nttrans
{
2399 uint8_t setup_count
;
2407 uint8_t setup_count
; /* in units of 16 bit words */
2414 enum smb_notify_level
{
2420 /* struct for nttrans change notify call */
2422 enum smb_notify_level level
;
2425 union smb_handle file
;
2426 uint32_t buffer_size
;
2427 uint32_t completion_filter
;
2432 uint32_t num_changes
;
2433 struct notify_changes
{
2435 struct smb_wire_string name
;
2440 struct smb2_notify
{
2441 enum smb_notify_level level
;
2444 union smb_handle file
;
2445 /* static body buffer 32 (0x20) bytes */
2446 /* uint16_t buffer_code; 0x32 */
2448 uint32_t buffer_size
;
2449 /*struct smb2_handle file;*/
2450 uint32_t completion_filter
;
2455 /* static body buffer 8 (0x08) bytes */
2456 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2457 /* uint16_t blob_ofs; */
2458 /* uint16_t blob_size; */
2463 /* DATA_BLOB content */
2464 uint32_t num_changes
;
2465 struct notify_changes
*changes
;
2470 enum smb_search_level
{
2471 RAW_SEARCH_SEARCH
, /* SMBsearch */
2472 RAW_SEARCH_FFIRST
, /* SMBffirst */
2473 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2474 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2475 RAW_SEARCH_SMB2
/* SMB2 Find */
2478 enum smb_search_data_level
{
2479 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2480 RAW_SEARCH_DATA_SEARCH
,
2481 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2482 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2483 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2484 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2485 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2486 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2487 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2488 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2489 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2490 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2491 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2494 /* union for file search */
2495 union smb_search_first
{
2497 enum smb_search_level level
;
2498 enum smb_search_data_level data_level
;
2501 /* search (old) findfirst interface.
2502 Also used for ffirst and funique. */
2504 enum smb_search_level level
;
2505 enum smb_search_data_level data_level
;
2509 uint16_t search_attrib
;
2510 const char *pattern
;
2517 /* trans2 findfirst interface */
2519 enum smb_search_level level
;
2520 enum smb_search_data_level data_level
;
2523 uint16_t search_attrib
;
2526 uint32_t storage_type
;
2527 const char *pattern
;
2529 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2530 unsigned int num_names
;
2531 struct ea_name
*ea_names
;
2536 uint16_t end_of_search
;
2542 enum smb_search_level level
;
2543 enum smb_search_data_level data_level
;
2545 union smb_handle file
;
2547 /* static body buffer 32 (0x20) bytes */
2548 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2550 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2551 uint32_t file_index
;
2552 /* struct smb2_handle handle; */
2553 /* uint16_t pattern_ofs; */
2554 /* uint16_t pattern_size; */
2555 uint32_t max_response_size
;
2558 const char *pattern
;
2561 /* static body buffer 8 (0x08) bytes */
2562 /* uint16_t buffer_code; 0x08 */
2563 /* uint16_t blob_ofs; */
2564 /* uint32_t blob_size; */
2572 /* union for file search continue */
2573 union smb_search_next
{
2575 enum smb_search_level level
;
2576 enum smb_search_data_level data_level
;
2579 /* search (old) findnext interface. Also used
2580 for ffirst when continuing */
2582 enum smb_search_level level
;
2583 enum smb_search_data_level data_level
;
2587 uint16_t search_attrib
;
2588 struct smb_search_id
{
2592 uint32_t server_cookie
;
2593 uint32_t client_cookie
;
2601 /* trans2 findnext interface */
2603 enum smb_search_level level
;
2604 enum smb_search_data_level data_level
;
2609 uint32_t resume_key
;
2611 const char *last_name
;
2613 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2614 unsigned int num_names
;
2615 struct ea_name
*ea_names
;
2619 uint16_t end_of_search
;
2624 struct smb2_find smb2
;
2627 /* union for search reply file data */
2628 union smb_search_data
{
2630 * search (old) findfirst
2631 * RAW_SEARCH_DATA_SEARCH
2637 struct smb_search_id id
;
2641 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2643 uint32_t resume_key
;
2648 uint32_t alloc_size
;
2650 struct smb_wire_string name
;
2653 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2655 uint32_t resume_key
;
2660 uint32_t alloc_size
;
2663 struct smb_wire_string name
;
2666 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2668 uint32_t resume_key
;
2673 uint32_t alloc_size
;
2675 struct smb_ea_list eas
;
2676 struct smb_wire_string name
;
2679 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2681 uint32_t file_index
;
2687 uint64_t alloc_size
;
2689 struct smb_wire_string name
;
2692 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2694 uint32_t file_index
;
2700 uint64_t alloc_size
;
2703 struct smb_wire_string name
;
2704 } full_directory_info
;
2706 /* RAW_SEARCH_DATA_NAME_INFO interface */
2708 uint32_t file_index
;
2709 struct smb_wire_string name
;
2712 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2714 uint32_t file_index
;
2720 uint64_t alloc_size
;
2723 struct smb_wire_string short_name
;
2724 struct smb_wire_string name
;
2725 } both_directory_info
;
2727 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2729 uint32_t file_index
;
2735 uint64_t alloc_size
;
2739 struct smb_wire_string name
;
2740 } id_full_directory_info
;
2742 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2744 uint32_t file_index
;
2750 uint64_t alloc_size
;
2754 uint8_t short_name_buf
[24];
2755 struct smb_wire_string short_name
;
2756 struct smb_wire_string name
;
2757 } id_both_directory_info
;
2759 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2761 uint32_t file_index
;
2763 uint64_t alloc_size
;
2764 NTTIME status_change_time
;
2773 uint64_t permissions
;
2778 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2780 uint32_t file_index
;
2781 uint64_t end_of_file
;
2783 NTTIME status_change_time
;
2792 uint64_t permissions
;
2795 uint32_t file_flags
;
2796 uint32_t flags_mask
;
2797 struct smb_wire_string name
;
2801 /* Callback function passed to the raw search interface. */
2802 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2804 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2806 /* union for file search close */
2807 union smb_search_close
{
2809 enum smb_search_close_level level
;
2812 /* SMBfclose (old search) interface */
2814 enum smb_search_close_level level
;
2817 /* max_count and search_attrib are not used, but are present */
2819 uint16_t search_attrib
;
2820 struct smb_search_id id
;
2824 /* SMBfindclose interface */
2826 enum smb_search_close_level level
;
2836 struct for SMBecho call
2840 uint16_t repeat_count
;
2846 uint16_t sequence_number
;
2853 struct for shadow copy volumes
2855 struct smb_shadow_copy
{
2857 union smb_handle file
;
2861 uint32_t num_volumes
;
2867 #endif /* __LIBCLI_RAW_INTERFACES_H__ */