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__
26 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
28 /* this structure is just a wrapper for a string, the only reason we
29 bother with this is that it allows us to check the length provided
30 on the wire in testsuite test code to ensure that we are
31 terminating names in the same way that win2003 is. The *ONLY* time
32 you should ever look at the 'private_length' field in this
33 structure is inside compliance test code, in all other cases just
34 use the null terminated char* as the definitive definition of the
37 also note that this structure is only used in packets where there
38 is an explicit length provided on the wire (hence the name). That
39 length is placed in 'private_length'. For packets where the length
40 is always determined by NULL or packet termination a normal char*
41 is used in the structure definition.
43 struct smb_wire_string {
44 uint32_t private_length;
49 * SMB2 uses a 16Byte handle,
50 * (we can maybe use struct GUID later)
59 * a generic container for file handles or file pathes
60 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
62 union smb_handle_or_path {
65 * the qpathinfo and setpathinfo
70 * this is used as file handle in SMB
75 * this is used as file handle in SMB2
77 struct smb2_handle handle;
80 * this is used as generic file handle for the NTVFS layer
82 struct ntvfs_handle *ntvfs;
86 a generic container for file handles
90 * this is used as file handle in SMB
95 * this is used as file handle in SMB2
97 struct smb2_handle handle;
100 * this is used as generic file handle for the NTVFS layer
102 struct ntvfs_handle *ntvfs;
106 this header defines the structures and unions used between the SMB
107 parser and the backends.
110 /* struct used for SMBlseek call */
114 union smb_handle file;
116 int32_t offset; /* signed */
124 /* struct used in unlink() call */
135 /* struct used in chkpath() call */
144 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
146 /* union used in mkdir() call */
150 enum smb_mkdir_level level;
154 enum smb_mkdir_level level;
161 enum smb_mkdir_level level;
165 struct ea_struct *eas;
170 /* struct used in rmdir() call */
177 /* struct used in rename() call */
178 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME, RAW_RENAME_NTTRANS};
182 enum smb_rename_level level;
185 /* SMBrename interface */
187 enum smb_rename_level level;
190 const char *pattern1;
191 const char *pattern2;
197 /* SMBntrename interface */
199 enum smb_rename_level level;
203 uint16_t flags; /* see RENAME_FLAG_* */
204 uint32_t cluster_size;
205 const char *old_name;
206 const char *new_name;
210 /* NT TRANS rename interface */
212 enum smb_rename_level level;
215 union smb_handle file;
216 uint16_t flags;/* see RENAME_REPLACE_IF_EXISTS */
217 const char *new_name;
222 enum smb_tcon_level {
228 /* union used in tree connect call */
230 /* generic interface */
232 enum smb_tcon_level level;
235 /* SMBtcon interface */
237 enum smb_tcon_level level;
241 const char *password;
250 /* SMBtconX interface */
252 enum smb_tcon_level level;
268 /* SMB2 TreeConnect */
269 struct smb2_tree_connect {
270 enum smb_tcon_level level;
273 /* static body buffer 8 (0x08) bytes */
275 /* uint16_t path_ofs */
276 /* uint16_t path_size */
278 const char *path; /* as non-terminated UTF-16 on the wire */
281 /* static body buffer 16 (0x10) bytes */
282 /* uint16_t buffer_code; 0x10 */
286 uint32_t capabilities;
287 uint32_t access_mask;
289 /* extracted from the SMB2 header */
296 enum smb_sesssetup_level {
299 RAW_SESSSETUP_SPNEGO,
303 /* union used in session_setup call */
304 union smb_sesssetup {
305 /* the pre-NT1 interface */
307 enum smb_sesssetup_level level;
329 /* the NT1 interface */
331 enum smb_sesssetup_level level;
338 uint32_t capabilities;
356 /* the SPNEGO interface */
358 enum smb_sesssetup_level level;
365 uint32_t capabilities;
369 const char *workgroup;
381 /* SMB2 SessionSetup */
382 struct smb2_session_setup {
383 enum smb_sesssetup_level level;
386 /* static body 24 (0x18) bytes */
388 uint8_t security_mode;
389 uint32_t capabilities;
391 /* uint16_t secblob_ofs */
392 /* uint16_t secblob_size */
393 uint64_t previous_sessionid;
398 /* body buffer 8 (0x08) bytes */
399 uint16_t session_flags;
400 /* uint16_t secblob_ofs */
401 /* uint16_t secblob_size */
405 /* extracted from the SMB2 header */
411 /* Note that the specified enum values are identical to the actual info-levels used
414 enum smb_fileinfo_level {
415 RAW_FILEINFO_GENERIC = 0xF000,
416 RAW_FILEINFO_GETATTR, /* SMBgetatr */
417 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
418 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
419 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
420 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
421 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
422 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
423 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
424 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
425 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
426 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
427 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
428 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
429 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
430 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
431 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
432 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
433 RAW_FILEINFO_UNIX_INFO2 = SMB_QFILEINFO_UNIX_INFO2,
434 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
435 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
436 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
437 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
438 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
439 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
440 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
441 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
442 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
443 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
444 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
445 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
446 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
447 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
448 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
449 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
450 /* SMB2 specific levels */
451 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
452 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
455 /* union used in qfileinfo() and qpathinfo() backend calls */
457 /* generic interface:
458 * matches RAW_FILEINFO_GENERIC */
460 enum smb_fileinfo_level level;
462 union smb_handle_or_path file;
470 struct smb_wire_string name;
480 struct smb_wire_string fname;
481 struct smb_wire_string alt_fname;
482 uint8_t delete_pending;
484 uint64_t compressed_size;
488 uint8_t cluster_shift;
490 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
493 uint32_t alignment_requirement;
494 uint32_t reparse_tag;
496 struct stream_struct {
499 struct smb_wire_string stream_name;
505 /* SMBgetatr interface:
506 * matches RAW_FILEINFO_GETATTR */
508 enum smb_fileinfo_level level;
510 union smb_handle_or_path file;
519 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
521 enum smb_fileinfo_level level;
523 union smb_handle_or_path file;
533 } getattre, standard;
535 /* trans2 RAW_FILEINFO_EA_SIZE interface */
537 enum smb_fileinfo_level level;
539 union smb_handle_or_path file;
552 /* trans2 RAW_FILEINFO_EA_LIST interface */
554 enum smb_fileinfo_level level;
556 union smb_handle_or_path file;
559 struct smb_wire_string name;
565 struct ea_struct *eas;
569 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
571 enum smb_fileinfo_level level;
573 union smb_handle_or_path file;
574 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
575 uint8_t continue_flags;
577 struct smb_ea_list out;
580 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
581 only valid for a QPATHNAME call - no returned data */
583 enum smb_fileinfo_level level;
585 union smb_handle_or_path file;
589 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
591 enum smb_fileinfo_level level;
593 union smb_handle_or_path file;
605 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
607 enum smb_fileinfo_level level;
609 union smb_handle_or_path file;
620 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
622 enum smb_fileinfo_level level;
624 union smb_handle_or_path file;
631 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
633 enum smb_fileinfo_level level;
635 union smb_handle_or_path file;
638 struct smb_wire_string fname;
642 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
644 enum smb_fileinfo_level level;
646 union smb_handle_or_path file;
657 uint8_t delete_pending;
660 struct smb_wire_string fname;
664 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
666 enum smb_fileinfo_level level;
668 union smb_handle_or_path file;
680 uint8_t delete_pending;
685 uint32_t access_mask;
688 uint32_t alignment_requirement;
689 struct smb_wire_string fname;
693 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
695 enum smb_fileinfo_level level;
697 union smb_handle_or_path file;
700 struct smb_wire_string fname;
704 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
706 enum smb_fileinfo_level level;
708 union smb_handle_or_path file;
710 struct stream_information {
712 struct stream_struct *streams;
716 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
718 enum smb_fileinfo_level level;
720 union smb_handle_or_path file;
723 uint64_t compressed_size;
727 uint8_t cluster_shift;
731 /* RAW_FILEINFO_UNIX_BASIC interface */
733 enum smb_fileinfo_level level;
735 union smb_handle_or_path file;
738 uint64_t end_of_file;
740 NTTIME status_change_time;
749 uint64_t permissions;
754 /* RAW_FILEINFO_UNIX_INFO2 interface */
756 enum smb_fileinfo_level level;
758 union smb_handle_or_path file;
761 uint64_t end_of_file;
763 NTTIME status_change_time;
772 uint64_t permissions;
780 /* RAW_FILEINFO_UNIX_LINK interface */
782 enum smb_fileinfo_level level;
784 union smb_handle_or_path file;
787 struct smb_wire_string link_dest;
791 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
793 enum smb_fileinfo_level level;
795 union smb_handle_or_path file;
800 } internal_information;
802 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
804 enum smb_fileinfo_level level;
806 union smb_handle_or_path file;
809 uint32_t access_flags;
811 } access_information;
813 /* RAW_FILEINFO_POSITION_INFORMATION interface */
815 enum smb_fileinfo_level level;
817 union smb_handle_or_path file;
822 } position_information;
824 /* RAW_FILEINFO_MODE_INFORMATION interface */
826 enum smb_fileinfo_level level;
828 union smb_handle_or_path file;
835 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
837 enum smb_fileinfo_level level;
839 union smb_handle_or_path file;
842 uint32_t alignment_requirement;
844 } alignment_information;
846 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
848 enum smb_fileinfo_level level;
850 union smb_handle_or_path file;
861 } network_open_information;
864 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
866 enum smb_fileinfo_level level;
868 union smb_handle_or_path file;
872 uint32_t reparse_tag;
874 } attribute_tag_information;
876 /* RAW_FILEINFO_SEC_DESC */
878 enum smb_fileinfo_level level;
880 union smb_handle_or_path file;
881 uint32_t secinfo_flags;
884 struct security_descriptor *sd;
890 enum smb_setfileinfo_level {
891 RAW_SFILEINFO_GENERIC = 0xF000,
892 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
893 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
894 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
895 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
896 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
897 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
898 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
899 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
900 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
901 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
902 RAW_SFILEINFO_UNIX_INFO2 = SMB_SFILEINFO_UNIX_INFO2,
903 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
904 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
905 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
906 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
907 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
908 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
909 RAW_SFILEINFO_FULL_EA_INFORMATION = SMB_SFILEINFO_FULL_EA_INFORMATION,
910 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
911 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
912 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
913 RAW_SFILEINFO_PIPE_INFORMATION = SMB_SFILEINFO_PIPE_INFORMATION,
914 RAW_SFILEINFO_VALID_DATA_INFORMATION = SMB_SFILEINFO_VALID_DATA_INFORMATION,
915 RAW_SFILEINFO_SHORT_NAME_INFORMATION = SMB_SFILEINFO_SHORT_NAME_INFORMATION,
916 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
917 RAW_SFILEINFO_1027 = SMB_SFILEINFO_1027,
918 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
919 RAW_SFILEINFO_1030 = SMB_SFILEINFO_1030,
920 RAW_SFILEINFO_1031 = SMB_SFILEINFO_1031,
921 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
922 RAW_SFILEINFO_1036 = SMB_SFILEINFO_1036,
923 RAW_SFILEINFO_1041 = SMB_SFILEINFO_1041,
924 RAW_SFILEINFO_1042 = SMB_SFILEINFO_1042,
925 RAW_SFILEINFO_1043 = SMB_SFILEINFO_1043,
926 RAW_SFILEINFO_1044 = SMB_SFILEINFO_1044,
928 /* cope with breakage in SMB2 */
929 RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
932 /* union used in setfileinfo() and setpathinfo() calls */
933 union smb_setfileinfo {
934 /* generic interface */
936 enum smb_setfileinfo_level level;
938 union smb_handle_or_path file;
942 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
944 enum smb_setfileinfo_level level;
946 union smb_handle_or_path file;
952 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
953 also RAW_SFILEINFO_STANDARD */
955 enum smb_setfileinfo_level level;
957 union smb_handle_or_path file;
961 /* notice that size, alloc_size and attrib are not settable,
962 unlike the corresponding qfileinfo level */
964 } setattre, standard;
966 /* RAW_SFILEINFO_EA_SET interface */
968 enum smb_setfileinfo_level level;
970 union smb_handle_or_path file;
972 struct ea_struct *eas;
976 /* RAW_SFILEINFO_BASIC_INFO and
977 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
979 enum smb_setfileinfo_level level;
981 union smb_handle_or_path file;
990 /* RAW_SFILEINFO_DISPOSITION_INFO and
991 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
993 enum smb_setfileinfo_level level;
995 union smb_handle_or_path file;
996 bool delete_on_close;
1000 /* RAW_SFILEINFO_ALLOCATION_INFO and
1001 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1003 enum smb_setfileinfo_level level;
1005 union smb_handle_or_path file;
1006 /* w2k3 rounds this up to nearest 4096 */
1007 uint64_t alloc_size;
1011 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1012 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1014 enum smb_setfileinfo_level level;
1016 union smb_handle_or_path file;
1021 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1023 enum smb_setfileinfo_level level;
1025 union smb_handle_or_path file;
1028 const char *new_name;
1030 } rename_information;
1032 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1034 enum smb_setfileinfo_level level;
1036 union smb_handle_or_path file;
1039 } position_information;
1041 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1043 enum smb_setfileinfo_level level;
1045 union smb_handle_or_path file;
1046 /* valid values seem to be 0, 2, 4 and 6 */
1051 /* RAW_SFILEINFO_UNIX_BASIC interface */
1053 enum smb_setfileinfo_level level;
1055 union smb_handle_or_path file;
1056 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
1057 uint64_t end_of_file;
1059 NTTIME status_change_time;
1068 uint64_t permissions;
1073 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1075 enum smb_setfileinfo_level level;
1077 union smb_handle_or_path file;
1078 uint64_t end_of_file;
1080 NTTIME status_change_time;
1089 uint64_t permissions;
1092 uint32_t file_flags;
1093 uint32_t flags_mask;
1097 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1099 enum smb_setfileinfo_level level;
1101 union smb_handle_or_path file;
1102 const char *link_dest;
1104 } unix_link, unix_hlink;
1106 /* RAW_FILEINFO_SET_SEC_DESC */
1108 enum smb_setfileinfo_level level;
1110 union smb_handle_or_path file;
1111 uint32_t secinfo_flags;
1112 struct security_descriptor *sd;
1118 enum smb_fsinfo_level {
1119 RAW_QFS_GENERIC = 0xF000,
1120 RAW_QFS_DSKATTR, /* SMBdskattr */
1121 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
1122 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
1123 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
1124 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
1125 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
1126 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
1127 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
1128 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
1129 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
1130 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
1131 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
1132 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
1133 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
1134 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
1137 /* union for fsinfo() backend call. Note that there are no in
1138 structures, as this call only contains out parameters */
1140 /* generic interface */
1142 enum smb_fsinfo_level level;
1143 struct smb2_handle handle; /* only for smb2 */
1146 uint32_t block_size;
1147 uint64_t blocks_total;
1148 uint64_t blocks_free;
1151 uint32_t serial_number;
1153 uint32_t max_file_component_length;
1154 uint32_t device_type;
1155 uint32_t device_characteristics;
1156 uint64_t quota_soft;
1157 uint64_t quota_hard;
1158 uint64_t quota_flags;
1165 /* SMBdskattr interface */
1167 enum smb_fsinfo_level level;
1170 uint16_t units_total;
1171 uint16_t blocks_per_unit;
1172 uint16_t block_size;
1173 uint16_t units_free;
1177 /* trans2 RAW_QFS_ALLOCATION interface */
1179 enum smb_fsinfo_level level;
1183 uint32_t sectors_per_unit;
1184 uint32_t total_alloc_units;
1185 uint32_t avail_alloc_units;
1186 uint16_t bytes_per_sector;
1190 /* TRANS2 RAW_QFS_VOLUME interface */
1192 enum smb_fsinfo_level level;
1195 uint32_t serial_number;
1196 struct smb_wire_string volume_name;
1200 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1202 enum smb_fsinfo_level level;
1203 struct smb2_handle handle; /* only for smb2 */
1207 uint32_t serial_number;
1208 struct smb_wire_string volume_name;
1212 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1214 enum smb_fsinfo_level level;
1215 struct smb2_handle handle; /* only for smb2 */
1218 uint64_t total_alloc_units;
1219 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1220 uint32_t sectors_per_unit;
1221 uint32_t bytes_per_sector;
1225 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1227 enum smb_fsinfo_level level;
1228 struct smb2_handle handle; /* only for smb2 */
1231 uint32_t device_type;
1232 uint32_t characteristics;
1237 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1239 enum smb_fsinfo_level level;
1240 struct smb2_handle handle; /* only for smb2 */
1244 uint32_t max_file_component_length;
1245 struct smb_wire_string fs_type;
1250 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1252 enum smb_fsinfo_level level;
1255 uint16_t major_version;
1256 uint16_t minor_version;
1257 uint64_t capability;
1261 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1263 enum smb_fsinfo_level level;
1264 struct smb2_handle handle; /* only for smb2 */
1267 uint64_t unknown[3];
1268 uint64_t quota_soft;
1269 uint64_t quota_hard;
1270 uint64_t quota_flags;
1272 } quota_information;
1274 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1276 enum smb_fsinfo_level level;
1277 struct smb2_handle handle; /* only for smb2 */
1280 uint64_t total_alloc_units;
1281 uint64_t call_avail_alloc_units;
1282 uint64_t actual_avail_alloc_units;
1283 uint32_t sectors_per_unit;
1284 uint32_t bytes_per_sector;
1286 } full_size_information;
1288 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1290 enum smb_fsinfo_level level;
1291 struct smb2_handle handle; /* only for smb2 */
1295 uint64_t unknown[6];
1297 } objectid_information;
1302 enum smb_open_level {
1311 RAW_OPEN_NTTRANS_CREATE,
1312 RAW_OPEN_OPENX_READX,
1316 /* the generic interface is defined to be equal to the NTCREATEX interface */
1317 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1319 /* union for open() backend call */
1322 * because the *.out.file structs are not aligned to the same offset for each level
1323 * we provide a hepler macro that should be used to find the current smb_handle structure
1325 #define SMB_OPEN_OUT_FILE(op, file) do { \
1326 switch (op->generic.level) { \
1327 case RAW_OPEN_OPEN: \
1328 file = &op->openold.out.file; \
1330 case RAW_OPEN_OPENX: \
1331 file = &op->openx.out.file; \
1333 case RAW_OPEN_MKNEW: \
1334 file = &op->mknew.out.file; \
1336 case RAW_OPEN_CREATE: \
1337 file = &op->create.out.file; \
1339 case RAW_OPEN_CTEMP: \
1340 file = &op->ctemp.out.file; \
1342 case RAW_OPEN_SPLOPEN: \
1343 file = &op->splopen.out.file; \
1345 case RAW_OPEN_NTCREATEX: \
1346 file = &op->ntcreatex.out.file; \
1348 case RAW_OPEN_T2OPEN: \
1349 file = &op->t2open.out.file; \
1351 case RAW_OPEN_NTTRANS_CREATE: \
1352 file = &op->nttrans.out.file; \
1354 case RAW_OPEN_OPENX_READX: \
1355 file = &op->openxreadx.out.file; \
1357 case RAW_OPEN_SMB2: \
1358 file = &op->smb2.out.file; \
1361 /* this must be a programmer error */ \
1366 /* SMBNTCreateX, nttrans and generic interface */
1368 enum smb_open_level level;
1372 uint32_t access_mask;
1373 uint64_t alloc_size;
1375 uint32_t share_access;
1376 uint32_t open_disposition;
1377 uint32_t create_options;
1378 uint32_t impersonation;
1379 uint8_t security_flags;
1380 /* NOTE: fname can also be a pointer to a
1381 uint64_t file_id if create_options has the
1382 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1385 /* these last 2 elements are only used in the
1386 NTTRANS varient of the call */
1387 struct security_descriptor *sec_desc;
1388 struct smb_ea_list *ea_list;
1390 /* some optional parameters from the SMB2 varient */
1391 bool query_maximal_access;
1394 union smb_handle file;
1395 uint8_t oplock_level;
1396 uint32_t create_action;
1402 uint64_t alloc_size;
1406 uint8_t is_directory;
1408 /* optional return values matching SMB2 tagged
1409 values in the call */
1410 uint32_t maximal_access;
1412 } ntcreatex, nttrans, generic;
1414 /* TRANS2_OPEN interface */
1416 enum smb_open_level level;
1420 uint16_t search_attrs;
1421 uint16_t file_attrs;
1428 struct ea_struct *eas;
1431 union smb_handle file;
1443 /* SMBopen interface */
1445 enum smb_open_level level;
1448 uint16_t search_attrs;
1452 union smb_handle file;
1460 /* SMBopenX interface */
1462 enum smb_open_level level;
1466 uint16_t search_attrs; /* not honoured by win2003 */
1467 uint16_t file_attrs;
1468 time_t write_time; /* not honoured by win2003 */
1470 uint32_t size; /* note that this sets the
1471 initial file size, not
1472 just allocation size */
1473 uint32_t timeout; /* not honoured by win2003 */
1477 union smb_handle file;
1485 uint32_t unique_fid;
1486 uint32_t access_mask;
1491 /* SMBmknew interface */
1493 enum smb_open_level level;
1500 union smb_handle file;
1504 /* SMBctemp interface */
1506 enum smb_open_level level;
1510 const char *directory;
1513 union smb_handle file;
1514 /* temp name, relative to directory */
1519 /* SMBsplopen interface */
1521 enum smb_open_level level;
1523 uint16_t setup_length;
1528 union smb_handle file;
1533 /* chained OpenX/ReadX interface */
1535 enum smb_open_level level;
1539 uint16_t search_attrs; /* not honoured by win2003 */
1540 uint16_t file_attrs;
1541 time_t write_time; /* not honoured by win2003 */
1543 uint32_t size; /* note that this sets the
1544 initial file size, not
1545 just allocation size */
1546 uint32_t timeout; /* not honoured by win2003 */
1556 union smb_handle file;
1564 uint32_t unique_fid;
1565 uint32_t access_mask;
1571 uint16_t compaction_mode;
1576 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1577 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1578 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1579 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1582 struct smb2_create {
1583 enum smb_open_level level;
1585 /* static body buffer 56 (0x38) bytes */
1586 uint8_t security_flags; /* SMB2_SECURITY_* */
1587 uint8_t oplock_level; /* SMB2_OPLOCK_LEVEL_* */
1588 uint32_t impersonation_level; /* SMB2_IMPERSONATION_* */
1589 uint64_t create_flags;
1591 uint32_t desired_access;
1592 uint32_t file_attributes;
1593 uint32_t share_access; /* NTCREATEX_SHARE_ACCESS_* */
1594 uint32_t create_disposition; /* NTCREATEX_DISP_* */
1595 uint32_t create_options; /* NTCREATEX_OPTIONS_* */
1597 /* uint16_t fname_ofs */
1598 /* uint16_t fname_size */
1599 /* uint32_t blob_ofs; */
1600 /* uint32_t blob_size; */
1605 /* now some optional parameters - encoded as tagged blobs */
1606 struct smb_ea_list eas;
1607 uint64_t alloc_size;
1608 struct security_descriptor *sec_desc;
1610 struct smb2_handle *durable_handle;
1611 bool query_maximal_access;
1613 bool query_on_disk_id;
1615 /* and any additional blobs the caller wants */
1616 struct smb2_create_blobs {
1618 struct smb2_create_blob {
1625 union smb_handle file;
1627 /* static body buffer 88 (0x58) bytes */
1628 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1629 uint8_t oplock_level;
1631 uint32_t create_action;
1636 uint64_t alloc_size;
1640 /* struct smb2_handle handle;*/
1641 /* uint32_t blob_ofs; */
1642 /* uint32_t blob_size; */
1644 /* optional return values matching tagged values in the call */
1645 uint32_t maximal_access;
1646 uint8_t on_disk_id[32];
1648 /* tagged blobs in the reply */
1649 struct smb2_create_blobs blobs;
1656 enum smb_read_level {
1664 #define RAW_READ_GENERIC RAW_READ_READX
1666 /* union for read() backend call
1668 note that .infoX.out.data will be allocated before the backend is
1669 called. It will be big enough to hold the maximum size asked for
1672 /* SMBreadX (and generic) interface */
1674 enum smb_read_level level;
1676 union smb_handle file;
1678 uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
1681 bool read_for_execute;
1686 uint16_t compaction_mode;
1691 /* SMBreadbraw interface */
1693 enum smb_read_level level;
1695 union smb_handle file;
1708 /* SMBlockandread interface */
1710 enum smb_read_level level;
1712 union smb_handle file;
1723 /* SMBread interface */
1725 enum smb_read_level level;
1727 union smb_handle file;
1740 enum smb_read_level level;
1742 union smb_handle file;
1744 /* static body buffer 48 (0x30) bytes */
1745 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1750 /* struct smb2_handle handle; */
1754 /* the docs give no indication of what
1755 these channel variables are for */
1756 uint16_t channel_offset;
1757 uint16_t channel_length;
1760 /* static body buffer 16 (0x10) bytes */
1761 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1762 /* uint8_t data_ofs; */
1763 /* uint8_t reserved; */
1764 /* uint32_t data_size; */
1775 enum smb_write_level {
1776 RAW_WRITE_WRITEUNLOCK,
1779 RAW_WRITE_WRITECLOSE,
1784 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1786 /* union for write() backend call
1789 /* SMBwriteX interface */
1791 enum smb_write_level level;
1793 union smb_handle file;
1798 const uint8_t *data;
1806 /* SMBwriteunlock interface */
1808 enum smb_write_level level;
1810 union smb_handle file;
1814 const uint8_t *data;
1821 /* SMBwrite interface */
1823 enum smb_write_level level;
1825 union smb_handle file;
1829 const uint8_t *data;
1836 /* SMBwriteclose interface */
1838 enum smb_write_level level;
1840 union smb_handle file;
1844 const uint8_t *data;
1851 /* SMBsplwrite interface */
1853 enum smb_write_level level;
1855 union smb_handle file;
1857 const uint8_t *data;
1863 enum smb_write_level level;
1865 union smb_handle file;
1867 /* static body buffer 48 (0x30) bytes */
1868 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1869 /* uint16_t data_ofs; */
1870 /* uint32_t data_size; */
1872 /* struct smb2_handle handle; */
1873 uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
1874 uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
1880 /* static body buffer 17 (0x11) bytes */
1881 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
1884 uint64_t unknown1; /* 0x0000000000000000 */
1890 enum smb_lock_level {
1898 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1900 /* union for lock() backend call
1903 /* SMBlockingX and generic interface */
1905 enum smb_lock_level level;
1907 union smb_handle file;
1912 struct smb_lock_entry {
1913 uint32_t pid; /* 16 bits in SMB1 */
1916 } *locks; /* unlocks are first in the arrray */
1920 /* SMBlock and SMBunlock interface */
1922 enum smb_lock_level level;
1924 union smb_handle file;
1932 enum smb_lock_level level;
1934 union smb_handle file;
1936 /* static body buffer 48 (0x30) bytes */
1937 /* uint16_t buffer_code; 0x30 */
1938 uint16_t lock_count;
1940 /* struct smb2_handle handle; */
1941 struct smb2_lock_element {
1944 /* these flags are the same as the SMB2 lock flags */
1945 #define SMB2_LOCK_FLAG_NONE 0x00000000
1946 #define SMB2_LOCK_FLAG_SHARED 0x00000001
1947 #define SMB2_LOCK_FLAG_EXCLUSIVE 0x00000002
1948 #define SMB2_LOCK_FLAG_UNLOCK 0x00000004
1949 #define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY 0x00000010
1950 #define SMB2_LOCK_FLAG_ALL_MASK 0x00000017
1956 /* static body buffer 4 (0x04) bytes */
1957 /* uint16_t buffer_code; 0x04 */
1964 enum smb_lock_level level;
1966 union smb_handle file;
1968 /* static body buffer 24 (0x18) bytes */
1969 uint8_t oplock_level;
1972 /* struct smb2_handle handle; */
1978 enum smb_close_level {
1986 union for close() backend call
1989 /* generic interface */
1991 enum smb_close_level level;
1993 union smb_handle file;
1995 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
1996 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
2004 uint64_t alloc_size;
2010 /* SMBclose interface */
2012 enum smb_close_level level;
2014 union smb_handle file;
2019 /* SMBsplclose interface - empty! */
2021 enum smb_close_level level;
2023 union smb_handle file;
2029 enum smb_close_level level;
2031 union smb_handle file;
2033 /* static body buffer 24 (0x18) bytes */
2034 /* uint16_t buffer_code; 0x18 */
2035 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
2039 /* static body buffer 60 (0x3C) bytes */
2040 /* uint16_t buffer_code; 0x3C */
2047 uint64_t alloc_size;
2055 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
2058 union for lpq() backend
2061 /* generic interface */
2063 enum smb_lpq_level level;
2068 /* SMBsplretq interface */
2070 enum smb_lpq_level level;
2078 uint16_t restart_idx;
2090 enum smb_ioctl_level {
2094 RAW_IOCTL_SMB2_NO_HANDLE
2098 union for ioctl() backend
2101 /* generic interface */
2103 enum smb_ioctl_level level;
2105 union smb_handle file;
2109 /* struct for SMBioctl */
2111 enum smb_ioctl_level level;
2113 union smb_handle file;
2122 /* struct for NT ioctl call */
2124 enum smb_ioctl_level level;
2126 union smb_handle file;
2140 enum smb_ioctl_level level;
2142 union smb_handle file;
2144 /* static body buffer 56 (0x38) bytes */
2145 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2148 /*struct smb2_handle handle;*/
2149 /* uint32_t out_ofs; */
2150 /* uint32_t out_size; */
2152 /* uint32_t in_ofs; */
2153 /* uint32_t in_size; */
2154 uint32_t max_response_size;
2162 union smb_handle file;
2164 /* static body buffer 48 (0x30) bytes */
2165 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2168 /* struct smb2_handle handle; */
2169 /* uint32_t in_ofs; */
2170 /* uint32_t in_size; */
2171 /* uint32_t out_ofs; */
2172 /* uint32_t out_size; */
2183 enum smb_flush_level {
2190 /* struct for SMBflush */
2192 enum smb_flush_level level;
2194 union smb_handle file;
2198 /* SMBflush with 0xFFFF wildcard fnum */
2200 enum smb_flush_level level;
2205 enum smb_flush_level level;
2207 union smb_handle file;
2217 /* struct for SMBcopy */
2232 /* struct for transact/transact2 call */
2240 uint8_t setup_count;
2242 const char *trans_name; /* SMBtrans only */
2248 uint8_t setup_count;
2255 /* struct for nttransact2 call */
2256 struct smb_nttrans {
2261 uint8_t setup_count;
2269 uint8_t setup_count; /* in units of 16 bit words */
2276 enum smb_notify_level {
2282 /* struct for nttrans change notify call */
2284 enum smb_notify_level level;
2287 union smb_handle file;
2288 uint32_t buffer_size;
2289 uint32_t completion_filter;
2294 uint32_t num_changes;
2295 struct notify_changes {
2297 struct smb_wire_string name;
2302 struct smb2_notify {
2303 enum smb_notify_level level;
2306 union smb_handle file;
2307 /* static body buffer 32 (0x20) bytes */
2308 /* uint16_t buffer_code; 0x32 */
2310 uint32_t buffer_size;
2311 /*struct smb2_handle file;*/
2312 uint32_t completion_filter;
2317 /* static body buffer 8 (0x08) bytes */
2318 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2319 /* uint16_t blob_ofs; */
2320 /* uint16_t blob_size; */
2325 /* DATA_BLOB content */
2326 uint32_t num_changes;
2327 struct notify_changes *changes;
2332 enum smb_search_level {
2333 RAW_SEARCH_SEARCH, /* SMBsearch */
2334 RAW_SEARCH_FFIRST, /* SMBffirst */
2335 RAW_SEARCH_FUNIQUE, /* SMBfunique */
2336 RAW_SEARCH_TRANS2, /* SMBtrans2 */
2337 RAW_SEARCH_SMB2 /* SMB2 Find */
2340 enum smb_search_data_level {
2341 RAW_SEARCH_DATA_GENERIC = 0x10000, /* only used in the smbcli_ code */
2342 RAW_SEARCH_DATA_SEARCH,
2343 RAW_SEARCH_DATA_STANDARD = SMB_FIND_STANDARD,
2344 RAW_SEARCH_DATA_EA_SIZE = SMB_FIND_EA_SIZE,
2345 RAW_SEARCH_DATA_EA_LIST = SMB_FIND_EA_LIST,
2346 RAW_SEARCH_DATA_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
2347 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
2348 RAW_SEARCH_DATA_NAME_INFO = SMB_FIND_NAME_INFO,
2349 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
2350 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
2351 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
2352 RAW_SEARCH_DATA_UNIX_INFO = SMB_FIND_UNIX_INFO,
2353 RAW_SEARCH_DATA_UNIX_INFO2 = SMB_FIND_UNIX_INFO2
2356 /* union for file search */
2357 union smb_search_first {
2359 enum smb_search_level level;
2360 enum smb_search_data_level data_level;
2363 /* search (old) findfirst interface.
2364 Also used for ffirst and funique. */
2366 enum smb_search_level level;
2367 enum smb_search_data_level data_level;
2371 uint16_t search_attrib;
2372 const char *pattern;
2379 /* trans2 findfirst interface */
2381 enum smb_search_level level;
2382 enum smb_search_data_level data_level;
2385 uint16_t search_attrib;
2388 uint32_t storage_type;
2389 const char *pattern;
2391 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2393 struct ea_name *ea_names;
2398 uint16_t end_of_search;
2403 SMB2 uses different level numbers for the same old SMB trans2 search levels
2405 #define SMB2_FIND_DIRECTORY_INFO 0x01
2406 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
2407 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
2408 #define SMB2_FIND_NAME_INFO 0x0C
2409 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
2410 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
2412 /* flags for SMB2 find */
2413 #define SMB2_CONTINUE_FLAG_RESTART 0x01
2414 #define SMB2_CONTINUE_FLAG_SINGLE 0x02
2415 #define SMB2_CONTINUE_FLAG_INDEX 0x04
2416 #define SMB2_CONTINUE_FLAG_REOPEN 0x10
2420 enum smb_search_level level;
2421 enum smb_search_data_level data_level;
2423 union smb_handle file;
2425 /* static body buffer 32 (0x20) bytes */
2426 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2428 uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
2429 uint32_t file_index;
2430 /* struct smb2_handle handle; */
2431 /* uint16_t pattern_ofs; */
2432 /* uint16_t pattern_size; */
2433 uint32_t max_response_size;
2436 const char *pattern;
2439 /* static body buffer 8 (0x08) bytes */
2440 /* uint16_t buffer_code; 0x08 */
2441 /* uint16_t blob_ofs; */
2442 /* uint32_t blob_size; */
2450 /* union for file search continue */
2451 union smb_search_next {
2453 enum smb_search_level level;
2454 enum smb_search_data_level data_level;
2457 /* search (old) findnext interface. Also used
2458 for ffirst when continuing */
2460 enum smb_search_level level;
2461 enum smb_search_data_level data_level;
2465 uint16_t search_attrib;
2466 struct smb_search_id {
2470 uint32_t server_cookie;
2471 uint32_t client_cookie;
2479 /* trans2 findnext interface */
2481 enum smb_search_level level;
2482 enum smb_search_data_level data_level;
2487 uint32_t resume_key;
2489 const char *last_name;
2491 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2493 struct ea_name *ea_names;
2497 uint16_t end_of_search;
2502 struct smb2_find smb2;
2505 /* union for search reply file data */
2506 union smb_search_data {
2508 * search (old) findfirst
2509 * RAW_SEARCH_DATA_SEARCH
2515 struct smb_search_id id;
2519 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2521 uint32_t resume_key;
2526 uint32_t alloc_size;
2528 struct smb_wire_string name;
2531 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2533 uint32_t resume_key;
2538 uint32_t alloc_size;
2541 struct smb_wire_string name;
2544 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2546 uint32_t resume_key;
2551 uint32_t alloc_size;
2553 struct smb_ea_list eas;
2554 struct smb_wire_string name;
2557 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2559 uint32_t file_index;
2565 uint64_t alloc_size;
2567 struct smb_wire_string name;
2570 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2572 uint32_t file_index;
2578 uint64_t alloc_size;
2581 struct smb_wire_string name;
2582 } full_directory_info;
2584 /* RAW_SEARCH_DATA_NAME_INFO interface */
2586 uint32_t file_index;
2587 struct smb_wire_string name;
2590 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2592 uint32_t file_index;
2598 uint64_t alloc_size;
2601 struct smb_wire_string short_name;
2602 struct smb_wire_string name;
2603 } both_directory_info;
2605 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2607 uint32_t file_index;
2613 uint64_t alloc_size;
2617 struct smb_wire_string name;
2618 } id_full_directory_info;
2620 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2622 uint32_t file_index;
2628 uint64_t alloc_size;
2632 struct smb_wire_string short_name;
2633 struct smb_wire_string name;
2634 } id_both_directory_info;
2636 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2638 uint32_t file_index;
2640 uint64_t alloc_size;
2641 NTTIME status_change_time;
2650 uint64_t permissions;
2655 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2657 uint32_t file_index;
2658 uint64_t end_of_file;
2660 NTTIME status_change_time;
2669 uint64_t permissions;
2672 uint32_t file_flags;
2673 uint32_t flags_mask;
2674 struct smb_wire_string name;
2678 /* Callback function passed to the raw search interface. */
2679 typedef bool (*smbcli_search_callback)(void *private, const union smb_search_data *file);
2681 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2683 /* union for file search close */
2684 union smb_search_close {
2686 enum smb_search_close_level level;
2689 /* SMBfclose (old search) interface */
2691 enum smb_search_close_level level;
2694 /* max_count and search_attrib are not used, but are present */
2696 uint16_t search_attrib;
2697 struct smb_search_id id;
2701 /* SMBfindclose interface */
2703 enum smb_search_close_level level;
2713 struct for SMBecho call
2717 uint16_t repeat_count;
2723 uint16_t sequence_number;
2730 struct for shadow copy volumes
2732 struct smb_shadow_copy {
2734 union smb_handle file;
2738 uint32_t num_volumes;
2744 #endif /* __LIBCLI_RAW_INTERFACES_H__ */