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.
22 /* this structure is just a wrapper for a string, the only reason we
23 bother with this is that it allows us to check the length provided
24 on the wire in testsuite test code to ensure that we are
25 terminating names in the same way that win2003 is. The *ONLY* time
26 you should ever look at the 'private_length' field in this
27 structure is inside compliance test code, in all other cases just
28 use the null terminated char* as the definitive definition of the
31 also note that this structure is only used in packets where there
32 is an explicit length provided on the wire (hence the name). That
33 length is placed in 'private_length'. For packets where the length
34 is always determined by NULL or packet termination a normal char*
35 is used in the structure definition.
38 uint32_t private_length;
44 use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
45 just a dom sid, but with the sub_auths represented as a conformant
46 array. As with all in-structure conformant arrays, the array length
47 is placed before the start of the structure. That's what gives rise
48 to the extra num_auths elemenent. We don't want the Samba code to
49 have to bother with such esoteric NDR details, so its easier to just
50 define it as a dom_sid and use pidl magic to make it all work. It
51 just means you need to mark a sid as a "dom_sid2" in the IDL when you
52 know it is of the conformant array variety
54 #define dom_sid2 dom_sid
56 /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
57 #define dom_sid28 dom_sid
61 this header defines the structures and unions used between the SMB
62 parser and the backends.
65 /* struct used for SMBlseek call */
70 int32_t offset; /* signed */
78 /* struct used in unlink() call */
87 /* struct used in chkpath() call */
94 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
96 /* union used in mkdir() call */
100 enum smb_mkdir_level level;
104 enum smb_mkdir_level level;
111 enum smb_mkdir_level level;
115 struct ea_struct *eas;
120 /* struct used in rmdir() call */
127 /* struct used in rename() call */
128 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
132 enum smb_rename_level level;
135 /* SMBrename interface */
137 enum smb_rename_level level;
140 const char *pattern1;
141 const char *pattern2;
147 /* SMBntrename interface */
149 enum smb_rename_level level;
153 uint16_t flags; /* see RENAME_FLAG_* */
154 uint32_t cluster_size;
155 const char *old_name;
156 const char *new_name;
161 enum smb_tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX};
163 /* union used in tree connect call */
165 /* generic interface */
167 enum smb_tcon_level level;
170 /* SMBtcon interface */
172 enum smb_tcon_level level;
176 const char *password;
185 /* SMBtconX interface */
187 enum smb_tcon_level level;
205 enum smb_sesssetup_level {RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO};
207 /* union used in session_setup call */
208 union smb_sesssetup {
209 /* the pre-NT1 interface */
211 enum smb_sesssetup_level level;
233 /* the NT1 interface */
235 enum smb_sesssetup_level level;
242 uint32_t capabilities;
260 /* the SPNEGO interface */
262 enum smb_sesssetup_level level;
269 uint32_t capabilities;
273 const char *workgroup;
286 /* Note that the specified enum values are identical to the actual info-levels used
289 enum smb_fileinfo_level {
290 RAW_FILEINFO_GENERIC = 0xF000,
291 RAW_FILEINFO_GETATTR, /* SMBgetatr */
292 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
293 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
294 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
295 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
296 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
297 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
298 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
299 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
300 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
301 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
302 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
303 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
304 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
305 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
306 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
307 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
308 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
309 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
310 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
311 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
312 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
313 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
314 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
315 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
316 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
317 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
318 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
319 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
320 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
321 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
322 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
323 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
324 /* SMB2 specific levels */
325 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
326 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
330 file handles in SMB2 are 16 bytes
337 /* union used in qfileinfo() and qpathinfo() backend calls */
339 /* generic interface:
340 * matches RAW_FILEINFO_GENERIC */
342 enum smb_fileinfo_level level;
344 /* each level can be called on either a pathname or a
345 filename, in either case the return format is
347 On SMB2 a 16 byte handle is used
349 union smb_fileinfo_in {
352 struct smb2_handle handle;
372 WIRE_STRING alt_fname;
373 uint8_t delete_pending;
375 uint64_t compressed_size;
379 uint8_t cluster_shift;
381 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
384 uint32_t alignment_requirement;
385 uint32_t reparse_tag;
387 struct stream_struct {
390 WIRE_STRING stream_name;
396 /* SMBgetatr interface:
397 * matches RAW_FILEINFO_GETATTR */
399 enum smb_fileinfo_level level;
400 union smb_fileinfo_in in;
409 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
411 enum smb_fileinfo_level level;
412 union smb_fileinfo_in in;
422 } getattre, standard;
424 /* trans2 RAW_FILEINFO_EA_SIZE interface */
426 enum smb_fileinfo_level level;
427 union smb_fileinfo_in in;
440 /* trans2 RAW_FILEINFO_EA_LIST interface */
442 enum smb_fileinfo_level level;
443 union smb_fileinfo_in file;
454 struct ea_struct *eas;
458 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
460 enum smb_fileinfo_level level;
461 union smb_fileinfo_in in;
462 uint8_t continue_flags; /* SMB2 only - SMB2_CONTINUE_FLAG_* */
464 struct smb_ea_list out;
467 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
468 only valid for a QPATHNAME call - no returned data */
470 enum smb_fileinfo_level level;
471 union smb_fileinfo_in in;
474 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
476 enum smb_fileinfo_level level;
477 union smb_fileinfo_in in;
489 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
491 enum smb_fileinfo_level level;
492 union smb_fileinfo_in in;
503 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
505 enum smb_fileinfo_level level;
506 union smb_fileinfo_in in;
513 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
515 enum smb_fileinfo_level level;
516 union smb_fileinfo_in in;
523 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
525 enum smb_fileinfo_level level;
526 union smb_fileinfo_in in;
537 uint8_t delete_pending;
544 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
546 enum smb_fileinfo_level level;
547 union smb_fileinfo_in in;
559 uint8_t delete_pending;
564 uint32_t access_mask;
571 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
573 enum smb_fileinfo_level level;
574 union smb_fileinfo_in in;
581 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
583 enum smb_fileinfo_level level;
584 union smb_fileinfo_in in;
586 struct stream_information {
588 struct stream_struct *streams;
592 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
594 enum smb_fileinfo_level level;
595 union smb_fileinfo_in in;
598 uint64_t compressed_size;
602 uint8_t cluster_shift;
606 /* RAW_FILEINFO_UNIX_BASIC interface */
608 enum smb_fileinfo_level level;
609 union smb_fileinfo_in in;
612 uint64_t end_of_file;
614 NTTIME status_change_time;
623 uint64_t permissions;
628 /* RAW_FILEINFO_UNIX_LINK interface */
630 enum smb_fileinfo_level level;
631 union smb_fileinfo_in in;
634 WIRE_STRING link_dest;
638 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
640 enum smb_fileinfo_level level;
641 union smb_fileinfo_in in;
646 } internal_information;
648 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
650 enum smb_fileinfo_level level;
651 union smb_fileinfo_in in;
654 uint32_t access_flags;
656 } access_information;
658 /* RAW_FILEINFO_POSITION_INFORMATION interface */
660 enum smb_fileinfo_level level;
661 union smb_fileinfo_in in;
666 } position_information;
668 /* RAW_FILEINFO_MODE_INFORMATION interface */
670 enum smb_fileinfo_level level;
671 union smb_fileinfo_in in;
678 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
680 enum smb_fileinfo_level level;
681 union smb_fileinfo_in in;
684 uint32_t alignment_requirement;
686 } alignment_information;
688 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
690 enum smb_fileinfo_level level;
691 union smb_fileinfo_in in;
702 } network_open_information;
705 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
707 enum smb_fileinfo_level level;
708 union smb_fileinfo_in in;
712 uint32_t reparse_tag;
714 } attribute_tag_information;
716 /* RAW_FILEINFO_SEC_DESC */
718 enum smb_fileinfo_level level;
719 union smb_fileinfo_in in;
720 uint32_t secinfo_flags;
722 struct security_descriptor *sd;
728 enum smb_setfileinfo_level {
729 RAW_SFILEINFO_GENERIC = 0xF000,
730 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
731 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
732 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
733 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
734 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
735 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
736 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
737 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
738 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
739 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
740 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
741 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
742 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
743 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
744 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
745 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
746 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
747 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
748 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
749 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
750 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
751 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
752 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
753 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
754 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
757 /* union used in setfileinfo() and setpathinfo() calls */
758 union smb_setfileinfo {
759 /* generic interface */
761 enum smb_setfileinfo_level level;
763 /* we are combining setfileinfo and setpathinfo into one
765 union setfileinfo_file {
768 struct smb2_handle handle; /* only for SMB2 */
772 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
774 enum smb_setfileinfo_level level;
775 union setfileinfo_file file;
782 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
783 also RAW_SFILEINFO_STANDARD */
785 enum smb_setfileinfo_level level;
786 union setfileinfo_file file;
792 /* notice that size, alloc_size and attrib are not settable,
793 unlike the corresponding qfileinfo level */
795 } setattre, standard;
797 /* RAW_SFILEINFO_EA_SET interface */
799 enum smb_setfileinfo_level level;
800 union setfileinfo_file file;
803 struct ea_struct *eas;
807 /* RAW_SFILEINFO_BASIC_INFO and
808 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
810 enum smb_setfileinfo_level level;
811 union setfileinfo_file file;
822 /* RAW_SFILEINFO_DISPOSITION_INFO and
823 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
825 enum smb_setfileinfo_level level;
826 union setfileinfo_file file;
829 BOOL delete_on_close;
833 /* RAW_SFILEINFO_ALLOCATION_INFO and
834 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
836 enum smb_setfileinfo_level level;
837 union setfileinfo_file file;
840 /* w2k3 rounds this up to nearest 4096 */
845 /* RAW_SFILEINFO_END_OF_FILE_INFO and
846 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
848 enum smb_setfileinfo_level level;
849 union setfileinfo_file file;
856 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
858 enum smb_setfileinfo_level level;
859 union setfileinfo_file file;
861 struct smb_rename_information {
864 const char *new_name;
866 } rename_information;
868 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
870 enum smb_setfileinfo_level level;
871 union setfileinfo_file file;
876 } position_information;
878 /* RAW_SFILEINFO_MODE_INFORMATION interface */
880 enum smb_setfileinfo_level level;
881 union setfileinfo_file file;
884 /* valid values seem to be 0, 2, 4 and 6 */
891 /* RAW_SFILEINFO_UNIX_BASIC interface */
893 enum smb_setfileinfo_level level;
894 union setfileinfo_file file;
896 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
897 uint64_t end_of_file;
899 NTTIME status_change_time;
908 uint64_t permissions;
913 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
915 enum smb_setfileinfo_level level;
916 union setfileinfo_file file;
918 const char *link_dest;
920 } unix_link, unix_hlink;
922 /* RAW_FILEINFO_SET_SEC_DESC */
924 enum smb_setfileinfo_level level;
925 union setfileinfo_file file;
927 uint32_t secinfo_flags;
928 struct security_descriptor *sd;
934 enum smb_fsinfo_level {
935 RAW_QFS_GENERIC = 0xF000,
936 RAW_QFS_DSKATTR, /* SMBdskattr */
937 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
938 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
939 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
940 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
941 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
942 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
943 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
944 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
945 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
946 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
947 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
948 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
949 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
950 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
953 /* union for fsinfo() backend call. Note that there are no in
954 structures, as this call only contains out parameters */
956 /* generic interface */
958 enum smb_fsinfo_level level;
959 struct smb2_handle handle; /* only for smb2 */
963 uint64_t blocks_total;
964 uint64_t blocks_free;
967 uint32_t serial_number;
969 uint32_t max_file_component_length;
970 uint32_t device_type;
971 uint32_t device_characteristics;
974 uint64_t quota_flags;
981 /* SMBdskattr interface */
983 enum smb_fsinfo_level level;
986 uint16_t units_total;
987 uint16_t blocks_per_unit;
993 /* trans2 RAW_QFS_ALLOCATION interface */
995 enum smb_fsinfo_level level;
999 uint32_t sectors_per_unit;
1000 uint32_t total_alloc_units;
1001 uint32_t avail_alloc_units;
1002 uint16_t bytes_per_sector;
1006 /* TRANS2 RAW_QFS_VOLUME interface */
1008 enum smb_fsinfo_level level;
1011 uint32_t serial_number;
1012 WIRE_STRING volume_name;
1016 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1018 enum smb_fsinfo_level level;
1019 struct smb2_handle handle; /* only for smb2 */
1023 uint32_t serial_number;
1024 WIRE_STRING volume_name;
1028 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1030 enum smb_fsinfo_level level;
1031 struct smb2_handle handle; /* only for smb2 */
1034 uint64_t total_alloc_units;
1035 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1036 uint32_t sectors_per_unit;
1037 uint32_t bytes_per_sector;
1041 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1043 enum smb_fsinfo_level level;
1044 struct smb2_handle handle; /* only for smb2 */
1047 uint32_t device_type;
1048 uint32_t characteristics;
1053 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1055 enum smb_fsinfo_level level;
1056 struct smb2_handle handle; /* only for smb2 */
1060 uint32_t max_file_component_length;
1061 WIRE_STRING fs_type;
1066 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1068 enum smb_fsinfo_level level;
1071 uint16_t major_version;
1072 uint16_t minor_version;
1073 uint64_t capability;
1077 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1079 enum smb_fsinfo_level level;
1080 struct smb2_handle handle; /* only for smb2 */
1083 uint64_t unknown[3];
1084 uint64_t quota_soft;
1085 uint64_t quota_hard;
1086 uint64_t quota_flags;
1088 } quota_information;
1090 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1092 enum smb_fsinfo_level level;
1093 struct smb2_handle handle; /* only for smb2 */
1096 uint64_t total_alloc_units;
1097 uint64_t call_avail_alloc_units;
1098 uint64_t actual_avail_alloc_units;
1099 uint32_t sectors_per_unit;
1100 uint32_t bytes_per_sector;
1102 } full_size_information;
1104 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1106 enum smb_fsinfo_level level;
1107 struct smb2_handle handle; /* only for smb2 */
1111 uint64_t unknown[6];
1113 } objectid_information;
1118 enum smb_open_level {
1119 RAW_OPEN_OPEN, RAW_OPEN_OPENX,
1120 RAW_OPEN_MKNEW, RAW_OPEN_CREATE,
1121 RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN,
1122 RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN,
1123 RAW_OPEN_NTTRANS_CREATE,
1124 RAW_OPEN_OPENX_READX};
1126 /* the generic interface is defined to be equal to the NTCREATEX interface */
1127 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1129 /* union for open() backend call */
1131 /* SMBNTCreateX interface */
1133 enum smb_open_level level;
1138 uint32_t access_mask;
1139 uint64_t alloc_size;
1141 uint32_t share_access;
1142 uint32_t open_disposition;
1143 uint32_t create_options;
1144 uint32_t impersonation;
1145 uint8_t security_flags;
1146 /* NOTE: fname can also be a pointer to a
1147 uint64_t file_id if create_options has the
1148 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1151 /* these last 2 elements are only used in the
1152 NTTRANS varient of the call */
1153 struct security_descriptor *sec_desc;
1154 struct smb_ea_list *ea_list;
1158 uint8_t oplock_level;
1160 uint32_t create_action;
1166 uint64_t alloc_size;
1170 uint8_t is_directory;
1172 } ntcreatex, generic;
1174 /* TRANS2_OPEN interface */
1176 enum smb_open_level level;
1181 uint16_t search_attrs;
1182 uint16_t file_attrs;
1189 struct ea_struct *eas;
1205 /* SMBopen interface */
1207 enum smb_open_level level;
1211 uint16_t search_attrs;
1223 /* SMBopenX interface */
1225 enum smb_open_level level;
1230 uint16_t search_attrs; /* not honoured by win2003 */
1231 uint16_t file_attrs;
1232 time_t write_time; /* not honoured by win2003 */
1234 uint32_t size; /* note that this sets the
1235 initial file size, not
1236 just allocation size */
1237 uint32_t timeout; /* not honoured by win2003 */
1249 uint32_t unique_fid;
1250 uint32_t access_mask;
1255 /* SMBmknew interface */
1257 enum smb_open_level level;
1269 /* SMBctemp interface */
1271 enum smb_open_level level;
1276 const char *directory;
1280 /* temp name, relative to directory */
1285 /* SMBsplopen interface */
1287 enum smb_open_level level;
1290 uint16_t setup_length;
1300 /* chained OpenX/ReadX interface */
1302 enum smb_open_level level;
1307 uint16_t search_attrs; /* not honoured by win2003 */
1308 uint16_t file_attrs;
1309 time_t write_time; /* not honoured by win2003 */
1311 uint32_t size; /* note that this sets the
1312 initial file size, not
1313 just allocation size */
1314 uint32_t timeout; /* not honoured by win2003 */
1332 uint32_t unique_fid;
1333 uint32_t access_mask;
1339 uint16_t compaction_mode;
1347 enum smb_read_level {RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
1349 #define RAW_READ_GENERIC RAW_READ_READX
1351 /* union for read() backend call
1353 note that .infoX.out.data will be allocated before the backend is
1354 called. It will be big enough to hold the maximum size asked for
1357 /* SMBreadX (and generic) interface */
1359 enum smb_read_level level;
1371 uint16_t compaction_mode;
1376 /* SMBreadbraw interface */
1378 enum smb_read_level level;
1394 /* SMBlockandread interface */
1396 enum smb_read_level level;
1410 /* SMBread interface */
1412 enum smb_read_level level;
1428 enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
1429 RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE,
1430 RAW_WRITE_SPLWRITE};
1432 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1434 /* union for write() backend call
1437 /* SMBwriteX interface */
1439 enum smb_write_level level;
1447 const uint8_t *data;
1455 /* SMBwriteunlock interface */
1457 enum smb_write_level level;
1464 const uint8_t *data;
1471 /* SMBwrite interface */
1473 enum smb_write_level level;
1480 const uint8_t *data;
1487 /* SMBwriteclose interface */
1489 enum smb_write_level level;
1496 const uint8_t *data;
1503 /* SMBsplwrite interface */
1505 enum smb_write_level level;
1510 const uint8_t *data;
1516 enum smb_lock_level {RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
1518 /* the generic interface is defined to be equal to the lockingX interface */
1519 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1521 /* union for lock() backend call
1524 /* SMBlockingX (and generic) interface */
1526 enum smb_lock_level level;
1534 struct smb_lock_entry {
1538 } *locks; /* unlocks are first in the arrray */
1542 /* SMBlock and SMBunlock interface */
1544 enum smb_lock_level level;
1555 enum smb_close_level {RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
1557 #define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
1560 union for close() backend call
1563 /* SMBclose (and generic) interface */
1565 enum smb_close_level level;
1573 /* SMBsplclose interface - empty! */
1575 enum smb_close_level level;
1584 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1587 union for lpq() backend
1590 /* generic interface */
1592 enum smb_lpq_level level;
1597 /* SMBsplretq interface */
1599 enum smb_lpq_level level;
1607 uint16_t restart_idx;
1619 enum smb_ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
1622 union for ioctl() backend
1625 /* generic interface */
1627 enum smb_ioctl_level level;
1631 /* struct for SMBioctl */
1633 enum smb_ioctl_level level;
1644 /* struct for NT ioctl call */
1646 enum smb_ioctl_level level;
1659 /* struct for SMBflush */
1667 /* struct for SMBcopy */
1682 /* struct for transact/transact2 call */
1690 uint8_t setup_count;
1692 const char *trans_name; /* SMBtrans only */
1698 uint8_t setup_count;
1705 /* struct for nttransact2 call */
1706 struct smb_nttrans {
1711 uint32_t setup_count;
1719 uint8_t setup_count;
1727 /* struct for nttrans change notify call */
1730 uint32_t buffer_size;
1731 uint32_t completion_filter;
1737 uint32_t num_changes;
1738 struct notify_changes {
1746 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
1747 RAW_SEARCH_SEARCH, /* SMBsearch */
1748 RAW_SEARCH_FFIRST, /* SMBffirst */
1749 RAW_SEARCH_FUNIQUE, /* SMBfunique */
1750 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
1751 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
1752 RAW_SEARCH_EA_LIST = SMB_FIND_EA_LIST,
1753 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
1754 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
1755 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
1756 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
1757 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
1758 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
1759 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
1762 /* union for file search */
1763 union smb_search_first {
1765 enum smb_search_level level;
1768 /* search (old) findfirst interface.
1769 Also used for ffirst and funique. */
1771 enum smb_search_level level;
1775 uint16_t search_attrib;
1776 const char *pattern;
1783 /* trans2 findfirst interface */
1785 enum smb_search_level level;
1788 uint16_t search_attrib;
1791 uint32_t storage_type;
1792 const char *pattern;
1794 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1796 struct ea_name *ea_names;
1801 uint16_t end_of_search;
1806 /* union for file search continue */
1807 union smb_search_next {
1809 enum smb_search_level level;
1812 /* search (old) findnext interface. Also used
1813 for ffirst when continuing */
1815 enum smb_search_level level;
1819 uint16_t search_attrib;
1820 struct smb_search_id {
1824 uint32_t server_cookie;
1825 uint32_t client_cookie;
1833 /* trans2 findnext interface */
1835 enum smb_search_level level;
1840 uint32_t resume_key;
1842 const char *last_name;
1844 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1846 struct ea_name *ea_names;
1850 uint16_t end_of_search;
1855 /* union for search reply file data */
1856 union smb_search_data {
1857 /* search (old) findfirst */
1862 struct smb_search_id id;
1866 /* trans2 findfirst RAW_SEARCH_STANDARD level */
1868 uint32_t resume_key;
1873 uint32_t alloc_size;
1878 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
1880 uint32_t resume_key;
1885 uint32_t alloc_size;
1891 /* trans2 findfirst RAW_SEARCH_EA_LIST level */
1893 uint32_t resume_key;
1898 uint32_t alloc_size;
1900 struct smb_ea_list eas;
1904 /* RAW_SEARCH_DIRECTORY_INFO interface */
1906 uint32_t file_index;
1912 uint64_t alloc_size;
1917 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
1919 uint32_t file_index;
1925 uint64_t alloc_size;
1929 } full_directory_info;
1931 /* RAW_SEARCH_NAME_INFO interface */
1933 uint32_t file_index;
1937 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
1939 uint32_t file_index;
1945 uint64_t alloc_size;
1948 WIRE_STRING short_name;
1950 } both_directory_info;
1952 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
1954 uint32_t file_index;
1960 uint64_t alloc_size;
1965 } id_full_directory_info;
1967 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
1969 uint32_t file_index;
1975 uint64_t alloc_size;
1979 WIRE_STRING short_name;
1981 } id_both_directory_info;
1983 /* RAW_SEARCH_UNIX_INFO interface */
1985 uint32_t file_index;
1987 uint64_t alloc_size;
1988 NTTIME status_change_time;
1997 uint64_t permissions;
2004 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2006 /* union for file search close */
2007 union smb_search_close {
2009 enum smb_search_close_level level;
2012 /* SMBfclose (old search) interface */
2014 enum smb_search_close_level level;
2017 /* max_count and search_attrib are not used, but are present */
2019 uint16_t search_attrib;
2020 struct smb_search_id id;
2024 /* SMBfindclose interface */
2026 enum smb_search_close_level level;