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.
37 struct smb_wire_string {
38 uint32_t private_length;
43 * SMB2 uses a 16Byte handle,
44 * (we can maybe use struct GUID later)
51 * a generic container for file handles or file pathes
52 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
54 union smb_handle_or_path {
57 * the qpathinfo and setpathinfo
62 * this is used as file handle in SMB
67 * this is used as file handle in SMB2
69 struct smb2_handle handle;
73 a generic container for file handles
78 * the qpathinfo and setpathinfo
83 * this is used as file handle in SMB
88 * this is used as file handle in SMB2
90 struct smb2_handle handle;
94 this header defines the structures and unions used between the SMB
95 parser and the backends.
98 /* struct used for SMBlseek call */
102 union smb_handle file;
104 int32_t offset; /* signed */
112 /* struct used in unlink() call */
123 /* struct used in chkpath() call */
132 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
134 /* union used in mkdir() call */
138 enum smb_mkdir_level level;
142 enum smb_mkdir_level level;
149 enum smb_mkdir_level level;
153 struct ea_struct *eas;
158 /* struct used in rmdir() call */
165 /* struct used in rename() call */
166 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
170 enum smb_rename_level level;
173 /* SMBrename interface */
175 enum smb_rename_level level;
178 const char *pattern1;
179 const char *pattern2;
185 /* SMBntrename interface */
187 enum smb_rename_level level;
191 uint16_t flags; /* see RENAME_FLAG_* */
192 uint32_t cluster_size;
193 const char *old_name;
194 const char *new_name;
199 enum smb_tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX};
201 /* union used in tree connect call */
203 /* generic interface */
205 enum smb_tcon_level level;
208 /* SMBtcon interface */
210 enum smb_tcon_level level;
214 const char *password;
223 /* SMBtconX interface */
225 enum smb_tcon_level level;
243 enum smb_sesssetup_level {RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO};
245 /* union used in session_setup call */
246 union smb_sesssetup {
247 /* the pre-NT1 interface */
249 enum smb_sesssetup_level level;
271 /* the NT1 interface */
273 enum smb_sesssetup_level level;
280 uint32_t capabilities;
298 /* the SPNEGO interface */
300 enum smb_sesssetup_level level;
307 uint32_t capabilities;
311 const char *workgroup;
324 /* Note that the specified enum values are identical to the actual info-levels used
327 enum smb_fileinfo_level {
328 RAW_FILEINFO_GENERIC = 0xF000,
329 RAW_FILEINFO_GETATTR, /* SMBgetatr */
330 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
331 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
332 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
333 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
334 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
335 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
336 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
337 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
338 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
339 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
340 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
341 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
342 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
343 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
344 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
345 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
346 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
347 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
348 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
349 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
350 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
351 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
352 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
353 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
354 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
355 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
356 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
357 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
358 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
359 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
360 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
361 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
362 /* SMB2 specific levels */
363 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
364 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
367 /* union used in qfileinfo() and qpathinfo() backend calls */
369 /* generic interface:
370 * matches RAW_FILEINFO_GENERIC */
372 enum smb_fileinfo_level level;
374 union smb_handle_or_path file;
382 struct smb_wire_string name;
392 struct smb_wire_string fname;
393 struct smb_wire_string alt_fname;
394 uint8_t delete_pending;
396 uint64_t compressed_size;
400 uint8_t cluster_shift;
402 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
405 uint32_t alignment_requirement;
406 uint32_t reparse_tag;
408 struct stream_struct {
411 struct smb_wire_string stream_name;
417 /* SMBgetatr interface:
418 * matches RAW_FILEINFO_GETATTR */
420 enum smb_fileinfo_level level;
422 union smb_handle_or_path file;
431 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
433 enum smb_fileinfo_level level;
435 union smb_handle_or_path file;
445 } getattre, standard;
447 /* trans2 RAW_FILEINFO_EA_SIZE interface */
449 enum smb_fileinfo_level level;
451 union smb_handle_or_path file;
464 /* trans2 RAW_FILEINFO_EA_LIST interface */
466 enum smb_fileinfo_level level;
468 union smb_handle_or_path file;
471 struct smb_wire_string name;
477 struct ea_struct *eas;
481 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
483 enum smb_fileinfo_level level;
485 union smb_handle_or_path file;
486 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
487 uint8_t continue_flags;
489 struct smb_ea_list out;
492 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
493 only valid for a QPATHNAME call - no returned data */
495 enum smb_fileinfo_level level;
497 union smb_handle_or_path file;
501 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
503 enum smb_fileinfo_level level;
505 union smb_handle_or_path file;
517 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
519 enum smb_fileinfo_level level;
521 union smb_handle_or_path file;
532 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
534 enum smb_fileinfo_level level;
536 union smb_handle_or_path file;
543 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
545 enum smb_fileinfo_level level;
547 union smb_handle_or_path file;
550 struct smb_wire_string fname;
554 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
556 enum smb_fileinfo_level level;
558 union smb_handle_or_path file;
569 uint8_t delete_pending;
572 struct smb_wire_string fname;
576 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
578 enum smb_fileinfo_level level;
580 union smb_handle_or_path file;
592 uint8_t delete_pending;
597 uint32_t access_mask;
600 struct smb_wire_string fname;
604 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
606 enum smb_fileinfo_level level;
608 union smb_handle_or_path file;
611 struct smb_wire_string fname;
615 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
617 enum smb_fileinfo_level level;
619 union smb_handle_or_path file;
621 struct stream_information {
623 struct stream_struct *streams;
627 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
629 enum smb_fileinfo_level level;
631 union smb_handle_or_path file;
634 uint64_t compressed_size;
638 uint8_t cluster_shift;
642 /* RAW_FILEINFO_UNIX_BASIC interface */
644 enum smb_fileinfo_level level;
646 union smb_handle_or_path file;
649 uint64_t end_of_file;
651 NTTIME status_change_time;
660 uint64_t permissions;
665 /* RAW_FILEINFO_UNIX_LINK interface */
667 enum smb_fileinfo_level level;
669 union smb_handle_or_path file;
672 struct smb_wire_string link_dest;
676 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
678 enum smb_fileinfo_level level;
680 union smb_handle_or_path file;
685 } internal_information;
687 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
689 enum smb_fileinfo_level level;
691 union smb_handle_or_path file;
694 uint32_t access_flags;
696 } access_information;
698 /* RAW_FILEINFO_POSITION_INFORMATION interface */
700 enum smb_fileinfo_level level;
702 union smb_handle_or_path file;
707 } position_information;
709 /* RAW_FILEINFO_MODE_INFORMATION interface */
711 enum smb_fileinfo_level level;
713 union smb_handle_or_path file;
720 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
722 enum smb_fileinfo_level level;
724 union smb_handle_or_path file;
727 uint32_t alignment_requirement;
729 } alignment_information;
731 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
733 enum smb_fileinfo_level level;
735 union smb_handle_or_path file;
746 } network_open_information;
749 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
751 enum smb_fileinfo_level level;
753 union smb_handle_or_path file;
757 uint32_t reparse_tag;
759 } attribute_tag_information;
761 /* RAW_FILEINFO_SEC_DESC */
763 enum smb_fileinfo_level level;
765 union smb_handle_or_path file;
766 uint32_t secinfo_flags;
769 struct security_descriptor *sd;
775 enum smb_setfileinfo_level {
776 RAW_SFILEINFO_GENERIC = 0xF000,
777 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
778 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
779 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
780 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
781 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
782 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
783 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
784 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
785 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
786 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
787 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
788 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
789 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
790 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
791 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
792 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
793 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
794 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
795 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
796 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
797 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
798 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
799 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
800 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
801 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
804 /* union used in setfileinfo() and setpathinfo() calls */
805 union smb_setfileinfo {
806 /* generic interface */
808 enum smb_setfileinfo_level level;
810 union smb_handle_or_path file;
814 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
816 enum smb_setfileinfo_level level;
818 union smb_handle_or_path file;
824 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
825 also RAW_SFILEINFO_STANDARD */
827 enum smb_setfileinfo_level level;
829 union smb_handle_or_path file;
833 /* notice that size, alloc_size and attrib are not settable,
834 unlike the corresponding qfileinfo level */
836 } setattre, standard;
838 /* RAW_SFILEINFO_EA_SET interface */
840 enum smb_setfileinfo_level level;
842 union smb_handle_or_path file;
844 struct ea_struct *eas;
848 /* RAW_SFILEINFO_BASIC_INFO and
849 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
851 enum smb_setfileinfo_level level;
853 union smb_handle_or_path file;
862 /* RAW_SFILEINFO_DISPOSITION_INFO and
863 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
865 enum smb_setfileinfo_level level;
867 union smb_handle_or_path file;
868 BOOL delete_on_close;
872 /* RAW_SFILEINFO_ALLOCATION_INFO and
873 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
875 enum smb_setfileinfo_level level;
877 union smb_handle_or_path file;
878 /* w2k3 rounds this up to nearest 4096 */
883 /* RAW_SFILEINFO_END_OF_FILE_INFO and
884 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
886 enum smb_setfileinfo_level level;
888 union smb_handle_or_path file;
893 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
895 enum smb_setfileinfo_level level;
897 union smb_handle_or_path file;
900 const char *new_name;
902 } rename_information;
904 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
906 enum smb_setfileinfo_level level;
908 union smb_handle_or_path file;
911 } position_information;
913 /* RAW_SFILEINFO_MODE_INFORMATION interface */
915 enum smb_setfileinfo_level level;
917 union smb_handle_or_path file;
918 /* valid values seem to be 0, 2, 4 and 6 */
925 /* RAW_SFILEINFO_UNIX_BASIC interface */
927 enum smb_setfileinfo_level level;
929 union smb_handle_or_path file;
930 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
931 uint64_t end_of_file;
933 NTTIME status_change_time;
942 uint64_t permissions;
947 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
949 enum smb_setfileinfo_level level;
951 union smb_handle_or_path file;
952 const char *link_dest;
954 } unix_link, unix_hlink;
956 /* RAW_FILEINFO_SET_SEC_DESC */
958 enum smb_setfileinfo_level level;
960 union smb_handle_or_path file;
961 uint32_t secinfo_flags;
962 struct security_descriptor *sd;
968 enum smb_fsinfo_level {
969 RAW_QFS_GENERIC = 0xF000,
970 RAW_QFS_DSKATTR, /* SMBdskattr */
971 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
972 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
973 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
974 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
975 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
976 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
977 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
978 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
979 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
980 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
981 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
982 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
983 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
984 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
987 /* union for fsinfo() backend call. Note that there are no in
988 structures, as this call only contains out parameters */
990 /* generic interface */
992 enum smb_fsinfo_level level;
993 struct smb2_handle handle; /* only for smb2 */
997 uint64_t blocks_total;
998 uint64_t blocks_free;
1001 uint32_t serial_number;
1003 uint32_t max_file_component_length;
1004 uint32_t device_type;
1005 uint32_t device_characteristics;
1006 uint64_t quota_soft;
1007 uint64_t quota_hard;
1008 uint64_t quota_flags;
1015 /* SMBdskattr interface */
1017 enum smb_fsinfo_level level;
1020 uint16_t units_total;
1021 uint16_t blocks_per_unit;
1022 uint16_t block_size;
1023 uint16_t units_free;
1027 /* trans2 RAW_QFS_ALLOCATION interface */
1029 enum smb_fsinfo_level level;
1033 uint32_t sectors_per_unit;
1034 uint32_t total_alloc_units;
1035 uint32_t avail_alloc_units;
1036 uint16_t bytes_per_sector;
1040 /* TRANS2 RAW_QFS_VOLUME interface */
1042 enum smb_fsinfo_level level;
1045 uint32_t serial_number;
1046 struct smb_wire_string volume_name;
1050 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1052 enum smb_fsinfo_level level;
1053 struct smb2_handle handle; /* only for smb2 */
1057 uint32_t serial_number;
1058 struct smb_wire_string volume_name;
1062 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1064 enum smb_fsinfo_level level;
1065 struct smb2_handle handle; /* only for smb2 */
1068 uint64_t total_alloc_units;
1069 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1070 uint32_t sectors_per_unit;
1071 uint32_t bytes_per_sector;
1075 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1077 enum smb_fsinfo_level level;
1078 struct smb2_handle handle; /* only for smb2 */
1081 uint32_t device_type;
1082 uint32_t characteristics;
1087 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1089 enum smb_fsinfo_level level;
1090 struct smb2_handle handle; /* only for smb2 */
1094 uint32_t max_file_component_length;
1095 struct smb_wire_string fs_type;
1100 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1102 enum smb_fsinfo_level level;
1105 uint16_t major_version;
1106 uint16_t minor_version;
1107 uint64_t capability;
1111 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1113 enum smb_fsinfo_level level;
1114 struct smb2_handle handle; /* only for smb2 */
1117 uint64_t unknown[3];
1118 uint64_t quota_soft;
1119 uint64_t quota_hard;
1120 uint64_t quota_flags;
1122 } quota_information;
1124 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1126 enum smb_fsinfo_level level;
1127 struct smb2_handle handle; /* only for smb2 */
1130 uint64_t total_alloc_units;
1131 uint64_t call_avail_alloc_units;
1132 uint64_t actual_avail_alloc_units;
1133 uint32_t sectors_per_unit;
1134 uint32_t bytes_per_sector;
1136 } full_size_information;
1138 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1140 enum smb_fsinfo_level level;
1141 struct smb2_handle handle; /* only for smb2 */
1145 uint64_t unknown[6];
1147 } objectid_information;
1152 enum smb_open_level {
1153 RAW_OPEN_OPEN, RAW_OPEN_OPENX,
1154 RAW_OPEN_MKNEW, RAW_OPEN_CREATE,
1155 RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN,
1156 RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN,
1157 RAW_OPEN_NTTRANS_CREATE,
1158 RAW_OPEN_OPENX_READX};
1160 /* the generic interface is defined to be equal to the NTCREATEX interface */
1161 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1163 /* union for open() backend call */
1165 /* SMBNTCreateX interface */
1167 enum smb_open_level level;
1171 uint32_t access_mask;
1172 uint64_t alloc_size;
1174 uint32_t share_access;
1175 uint32_t open_disposition;
1176 uint32_t create_options;
1177 uint32_t impersonation;
1178 uint8_t security_flags;
1179 /* NOTE: fname can also be a pointer to a
1180 uint64_t file_id if create_options has the
1181 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1184 /* these last 2 elements are only used in the
1185 NTTRANS varient of the call */
1186 struct security_descriptor *sec_desc;
1187 struct smb_ea_list *ea_list;
1190 union smb_handle file;
1191 uint8_t oplock_level;
1192 uint32_t create_action;
1198 uint64_t alloc_size;
1202 uint8_t is_directory;
1204 } ntcreatex, generic;
1206 /* TRANS2_OPEN interface */
1208 enum smb_open_level level;
1212 uint16_t search_attrs;
1213 uint16_t file_attrs;
1220 struct ea_struct *eas;
1223 union smb_handle file;
1235 /* SMBopen interface */
1237 enum smb_open_level level;
1240 uint16_t search_attrs;
1244 union smb_handle file;
1252 /* SMBopenX interface */
1254 enum smb_open_level level;
1258 uint16_t search_attrs; /* not honoured by win2003 */
1259 uint16_t file_attrs;
1260 time_t write_time; /* not honoured by win2003 */
1262 uint32_t size; /* note that this sets the
1263 initial file size, not
1264 just allocation size */
1265 uint32_t timeout; /* not honoured by win2003 */
1269 union smb_handle file;
1277 uint32_t unique_fid;
1278 uint32_t access_mask;
1283 /* SMBmknew interface */
1285 enum smb_open_level level;
1292 union smb_handle file;
1296 /* SMBctemp interface */
1298 enum smb_open_level level;
1302 const char *directory;
1305 union smb_handle file;
1306 /* temp name, relative to directory */
1311 /* SMBsplopen interface */
1313 enum smb_open_level level;
1315 uint16_t setup_length;
1320 union smb_handle file;
1325 /* chained OpenX/ReadX interface */
1327 enum smb_open_level level;
1331 uint16_t search_attrs; /* not honoured by win2003 */
1332 uint16_t file_attrs;
1333 time_t write_time; /* not honoured by win2003 */
1335 uint32_t size; /* note that this sets the
1336 initial file size, not
1337 just allocation size */
1338 uint32_t timeout; /* not honoured by win2003 */
1348 union smb_handle file;
1356 uint32_t unique_fid;
1357 uint32_t access_mask;
1363 uint16_t compaction_mode;
1371 enum smb_read_level {RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
1373 #define RAW_READ_GENERIC RAW_READ_READX
1375 /* union for read() backend call
1377 note that .infoX.out.data will be allocated before the backend is
1378 called. It will be big enough to hold the maximum size asked for
1381 /* SMBreadX (and generic) interface */
1383 enum smb_read_level level;
1385 union smb_handle file;
1390 BOOL read_for_execute;
1395 uint16_t compaction_mode;
1400 /* SMBreadbraw interface */
1402 enum smb_read_level level;
1404 union smb_handle file;
1417 /* SMBlockandread interface */
1419 enum smb_read_level level;
1421 union smb_handle file;
1432 /* SMBread interface */
1434 enum smb_read_level level;
1436 union smb_handle file;
1449 enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
1450 RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE,
1451 RAW_WRITE_SPLWRITE};
1453 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1455 /* union for write() backend call
1458 /* SMBwriteX interface */
1460 enum smb_write_level level;
1462 union smb_handle file;
1467 const uint8_t *data;
1475 /* SMBwriteunlock interface */
1477 enum smb_write_level level;
1479 union smb_handle file;
1483 const uint8_t *data;
1490 /* SMBwrite interface */
1492 enum smb_write_level level;
1494 union smb_handle file;
1498 const uint8_t *data;
1505 /* SMBwriteclose interface */
1507 enum smb_write_level level;
1509 union smb_handle file;
1513 const uint8_t *data;
1520 /* SMBsplwrite interface */
1522 enum smb_write_level level;
1524 union smb_handle file;
1526 const uint8_t *data;
1532 enum smb_lock_level {RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
1534 /* the generic interface is defined to be equal to the lockingX interface */
1535 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1537 /* union for lock() backend call
1540 /* SMBlockingX (and generic) interface */
1542 enum smb_lock_level level;
1544 union smb_handle file;
1549 struct smb_lock_entry {
1553 } *locks; /* unlocks are first in the arrray */
1557 /* SMBlock and SMBunlock interface */
1559 enum smb_lock_level level;
1561 union smb_handle file;
1569 enum smb_close_level {RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
1571 #define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
1574 union for close() backend call
1577 /* SMBclose (and generic) interface */
1579 enum smb_close_level level;
1581 union smb_handle file;
1586 /* SMBsplclose interface - empty! */
1588 enum smb_close_level level;
1590 union smb_handle file;
1596 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1599 union for lpq() backend
1602 /* generic interface */
1604 enum smb_lpq_level level;
1609 /* SMBsplretq interface */
1611 enum smb_lpq_level level;
1619 uint16_t restart_idx;
1631 enum smb_ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
1634 union for ioctl() backend
1637 /* generic interface */
1639 enum smb_ioctl_level level;
1641 union smb_handle file;
1645 /* struct for SMBioctl */
1647 enum smb_ioctl_level level;
1649 union smb_handle file;
1658 /* struct for NT ioctl call */
1660 enum smb_ioctl_level level;
1662 union smb_handle file;
1673 /* struct for SMBflush */
1677 union smb_handle file;
1683 /* struct for SMBcopy */
1698 /* struct for transact/transact2 call */
1706 uint8_t setup_count;
1708 const char *trans_name; /* SMBtrans only */
1714 uint8_t setup_count;
1721 /* struct for nttransact2 call */
1722 struct smb_nttrans {
1727 uint32_t setup_count;
1735 uint8_t setup_count;
1743 /* struct for nttrans change notify call */
1747 union smb_handle file;
1748 uint32_t buffer_size;
1749 uint32_t completion_filter;
1754 uint32_t num_changes;
1755 struct notify_changes {
1757 struct smb_wire_string name;
1763 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
1764 RAW_SEARCH_SEARCH, /* SMBsearch */
1765 RAW_SEARCH_FFIRST, /* SMBffirst */
1766 RAW_SEARCH_FUNIQUE, /* SMBfunique */
1767 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
1768 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
1769 RAW_SEARCH_EA_LIST = SMB_FIND_EA_LIST,
1770 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
1771 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
1772 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
1773 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
1774 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
1775 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
1776 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
1779 /* union for file search */
1780 union smb_search_first {
1782 enum smb_search_level level;
1785 /* search (old) findfirst interface.
1786 Also used for ffirst and funique. */
1788 enum smb_search_level level;
1792 uint16_t search_attrib;
1793 const char *pattern;
1800 /* trans2 findfirst interface */
1802 enum smb_search_level level;
1805 uint16_t search_attrib;
1808 uint32_t storage_type;
1809 const char *pattern;
1811 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1813 struct ea_name *ea_names;
1818 uint16_t end_of_search;
1823 /* union for file search continue */
1824 union smb_search_next {
1826 enum smb_search_level level;
1829 /* search (old) findnext interface. Also used
1830 for ffirst when continuing */
1832 enum smb_search_level level;
1836 uint16_t search_attrib;
1837 struct smb_search_id {
1841 uint32_t server_cookie;
1842 uint32_t client_cookie;
1850 /* trans2 findnext interface */
1852 enum smb_search_level level;
1857 uint32_t resume_key;
1859 const char *last_name;
1861 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1863 struct ea_name *ea_names;
1867 uint16_t end_of_search;
1872 /* union for search reply file data */
1873 union smb_search_data {
1874 /* search (old) findfirst */
1879 struct smb_search_id id;
1883 /* trans2 findfirst RAW_SEARCH_STANDARD level */
1885 uint32_t resume_key;
1890 uint32_t alloc_size;
1892 struct smb_wire_string name;
1895 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
1897 uint32_t resume_key;
1902 uint32_t alloc_size;
1905 struct smb_wire_string name;
1908 /* trans2 findfirst RAW_SEARCH_EA_LIST level */
1910 uint32_t resume_key;
1915 uint32_t alloc_size;
1917 struct smb_ea_list eas;
1918 struct smb_wire_string name;
1921 /* RAW_SEARCH_DIRECTORY_INFO interface */
1923 uint32_t file_index;
1929 uint64_t alloc_size;
1931 struct smb_wire_string name;
1934 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
1936 uint32_t file_index;
1942 uint64_t alloc_size;
1945 struct smb_wire_string name;
1946 } full_directory_info;
1948 /* RAW_SEARCH_NAME_INFO interface */
1950 uint32_t file_index;
1951 struct smb_wire_string name;
1954 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
1956 uint32_t file_index;
1962 uint64_t alloc_size;
1965 struct smb_wire_string short_name;
1966 struct smb_wire_string name;
1967 } both_directory_info;
1969 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
1971 uint32_t file_index;
1977 uint64_t alloc_size;
1981 struct smb_wire_string name;
1982 } id_full_directory_info;
1984 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
1986 uint32_t file_index;
1992 uint64_t alloc_size;
1996 struct smb_wire_string short_name;
1997 struct smb_wire_string name;
1998 } id_both_directory_info;
2000 /* RAW_SEARCH_UNIX_INFO interface */
2002 uint32_t file_index;
2004 uint64_t alloc_size;
2005 NTTIME status_change_time;
2014 uint64_t permissions;
2021 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2023 /* union for file search close */
2024 union smb_search_close {
2026 enum smb_search_close_level level;
2029 /* SMBfclose (old search) interface */
2031 enum smb_search_close_level level;
2034 /* max_count and search_attrib are not used, but are present */
2036 uint16_t search_attrib;
2037 struct smb_search_id id;
2041 /* SMBfindclose interface */
2043 enum smb_search_close_level level;