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>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* this structure is just a wrapper for a string, the only reason we
25 bother with this is that it allows us to check the length provided
26 on the wire in testsuite test code to ensure that we are
27 terminating names in the same way that win2003 is. The *ONLY* time
28 you should ever look at the 'private_length' field in this
29 structure is inside compliance test code, in all other cases just
30 use the null terminated char* as the definitive definition of the
33 also note that this structure is only used in packets where there
34 is an explicit length provided on the wire (hence the name). That
35 length is placed in 'private_length'. For packets where the length
36 is always determined by NULL or packet termination a normal char*
37 is used in the structure definition.
40 uint32_t private_length;
46 use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
47 just a dom sid, but with the sub_auths represented as a conformant
48 array. As with all in-structure conformant arrays, the array length
49 is placed before the start of the structure. That's what gives rise
50 to the extra num_auths elemenent. We don't want the Samba code to
51 have to bother with such esoteric NDR details, so its easier to just
52 define it as a dom_sid and use pidl magic to make it all work. It
53 just means you need to mark a sid as a "dom_sid2" in the IDL when you
54 know it is of the conformant array variety
56 #define dom_sid2 dom_sid
58 /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
59 #define dom_sid28 dom_sid
63 this header defines the structures and unions used between the SMB
64 parser and the backends.
67 /* struct used for SMBlseek call */
72 int32_t offset; /* signed */
80 /* struct used in unlink() call */
89 /* struct used in chkpath() call */
96 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
98 /* union used in mkdir() call */
102 enum smb_mkdir_level level;
106 enum smb_mkdir_level level;
113 enum smb_mkdir_level level;
117 struct ea_struct *eas;
122 /* struct used in rmdir() call */
129 /* struct used in rename() call */
130 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
134 enum smb_rename_level level;
137 /* SMBrename interface */
139 enum smb_rename_level level;
142 const char *pattern1;
143 const char *pattern2;
149 /* SMBntrename interface */
151 enum smb_rename_level level;
155 uint16_t flags; /* see RENAME_FLAG_* */
156 uint32_t cluster_size;
157 const char *old_name;
158 const char *new_name;
163 enum smb_tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX};
165 /* union used in tree connect call */
167 /* generic interface */
169 enum smb_tcon_level level;
172 /* SMBtcon interface */
174 enum smb_tcon_level level;
178 const char *password;
187 /* SMBtconX interface */
189 enum smb_tcon_level level;
207 enum smb_sesssetup_level {RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO};
209 /* union used in session_setup call */
210 union smb_sesssetup {
211 /* the pre-NT1 interface */
213 enum smb_sesssetup_level level;
235 /* the NT1 interface */
237 enum smb_sesssetup_level level;
244 uint32_t capabilities;
262 /* the SPNEGO interface */
264 enum smb_sesssetup_level level;
271 uint32_t capabilities;
275 const char *workgroup;
288 /* Note that the specified enum values are identical to the actual info-levels used
291 enum smb_fileinfo_level {
292 RAW_FILEINFO_GENERIC = 0xF000,
293 RAW_FILEINFO_GETATTR, /* SMBgetatr */
294 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
295 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
296 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
297 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
298 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
299 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
300 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
301 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
302 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
303 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
304 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
305 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
306 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
307 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
308 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
309 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
310 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
311 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
312 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
313 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
314 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
315 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
316 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
317 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
318 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
319 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
320 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
321 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
322 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
323 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
324 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
325 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
326 /* SMB2 specific levels */
327 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
328 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
332 file handles in SMB2 are 16 bytes
339 /* union used in qfileinfo() and qpathinfo() backend calls */
341 /* generic interface:
342 * matches RAW_FILEINFO_GENERIC */
344 enum smb_fileinfo_level level;
346 /* each level can be called on either a pathname or a
347 filename, in either case the return format is
349 On SMB2 a 16 byte handle is used
351 union smb_fileinfo_in {
354 struct smb2_handle handle;
374 WIRE_STRING alt_fname;
375 uint8_t delete_pending;
377 uint64_t compressed_size;
381 uint8_t cluster_shift;
383 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
386 uint32_t alignment_requirement;
387 uint32_t reparse_tag;
389 struct stream_struct {
392 WIRE_STRING stream_name;
398 /* SMBgetatr interface:
399 * matches RAW_FILEINFO_GETATTR */
401 enum smb_fileinfo_level level;
402 union smb_fileinfo_in in;
411 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
413 enum smb_fileinfo_level level;
414 union smb_fileinfo_in in;
424 } getattre, standard;
426 /* trans2 RAW_FILEINFO_EA_SIZE interface */
428 enum smb_fileinfo_level level;
429 union smb_fileinfo_in in;
442 /* trans2 RAW_FILEINFO_EA_LIST interface */
444 enum smb_fileinfo_level level;
445 union smb_fileinfo_in file;
456 struct ea_struct *eas;
460 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
462 enum smb_fileinfo_level level;
463 union smb_fileinfo_in in;
464 uint8_t continue_flags; /* SMB2 only - SMB2_CONTINUE_FLAG_* */
466 struct smb_ea_list out;
469 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
470 only valid for a QPATHNAME call - no returned data */
472 enum smb_fileinfo_level level;
473 union smb_fileinfo_in in;
476 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
478 enum smb_fileinfo_level level;
479 union smb_fileinfo_in in;
491 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
493 enum smb_fileinfo_level level;
494 union smb_fileinfo_in in;
505 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
507 enum smb_fileinfo_level level;
508 union smb_fileinfo_in in;
515 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
517 enum smb_fileinfo_level level;
518 union smb_fileinfo_in in;
525 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
527 enum smb_fileinfo_level level;
528 union smb_fileinfo_in in;
539 uint8_t delete_pending;
546 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
548 enum smb_fileinfo_level level;
549 union smb_fileinfo_in in;
561 uint8_t delete_pending;
566 uint32_t access_mask;
573 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
575 enum smb_fileinfo_level level;
576 union smb_fileinfo_in in;
583 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
585 enum smb_fileinfo_level level;
586 union smb_fileinfo_in in;
588 struct stream_information {
590 struct stream_struct *streams;
594 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
596 enum smb_fileinfo_level level;
597 union smb_fileinfo_in in;
600 uint64_t compressed_size;
604 uint8_t cluster_shift;
608 /* RAW_FILEINFO_UNIX_BASIC interface */
610 enum smb_fileinfo_level level;
611 union smb_fileinfo_in in;
614 uint64_t end_of_file;
616 NTTIME status_change_time;
625 uint64_t permissions;
630 /* RAW_FILEINFO_UNIX_LINK interface */
632 enum smb_fileinfo_level level;
633 union smb_fileinfo_in in;
636 WIRE_STRING link_dest;
640 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
642 enum smb_fileinfo_level level;
643 union smb_fileinfo_in in;
648 } internal_information;
650 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
652 enum smb_fileinfo_level level;
653 union smb_fileinfo_in in;
656 uint32_t access_flags;
658 } access_information;
660 /* RAW_FILEINFO_POSITION_INFORMATION interface */
662 enum smb_fileinfo_level level;
663 union smb_fileinfo_in in;
668 } position_information;
670 /* RAW_FILEINFO_MODE_INFORMATION interface */
672 enum smb_fileinfo_level level;
673 union smb_fileinfo_in in;
680 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
682 enum smb_fileinfo_level level;
683 union smb_fileinfo_in in;
686 uint32_t alignment_requirement;
688 } alignment_information;
690 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
692 enum smb_fileinfo_level level;
693 union smb_fileinfo_in in;
704 } network_open_information;
707 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
709 enum smb_fileinfo_level level;
710 union smb_fileinfo_in in;
714 uint32_t reparse_tag;
716 } attribute_tag_information;
718 /* RAW_FILEINFO_SEC_DESC */
720 enum smb_fileinfo_level level;
721 union smb_fileinfo_in in;
722 uint32_t secinfo_flags;
724 struct security_descriptor *sd;
730 enum smb_setfileinfo_level {
731 RAW_SFILEINFO_GENERIC = 0xF000,
732 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
733 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
734 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
735 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
736 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
737 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
738 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
739 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
740 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
741 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
742 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
743 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
744 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
745 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
746 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
747 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
748 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
749 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
750 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
751 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
752 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
753 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
754 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
755 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
756 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
759 /* union used in setfileinfo() and setpathinfo() calls */
760 union smb_setfileinfo {
761 /* generic interface */
763 enum smb_setfileinfo_level level;
765 /* we are combining setfileinfo and setpathinfo into one
767 union setfileinfo_file {
770 struct smb2_handle handle; /* only for SMB2 */
774 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
776 enum smb_setfileinfo_level level;
777 union setfileinfo_file file;
784 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
785 also RAW_SFILEINFO_STANDARD */
787 enum smb_setfileinfo_level level;
788 union setfileinfo_file file;
794 /* notice that size, alloc_size and attrib are not settable,
795 unlike the corresponding qfileinfo level */
797 } setattre, standard;
799 /* RAW_SFILEINFO_EA_SET interface */
801 enum smb_setfileinfo_level level;
802 union setfileinfo_file file;
805 struct ea_struct *eas;
809 /* RAW_SFILEINFO_BASIC_INFO and
810 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
812 enum smb_setfileinfo_level level;
813 union setfileinfo_file file;
824 /* RAW_SFILEINFO_DISPOSITION_INFO and
825 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
827 enum smb_setfileinfo_level level;
828 union setfileinfo_file file;
831 BOOL delete_on_close;
835 /* RAW_SFILEINFO_ALLOCATION_INFO and
836 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
838 enum smb_setfileinfo_level level;
839 union setfileinfo_file file;
842 /* w2k3 rounds this up to nearest 4096 */
847 /* RAW_SFILEINFO_END_OF_FILE_INFO and
848 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
850 enum smb_setfileinfo_level level;
851 union setfileinfo_file file;
858 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
860 enum smb_setfileinfo_level level;
861 union setfileinfo_file file;
863 struct smb_rename_information {
866 const char *new_name;
868 } rename_information;
870 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
872 enum smb_setfileinfo_level level;
873 union setfileinfo_file file;
878 } position_information;
880 /* RAW_SFILEINFO_MODE_INFORMATION interface */
882 enum smb_setfileinfo_level level;
883 union setfileinfo_file file;
886 /* valid values seem to be 0, 2, 4 and 6 */
893 /* RAW_SFILEINFO_UNIX_BASIC interface */
895 enum smb_setfileinfo_level level;
896 union setfileinfo_file file;
898 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
899 uint64_t end_of_file;
901 NTTIME status_change_time;
910 uint64_t permissions;
915 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
917 enum smb_setfileinfo_level level;
918 union setfileinfo_file file;
920 const char *link_dest;
922 } unix_link, unix_hlink;
924 /* RAW_FILEINFO_SET_SEC_DESC */
926 enum smb_setfileinfo_level level;
927 union setfileinfo_file file;
929 uint32_t secinfo_flags;
930 struct security_descriptor *sd;
936 enum smb_fsinfo_level {
937 RAW_QFS_GENERIC = 0xF000,
938 RAW_QFS_DSKATTR, /* SMBdskattr */
939 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
940 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
941 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
942 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
943 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
944 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
945 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
946 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
947 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
948 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
949 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
950 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
951 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
952 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
955 /* union for fsinfo() backend call. Note that there are no in
956 structures, as this call only contains out parameters */
958 /* generic interface */
960 enum smb_fsinfo_level level;
961 struct smb2_handle handle; /* only for smb2 */
965 uint64_t blocks_total;
966 uint64_t blocks_free;
969 uint32_t serial_number;
971 uint32_t max_file_component_length;
972 uint32_t device_type;
973 uint32_t device_characteristics;
976 uint64_t quota_flags;
983 /* SMBdskattr interface */
985 enum smb_fsinfo_level level;
988 uint16_t units_total;
989 uint16_t blocks_per_unit;
995 /* trans2 RAW_QFS_ALLOCATION interface */
997 enum smb_fsinfo_level level;
1001 uint32_t sectors_per_unit;
1002 uint32_t total_alloc_units;
1003 uint32_t avail_alloc_units;
1004 uint16_t bytes_per_sector;
1008 /* TRANS2 RAW_QFS_VOLUME interface */
1010 enum smb_fsinfo_level level;
1013 uint32_t serial_number;
1014 WIRE_STRING volume_name;
1018 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1020 enum smb_fsinfo_level level;
1021 struct smb2_handle handle; /* only for smb2 */
1025 uint32_t serial_number;
1026 WIRE_STRING volume_name;
1030 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1032 enum smb_fsinfo_level level;
1033 struct smb2_handle handle; /* only for smb2 */
1036 uint64_t total_alloc_units;
1037 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1038 uint32_t sectors_per_unit;
1039 uint32_t bytes_per_sector;
1043 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1045 enum smb_fsinfo_level level;
1046 struct smb2_handle handle; /* only for smb2 */
1049 uint32_t device_type;
1050 uint32_t characteristics;
1055 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1057 enum smb_fsinfo_level level;
1058 struct smb2_handle handle; /* only for smb2 */
1062 uint32_t max_file_component_length;
1063 WIRE_STRING fs_type;
1068 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1070 enum smb_fsinfo_level level;
1073 uint16_t major_version;
1074 uint16_t minor_version;
1075 uint64_t capability;
1079 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1081 enum smb_fsinfo_level level;
1082 struct smb2_handle handle; /* only for smb2 */
1085 uint64_t unknown[3];
1086 uint64_t quota_soft;
1087 uint64_t quota_hard;
1088 uint64_t quota_flags;
1090 } quota_information;
1092 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1094 enum smb_fsinfo_level level;
1095 struct smb2_handle handle; /* only for smb2 */
1098 uint64_t total_alloc_units;
1099 uint64_t call_avail_alloc_units;
1100 uint64_t actual_avail_alloc_units;
1101 uint32_t sectors_per_unit;
1102 uint32_t bytes_per_sector;
1104 } full_size_information;
1106 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1108 enum smb_fsinfo_level level;
1109 struct smb2_handle handle; /* only for smb2 */
1113 uint64_t unknown[6];
1115 } objectid_information;
1120 enum smb_open_level {
1121 RAW_OPEN_OPEN, RAW_OPEN_OPENX,
1122 RAW_OPEN_MKNEW, RAW_OPEN_CREATE,
1123 RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN,
1124 RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN,
1125 RAW_OPEN_NTTRANS_CREATE,
1126 RAW_OPEN_OPENX_READX};
1128 /* the generic interface is defined to be equal to the NTCREATEX interface */
1129 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1131 /* union for open() backend call */
1133 /* SMBNTCreateX interface */
1135 enum smb_open_level level;
1140 uint32_t access_mask;
1141 uint64_t alloc_size;
1143 uint32_t share_access;
1144 uint32_t open_disposition;
1145 uint32_t create_options;
1146 uint32_t impersonation;
1147 uint8_t security_flags;
1148 /* NOTE: fname can also be a pointer to a
1149 uint64_t file_id if create_options has the
1150 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1153 /* these last 2 elements are only used in the
1154 NTTRANS varient of the call */
1155 struct security_descriptor *sec_desc;
1156 struct smb_ea_list *ea_list;
1160 uint8_t oplock_level;
1162 uint32_t create_action;
1168 uint64_t alloc_size;
1172 uint8_t is_directory;
1174 } ntcreatex, generic;
1176 /* TRANS2_OPEN interface */
1178 enum smb_open_level level;
1183 uint16_t search_attrs;
1184 uint16_t file_attrs;
1191 struct ea_struct *eas;
1207 /* SMBopen interface */
1209 enum smb_open_level level;
1213 uint16_t search_attrs;
1225 /* SMBopenX interface */
1227 enum smb_open_level level;
1232 uint16_t search_attrs; /* not honoured by win2003 */
1233 uint16_t file_attrs;
1234 time_t write_time; /* not honoured by win2003 */
1236 uint32_t size; /* note that this sets the
1237 initial file size, not
1238 just allocation size */
1239 uint32_t timeout; /* not honoured by win2003 */
1251 uint32_t unique_fid;
1252 uint32_t access_mask;
1257 /* SMBmknew interface */
1259 enum smb_open_level level;
1271 /* SMBctemp interface */
1273 enum smb_open_level level;
1278 const char *directory;
1282 /* temp name, relative to directory */
1287 /* SMBsplopen interface */
1289 enum smb_open_level level;
1292 uint16_t setup_length;
1302 /* chained OpenX/ReadX interface */
1304 enum smb_open_level level;
1309 uint16_t search_attrs; /* not honoured by win2003 */
1310 uint16_t file_attrs;
1311 time_t write_time; /* not honoured by win2003 */
1313 uint32_t size; /* note that this sets the
1314 initial file size, not
1315 just allocation size */
1316 uint32_t timeout; /* not honoured by win2003 */
1334 uint32_t unique_fid;
1335 uint32_t access_mask;
1341 uint16_t compaction_mode;
1349 enum smb_read_level {RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
1351 #define RAW_READ_GENERIC RAW_READ_READX
1353 /* union for read() backend call
1355 note that .infoX.out.data will be allocated before the backend is
1356 called. It will be big enough to hold the maximum size asked for
1359 /* SMBreadX (and generic) interface */
1361 enum smb_read_level level;
1373 uint16_t compaction_mode;
1378 /* SMBreadbraw interface */
1380 enum smb_read_level level;
1396 /* SMBlockandread interface */
1398 enum smb_read_level level;
1412 /* SMBread interface */
1414 enum smb_read_level level;
1430 enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
1431 RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE,
1432 RAW_WRITE_SPLWRITE};
1434 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1436 /* union for write() backend call
1439 /* SMBwriteX interface */
1441 enum smb_write_level level;
1449 const uint8_t *data;
1457 /* SMBwriteunlock interface */
1459 enum smb_write_level level;
1466 const uint8_t *data;
1473 /* SMBwrite interface */
1475 enum smb_write_level level;
1482 const uint8_t *data;
1489 /* SMBwriteclose interface */
1491 enum smb_write_level level;
1498 const uint8_t *data;
1505 /* SMBsplwrite interface */
1507 enum smb_write_level level;
1512 const uint8_t *data;
1518 enum smb_lock_level {RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
1520 /* the generic interface is defined to be equal to the lockingX interface */
1521 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1523 /* union for lock() backend call
1526 /* SMBlockingX (and generic) interface */
1528 enum smb_lock_level level;
1536 struct smb_lock_entry {
1540 } *locks; /* unlocks are first in the arrray */
1544 /* SMBlock and SMBunlock interface */
1546 enum smb_lock_level level;
1557 enum smb_close_level {RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
1559 #define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
1562 union for close() backend call
1565 /* SMBclose (and generic) interface */
1567 enum smb_close_level level;
1575 /* SMBsplclose interface - empty! */
1577 enum smb_close_level level;
1586 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1589 union for lpq() backend
1592 /* generic interface */
1594 enum smb_lpq_level level;
1599 /* SMBsplretq interface */
1601 enum smb_lpq_level level;
1609 uint16_t restart_idx;
1621 enum smb_ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
1624 union for ioctl() backend
1627 /* generic interface */
1629 enum smb_ioctl_level level;
1633 /* struct for SMBioctl */
1635 enum smb_ioctl_level level;
1646 /* struct for NT ioctl call */
1648 enum smb_ioctl_level level;
1661 /* struct for SMBflush */
1669 /* struct for SMBcopy */
1684 /* struct for transact/transact2 call */
1692 uint8_t setup_count;
1694 const char *trans_name; /* SMBtrans only */
1700 uint8_t setup_count;
1707 /* struct for nttransact2 call */
1708 struct smb_nttrans {
1713 uint32_t setup_count;
1721 uint8_t setup_count;
1729 /* struct for nttrans change notify call */
1732 uint32_t buffer_size;
1733 uint32_t completion_filter;
1739 uint32_t num_changes;
1740 struct notify_changes {
1748 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
1749 RAW_SEARCH_SEARCH, /* SMBsearch */
1750 RAW_SEARCH_FFIRST, /* SMBffirst */
1751 RAW_SEARCH_FUNIQUE, /* SMBfunique */
1752 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
1753 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
1754 RAW_SEARCH_EA_LIST = SMB_FIND_EA_LIST,
1755 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
1756 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
1757 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
1758 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
1759 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
1760 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
1761 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
1764 /* union for file search */
1765 union smb_search_first {
1767 enum smb_search_level level;
1770 /* search (old) findfirst interface.
1771 Also used for ffirst and funique. */
1773 enum smb_search_level level;
1777 uint16_t search_attrib;
1778 const char *pattern;
1785 /* trans2 findfirst interface */
1787 enum smb_search_level level;
1790 uint16_t search_attrib;
1793 uint32_t storage_type;
1794 const char *pattern;
1796 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1798 struct ea_name *ea_names;
1803 uint16_t end_of_search;
1808 /* union for file search continue */
1809 union smb_search_next {
1811 enum smb_search_level level;
1814 /* search (old) findnext interface. Also used
1815 for ffirst when continuing */
1817 enum smb_search_level level;
1821 uint16_t search_attrib;
1822 struct smb_search_id {
1826 uint32_t server_cookie;
1827 uint32_t client_cookie;
1835 /* trans2 findnext interface */
1837 enum smb_search_level level;
1842 uint32_t resume_key;
1844 const char *last_name;
1846 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1848 struct ea_name *ea_names;
1852 uint16_t end_of_search;
1857 /* union for search reply file data */
1858 union smb_search_data {
1859 /* search (old) findfirst */
1864 struct smb_search_id id;
1868 /* trans2 findfirst RAW_SEARCH_STANDARD level */
1870 uint32_t resume_key;
1875 uint32_t alloc_size;
1880 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
1882 uint32_t resume_key;
1887 uint32_t alloc_size;
1893 /* trans2 findfirst RAW_SEARCH_EA_LIST level */
1895 uint32_t resume_key;
1900 uint32_t alloc_size;
1902 struct smb_ea_list eas;
1906 /* RAW_SEARCH_DIRECTORY_INFO interface */
1908 uint32_t file_index;
1914 uint64_t alloc_size;
1919 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
1921 uint32_t file_index;
1927 uint64_t alloc_size;
1931 } full_directory_info;
1933 /* RAW_SEARCH_NAME_INFO interface */
1935 uint32_t file_index;
1939 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
1941 uint32_t file_index;
1947 uint64_t alloc_size;
1950 WIRE_STRING short_name;
1952 } both_directory_info;
1954 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
1956 uint32_t file_index;
1962 uint64_t alloc_size;
1967 } id_full_directory_info;
1969 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
1971 uint32_t file_index;
1977 uint64_t alloc_size;
1981 WIRE_STRING short_name;
1983 } id_both_directory_info;
1985 /* RAW_SEARCH_UNIX_INFO interface */
1987 uint32_t file_index;
1989 uint64_t alloc_size;
1990 NTTIME status_change_time;
1999 uint64_t permissions;
2006 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2008 /* union for file search close */
2009 union smb_search_close {
2011 enum smb_search_close_level level;
2014 /* SMBfclose (old search) interface */
2016 enum smb_search_close_level level;
2019 /* max_count and search_attrib are not used, but are present */
2021 uint16_t search_attrib;
2022 struct smb_search_id id;
2026 /* SMBfindclose interface */
2028 enum smb_search_close_level level;