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)
57 SMB2 lease structure (per MS-SMB2 2.2.13)
60 uint64_t lease_key[2];
62 uint32_t lease_flags; /* should be 0 */
63 uint64_t lease_duration; /* should be 0 */
69 * a generic container for file handles or file pathes
70 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
72 union smb_handle_or_path {
75 * the qpathinfo and setpathinfo
80 * this is used as file handle in SMB
85 * this is used as file handle in SMB2
87 struct smb2_handle handle;
90 * this is used as generic file handle for the NTVFS layer
92 struct ntvfs_handle *ntvfs;
96 a generic container for file handles
100 * this is used as file handle in SMB
105 * this is used as file handle in SMB2
107 struct smb2_handle handle;
110 * this is used as generic file handle for the NTVFS layer
112 struct ntvfs_handle *ntvfs;
116 this header defines the structures and unions used between the SMB
117 parser and the backends.
120 /* struct used for SMBlseek call */
124 union smb_handle file;
126 int32_t offset; /* signed */
134 /* struct used in unlink() call */
145 /* struct used in chkpath() call */
154 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
156 /* union used in mkdir() call */
160 enum smb_mkdir_level level;
164 enum smb_mkdir_level level;
171 enum smb_mkdir_level level;
175 struct ea_struct *eas;
180 /* struct used in rmdir() call */
187 /* struct used in rename() call */
188 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME, RAW_RENAME_NTTRANS};
192 enum smb_rename_level level;
195 /* SMBrename interface */
197 enum smb_rename_level level;
200 const char *pattern1;
201 const char *pattern2;
207 /* SMBntrename interface */
209 enum smb_rename_level level;
213 uint16_t flags; /* see RENAME_FLAG_* */
214 uint32_t cluster_size;
215 const char *old_name;
216 const char *new_name;
220 /* NT TRANS rename interface */
222 enum smb_rename_level level;
225 union smb_handle file;
226 uint16_t flags;/* see RENAME_REPLACE_IF_EXISTS */
227 const char *new_name;
232 enum smb_tcon_level {
238 /* union used in tree connect call */
240 /* generic interface */
242 enum smb_tcon_level level;
245 /* SMBtcon interface */
247 enum smb_tcon_level level;
251 const char *password;
260 /* SMBtconX interface */
262 enum smb_tcon_level level;
278 /* SMB2 TreeConnect */
279 struct smb2_tree_connect {
280 enum smb_tcon_level level;
283 /* static body buffer 8 (0x08) bytes */
285 /* uint16_t path_ofs */
286 /* uint16_t path_size */
288 const char *path; /* as non-terminated UTF-16 on the wire */
291 /* static body buffer 16 (0x10) bytes */
292 /* uint16_t buffer_code; 0x10 */
296 uint32_t capabilities;
297 uint32_t access_mask;
299 /* extracted from the SMB2 header */
306 enum smb_sesssetup_level {
309 RAW_SESSSETUP_SPNEGO,
313 /* union used in session_setup call */
314 union smb_sesssetup {
315 /* the pre-NT1 interface */
317 enum smb_sesssetup_level level;
339 /* the NT1 interface */
341 enum smb_sesssetup_level level;
348 uint32_t capabilities;
366 /* the SPNEGO interface */
368 enum smb_sesssetup_level level;
375 uint32_t capabilities;
379 const char *workgroup;
391 /* SMB2 SessionSetup */
392 struct smb2_session_setup {
393 enum smb_sesssetup_level level;
396 /* static body 24 (0x18) bytes */
398 uint8_t security_mode;
399 uint32_t capabilities;
401 /* uint16_t secblob_ofs */
402 /* uint16_t secblob_size */
403 uint64_t previous_sessionid;
408 /* body buffer 8 (0x08) bytes */
409 uint16_t session_flags;
410 /* uint16_t secblob_ofs */
411 /* uint16_t secblob_size */
415 /* extracted from the SMB2 header */
421 /* Note that the specified enum values are identical to the actual info-levels used
424 enum smb_fileinfo_level {
425 RAW_FILEINFO_GENERIC = 0xF000,
426 RAW_FILEINFO_GETATTR, /* SMBgetatr */
427 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
428 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
429 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
430 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
431 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
432 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
433 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
434 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
435 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
436 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
437 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
438 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
439 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
440 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
441 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
442 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
443 RAW_FILEINFO_UNIX_INFO2 = SMB_QFILEINFO_UNIX_INFO2,
444 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
445 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
446 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
447 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
448 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
449 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
450 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
451 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
452 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
453 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
454 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
455 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
456 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
457 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
458 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
459 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
460 /* SMB2 specific levels */
461 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
462 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
465 /* union used in qfileinfo() and qpathinfo() backend calls */
467 /* generic interface:
468 * matches RAW_FILEINFO_GENERIC */
470 enum smb_fileinfo_level level;
472 union smb_handle_or_path file;
480 struct smb_wire_string name;
490 struct smb_wire_string fname;
491 struct smb_wire_string alt_fname;
492 uint8_t delete_pending;
494 uint64_t compressed_size;
498 uint8_t cluster_shift;
500 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
503 uint32_t alignment_requirement;
504 uint32_t reparse_tag;
506 struct stream_struct {
509 struct smb_wire_string stream_name;
515 /* SMBgetatr interface:
516 * matches RAW_FILEINFO_GETATTR */
518 enum smb_fileinfo_level level;
520 union smb_handle_or_path file;
529 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
531 enum smb_fileinfo_level level;
533 union smb_handle_or_path file;
543 } getattre, standard;
545 /* trans2 RAW_FILEINFO_EA_SIZE interface */
547 enum smb_fileinfo_level level;
549 union smb_handle_or_path file;
562 /* trans2 RAW_FILEINFO_EA_LIST interface */
564 enum smb_fileinfo_level level;
566 union smb_handle_or_path file;
569 struct smb_wire_string name;
575 struct ea_struct *eas;
579 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
581 enum smb_fileinfo_level level;
583 union smb_handle_or_path file;
584 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
585 uint8_t continue_flags;
587 struct smb_ea_list out;
590 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
591 only valid for a QPATHNAME call - no returned data */
593 enum smb_fileinfo_level level;
595 union smb_handle_or_path file;
599 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
601 enum smb_fileinfo_level level;
603 union smb_handle_or_path file;
615 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
617 enum smb_fileinfo_level level;
619 union smb_handle_or_path file;
630 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
632 enum smb_fileinfo_level level;
634 union smb_handle_or_path file;
641 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
643 enum smb_fileinfo_level level;
645 union smb_handle_or_path file;
648 struct smb_wire_string fname;
652 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
654 enum smb_fileinfo_level level;
656 union smb_handle_or_path file;
667 uint8_t delete_pending;
670 struct smb_wire_string fname;
674 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
676 enum smb_fileinfo_level level;
678 union smb_handle_or_path file;
690 uint8_t delete_pending;
695 uint32_t access_mask;
698 uint32_t alignment_requirement;
699 struct smb_wire_string fname;
703 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
705 enum smb_fileinfo_level level;
707 union smb_handle_or_path file;
710 struct smb_wire_string fname;
714 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
716 enum smb_fileinfo_level level;
718 union smb_handle_or_path file;
720 struct stream_information {
722 struct stream_struct *streams;
726 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
728 enum smb_fileinfo_level level;
730 union smb_handle_or_path file;
733 uint64_t compressed_size;
737 uint8_t cluster_shift;
741 /* RAW_FILEINFO_UNIX_BASIC interface */
743 enum smb_fileinfo_level level;
745 union smb_handle_or_path file;
748 uint64_t end_of_file;
750 NTTIME status_change_time;
759 uint64_t permissions;
764 /* RAW_FILEINFO_UNIX_INFO2 interface */
766 enum smb_fileinfo_level level;
768 union smb_handle_or_path file;
771 uint64_t end_of_file;
773 NTTIME status_change_time;
782 uint64_t permissions;
790 /* RAW_FILEINFO_UNIX_LINK interface */
792 enum smb_fileinfo_level level;
794 union smb_handle_or_path file;
797 struct smb_wire_string link_dest;
801 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
803 enum smb_fileinfo_level level;
805 union smb_handle_or_path file;
810 } internal_information;
812 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
814 enum smb_fileinfo_level level;
816 union smb_handle_or_path file;
819 uint32_t access_flags;
821 } access_information;
823 /* RAW_FILEINFO_POSITION_INFORMATION interface */
825 enum smb_fileinfo_level level;
827 union smb_handle_or_path file;
832 } position_information;
834 /* RAW_FILEINFO_MODE_INFORMATION interface */
836 enum smb_fileinfo_level level;
838 union smb_handle_or_path file;
845 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
847 enum smb_fileinfo_level level;
849 union smb_handle_or_path file;
852 uint32_t alignment_requirement;
854 } alignment_information;
856 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
858 enum smb_fileinfo_level level;
860 union smb_handle_or_path file;
871 } network_open_information;
874 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
876 enum smb_fileinfo_level level;
878 union smb_handle_or_path file;
882 uint32_t reparse_tag;
884 } attribute_tag_information;
886 /* RAW_FILEINFO_SEC_DESC */
888 enum smb_fileinfo_level level;
890 union smb_handle_or_path file;
891 uint32_t secinfo_flags;
894 struct security_descriptor *sd;
900 enum smb_setfileinfo_level {
901 RAW_SFILEINFO_GENERIC = 0xF000,
902 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
903 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
904 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
905 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
906 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
907 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
908 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
909 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
910 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
911 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
912 RAW_SFILEINFO_UNIX_INFO2 = SMB_SFILEINFO_UNIX_INFO2,
913 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
914 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
915 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
916 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
917 RAW_SFILEINFO_LINK_INFORMATION = SMB_SFILEINFO_LINK_INFORMATION,
918 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
919 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
920 RAW_SFILEINFO_FULL_EA_INFORMATION = SMB_SFILEINFO_FULL_EA_INFORMATION,
921 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
922 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
923 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
924 RAW_SFILEINFO_PIPE_INFORMATION = SMB_SFILEINFO_PIPE_INFORMATION,
925 RAW_SFILEINFO_VALID_DATA_INFORMATION = SMB_SFILEINFO_VALID_DATA_INFORMATION,
926 RAW_SFILEINFO_SHORT_NAME_INFORMATION = SMB_SFILEINFO_SHORT_NAME_INFORMATION,
927 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
928 RAW_SFILEINFO_1027 = SMB_SFILEINFO_1027,
929 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
930 RAW_SFILEINFO_1030 = SMB_SFILEINFO_1030,
931 RAW_SFILEINFO_1031 = SMB_SFILEINFO_1031,
932 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
933 RAW_SFILEINFO_1036 = SMB_SFILEINFO_1036,
934 RAW_SFILEINFO_1041 = SMB_SFILEINFO_1041,
935 RAW_SFILEINFO_1042 = SMB_SFILEINFO_1042,
936 RAW_SFILEINFO_1043 = SMB_SFILEINFO_1043,
937 RAW_SFILEINFO_1044 = SMB_SFILEINFO_1044,
939 /* cope with breakage in SMB2 */
940 RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
943 /* union used in setfileinfo() and setpathinfo() calls */
944 union smb_setfileinfo {
945 /* generic interface */
947 enum smb_setfileinfo_level level;
949 union smb_handle_or_path file;
953 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
955 enum smb_setfileinfo_level level;
957 union smb_handle_or_path file;
963 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
964 also RAW_SFILEINFO_STANDARD */
966 enum smb_setfileinfo_level level;
968 union smb_handle_or_path file;
972 /* notice that size, alloc_size and attrib are not settable,
973 unlike the corresponding qfileinfo level */
975 } setattre, standard;
977 /* RAW_SFILEINFO_EA_SET interface */
979 enum smb_setfileinfo_level level;
981 union smb_handle_or_path file;
983 struct ea_struct *eas;
987 /* RAW_SFILEINFO_BASIC_INFO and
988 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
990 enum smb_setfileinfo_level level;
992 union smb_handle_or_path file;
1002 /* RAW_SFILEINFO_DISPOSITION_INFO and
1003 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1005 enum smb_setfileinfo_level level;
1007 union smb_handle_or_path file;
1008 bool delete_on_close;
1012 /* RAW_SFILEINFO_ALLOCATION_INFO and
1013 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1015 enum smb_setfileinfo_level level;
1017 union smb_handle_or_path file;
1018 /* w2k3 rounds this up to nearest 4096 */
1019 uint64_t alloc_size;
1023 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1024 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1026 enum smb_setfileinfo_level level;
1028 union smb_handle_or_path file;
1033 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1035 enum smb_setfileinfo_level level;
1037 union smb_handle_or_path file;
1040 const char *new_name;
1042 } rename_information;
1044 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1046 enum smb_setfileinfo_level level;
1048 union smb_handle_or_path file;
1051 const char *new_name;
1055 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1057 enum smb_setfileinfo_level level;
1059 union smb_handle_or_path file;
1062 } position_information;
1064 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1066 enum smb_setfileinfo_level level;
1068 union smb_handle_or_path file;
1069 /* valid values seem to be 0, 2, 4 and 6 */
1074 /* RAW_SFILEINFO_UNIX_BASIC interface */
1076 enum smb_setfileinfo_level level;
1078 union smb_handle_or_path file;
1079 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
1080 uint64_t end_of_file;
1082 NTTIME status_change_time;
1091 uint64_t permissions;
1096 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1098 enum smb_setfileinfo_level level;
1100 union smb_handle_or_path file;
1101 uint64_t end_of_file;
1103 NTTIME status_change_time;
1112 uint64_t permissions;
1115 uint32_t file_flags;
1116 uint32_t flags_mask;
1120 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1122 enum smb_setfileinfo_level level;
1124 union smb_handle_or_path file;
1125 const char *link_dest;
1127 } unix_link, unix_hlink;
1129 /* RAW_FILEINFO_SET_SEC_DESC */
1131 enum smb_setfileinfo_level level;
1133 union smb_handle_or_path file;
1134 uint32_t secinfo_flags;
1135 struct security_descriptor *sd;
1139 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1141 enum smb_setfileinfo_level level;
1143 union smb_handle_or_path file;
1144 struct smb_ea_list eas;
1146 } full_ea_information;
1150 enum smb_fsinfo_level {
1151 RAW_QFS_GENERIC = 0xF000,
1152 RAW_QFS_DSKATTR, /* SMBdskattr */
1153 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
1154 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
1155 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
1156 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
1157 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
1158 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
1159 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
1160 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
1161 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
1162 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
1163 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
1164 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
1165 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
1166 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
1169 /* union for fsinfo() backend call. Note that there are no in
1170 structures, as this call only contains out parameters */
1172 /* generic interface */
1174 enum smb_fsinfo_level level;
1175 struct smb2_handle handle; /* only for smb2 */
1178 uint32_t block_size;
1179 uint64_t blocks_total;
1180 uint64_t blocks_free;
1183 uint32_t serial_number;
1185 uint32_t max_file_component_length;
1186 uint32_t device_type;
1187 uint32_t device_characteristics;
1188 uint64_t quota_soft;
1189 uint64_t quota_hard;
1190 uint64_t quota_flags;
1197 /* SMBdskattr interface */
1199 enum smb_fsinfo_level level;
1202 uint16_t units_total;
1203 uint16_t blocks_per_unit;
1204 uint16_t block_size;
1205 uint16_t units_free;
1209 /* trans2 RAW_QFS_ALLOCATION interface */
1211 enum smb_fsinfo_level level;
1215 uint32_t sectors_per_unit;
1216 uint32_t total_alloc_units;
1217 uint32_t avail_alloc_units;
1218 uint16_t bytes_per_sector;
1222 /* TRANS2 RAW_QFS_VOLUME interface */
1224 enum smb_fsinfo_level level;
1227 uint32_t serial_number;
1228 struct smb_wire_string volume_name;
1232 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1234 enum smb_fsinfo_level level;
1235 struct smb2_handle handle; /* only for smb2 */
1239 uint32_t serial_number;
1240 struct smb_wire_string volume_name;
1244 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1246 enum smb_fsinfo_level level;
1247 struct smb2_handle handle; /* only for smb2 */
1250 uint64_t total_alloc_units;
1251 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1252 uint32_t sectors_per_unit;
1253 uint32_t bytes_per_sector;
1257 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1259 enum smb_fsinfo_level level;
1260 struct smb2_handle handle; /* only for smb2 */
1263 uint32_t device_type;
1264 uint32_t characteristics;
1269 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1271 enum smb_fsinfo_level level;
1272 struct smb2_handle handle; /* only for smb2 */
1276 uint32_t max_file_component_length;
1277 struct smb_wire_string fs_type;
1282 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1284 enum smb_fsinfo_level level;
1287 uint16_t major_version;
1288 uint16_t minor_version;
1289 uint64_t capability;
1293 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1295 enum smb_fsinfo_level level;
1296 struct smb2_handle handle; /* only for smb2 */
1299 uint64_t unknown[3];
1300 uint64_t quota_soft;
1301 uint64_t quota_hard;
1302 uint64_t quota_flags;
1304 } quota_information;
1306 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1308 enum smb_fsinfo_level level;
1309 struct smb2_handle handle; /* only for smb2 */
1312 uint64_t total_alloc_units;
1313 uint64_t call_avail_alloc_units;
1314 uint64_t actual_avail_alloc_units;
1315 uint32_t sectors_per_unit;
1316 uint32_t bytes_per_sector;
1318 } full_size_information;
1320 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1322 enum smb_fsinfo_level level;
1323 struct smb2_handle handle; /* only for smb2 */
1327 uint64_t unknown[6];
1329 } objectid_information;
1334 enum smb_open_level {
1343 RAW_OPEN_NTTRANS_CREATE,
1344 RAW_OPEN_OPENX_READX,
1348 /* the generic interface is defined to be equal to the NTCREATEX interface */
1349 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1351 /* union for open() backend call */
1354 * because the *.out.file structs are not aligned to the same offset for each level
1355 * we provide a hepler macro that should be used to find the current smb_handle structure
1357 #define SMB_OPEN_OUT_FILE(op, file) do { \
1358 switch (op->generic.level) { \
1359 case RAW_OPEN_OPEN: \
1360 file = &op->openold.out.file; \
1362 case RAW_OPEN_OPENX: \
1363 file = &op->openx.out.file; \
1365 case RAW_OPEN_MKNEW: \
1366 file = &op->mknew.out.file; \
1368 case RAW_OPEN_CREATE: \
1369 file = &op->create.out.file; \
1371 case RAW_OPEN_CTEMP: \
1372 file = &op->ctemp.out.file; \
1374 case RAW_OPEN_SPLOPEN: \
1375 file = &op->splopen.out.file; \
1377 case RAW_OPEN_NTCREATEX: \
1378 file = &op->ntcreatex.out.file; \
1380 case RAW_OPEN_T2OPEN: \
1381 file = &op->t2open.out.file; \
1383 case RAW_OPEN_NTTRANS_CREATE: \
1384 file = &op->nttrans.out.file; \
1386 case RAW_OPEN_OPENX_READX: \
1387 file = &op->openxreadx.out.file; \
1389 case RAW_OPEN_SMB2: \
1390 file = &op->smb2.out.file; \
1393 /* this must be a programmer error */ \
1398 /* SMBNTCreateX, nttrans and generic interface */
1400 enum smb_open_level level;
1404 uint32_t access_mask;
1405 uint64_t alloc_size;
1407 uint32_t share_access;
1408 uint32_t open_disposition;
1409 uint32_t create_options;
1410 uint32_t impersonation;
1411 uint8_t security_flags;
1412 /* NOTE: fname can also be a pointer to a
1413 uint64_t file_id if create_options has the
1414 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1417 /* these last 2 elements are only used in the
1418 NTTRANS varient of the call */
1419 struct security_descriptor *sec_desc;
1420 struct smb_ea_list *ea_list;
1422 /* some optional parameters from the SMB2 varient */
1423 bool query_maximal_access;
1426 union smb_handle file;
1427 uint8_t oplock_level;
1428 uint32_t create_action;
1434 uint64_t alloc_size;
1438 uint8_t is_directory;
1440 /* optional return values matching SMB2 tagged
1441 values in the call */
1442 uint32_t maximal_access;
1444 } ntcreatex, nttrans, generic;
1446 /* TRANS2_OPEN interface */
1448 enum smb_open_level level;
1452 uint16_t search_attrs;
1453 uint16_t file_attrs;
1460 struct ea_struct *eas;
1463 union smb_handle file;
1475 /* SMBopen interface */
1477 enum smb_open_level level;
1480 uint16_t search_attrs;
1484 union smb_handle file;
1492 /* SMBopenX interface */
1494 enum smb_open_level level;
1498 uint16_t search_attrs; /* not honoured by win2003 */
1499 uint16_t file_attrs;
1500 time_t write_time; /* not honoured by win2003 */
1502 uint32_t size; /* note that this sets the
1503 initial file size, not
1504 just allocation size */
1505 uint32_t timeout; /* not honoured by win2003 */
1509 union smb_handle file;
1517 uint32_t unique_fid;
1518 uint32_t access_mask;
1523 /* SMBmknew interface */
1525 enum smb_open_level level;
1532 union smb_handle file;
1536 /* SMBctemp interface */
1538 enum smb_open_level level;
1542 const char *directory;
1545 union smb_handle file;
1546 /* temp name, relative to directory */
1551 /* SMBsplopen interface */
1553 enum smb_open_level level;
1555 uint16_t setup_length;
1560 union smb_handle file;
1565 /* chained OpenX/ReadX interface */
1567 enum smb_open_level level;
1571 uint16_t search_attrs; /* not honoured by win2003 */
1572 uint16_t file_attrs;
1573 time_t write_time; /* not honoured by win2003 */
1575 uint32_t size; /* note that this sets the
1576 initial file size, not
1577 just allocation size */
1578 uint32_t timeout; /* not honoured by win2003 */
1588 union smb_handle file;
1596 uint32_t unique_fid;
1597 uint32_t access_mask;
1603 uint16_t compaction_mode;
1608 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1609 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1610 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1611 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1614 struct smb2_create {
1615 enum smb_open_level level;
1617 /* static body buffer 56 (0x38) bytes */
1618 uint8_t security_flags; /* SMB2_SECURITY_* */
1619 uint8_t oplock_level; /* SMB2_OPLOCK_LEVEL_* */
1620 uint32_t impersonation_level; /* SMB2_IMPERSONATION_* */
1621 uint64_t create_flags;
1623 uint32_t desired_access;
1624 uint32_t file_attributes;
1625 uint32_t share_access; /* NTCREATEX_SHARE_ACCESS_* */
1626 uint32_t create_disposition; /* NTCREATEX_DISP_* */
1627 uint32_t create_options; /* NTCREATEX_OPTIONS_* */
1629 /* uint16_t fname_ofs */
1630 /* uint16_t fname_size */
1631 /* uint32_t blob_ofs; */
1632 /* uint32_t blob_size; */
1637 /* now some optional parameters - encoded as tagged blobs */
1638 struct smb_ea_list eas;
1639 uint64_t alloc_size;
1640 struct security_descriptor *sec_desc;
1642 struct smb2_handle *durable_handle;
1643 bool query_maximal_access;
1645 bool query_on_disk_id;
1646 struct smb2_lease *lease_request;
1648 /* and any additional blobs the caller wants */
1649 struct smb2_create_blobs {
1651 struct smb2_create_blob {
1658 union smb_handle file;
1660 /* static body buffer 88 (0x58) bytes */
1661 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1662 uint8_t oplock_level;
1664 uint32_t create_action;
1669 uint64_t alloc_size;
1673 /* struct smb2_handle handle;*/
1674 /* uint32_t blob_ofs; */
1675 /* uint32_t blob_size; */
1677 /* optional return values matching tagged values in the call */
1678 uint32_t maximal_access;
1679 uint8_t on_disk_id[32];
1680 struct smb2_lease lease_response;
1682 /* tagged blobs in the reply */
1683 struct smb2_create_blobs blobs;
1690 enum smb_read_level {
1698 #define RAW_READ_GENERIC RAW_READ_READX
1700 /* union for read() backend call
1702 note that .infoX.out.data will be allocated before the backend is
1703 called. It will be big enough to hold the maximum size asked for
1706 /* SMBreadX (and generic) interface */
1708 enum smb_read_level level;
1710 union smb_handle file;
1712 uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
1715 bool read_for_execute;
1720 uint16_t compaction_mode;
1725 /* SMBreadbraw interface */
1727 enum smb_read_level level;
1729 union smb_handle file;
1742 /* SMBlockandread interface */
1744 enum smb_read_level level;
1746 union smb_handle file;
1757 /* SMBread interface */
1759 enum smb_read_level level;
1761 union smb_handle file;
1774 enum smb_read_level level;
1776 union smb_handle file;
1778 /* static body buffer 48 (0x30) bytes */
1779 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1784 /* struct smb2_handle handle; */
1788 /* the docs give no indication of what
1789 these channel variables are for */
1790 uint16_t channel_offset;
1791 uint16_t channel_length;
1794 /* static body buffer 16 (0x10) bytes */
1795 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1796 /* uint8_t data_ofs; */
1797 /* uint8_t reserved; */
1798 /* uint32_t data_size; */
1809 enum smb_write_level {
1810 RAW_WRITE_WRITEUNLOCK,
1813 RAW_WRITE_WRITECLOSE,
1818 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1820 /* union for write() backend call
1823 /* SMBwriteX interface */
1825 enum smb_write_level level;
1827 union smb_handle file;
1832 const uint8_t *data;
1840 /* SMBwriteunlock interface */
1842 enum smb_write_level level;
1844 union smb_handle file;
1848 const uint8_t *data;
1855 /* SMBwrite interface */
1857 enum smb_write_level level;
1859 union smb_handle file;
1863 const uint8_t *data;
1870 /* SMBwriteclose interface */
1872 enum smb_write_level level;
1874 union smb_handle file;
1878 const uint8_t *data;
1885 /* SMBsplwrite interface */
1887 enum smb_write_level level;
1889 union smb_handle file;
1891 const uint8_t *data;
1897 enum smb_write_level level;
1899 union smb_handle file;
1901 /* static body buffer 48 (0x30) bytes */
1902 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1903 /* uint16_t data_ofs; */
1904 /* uint32_t data_size; */
1906 /* struct smb2_handle handle; */
1907 uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
1908 uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
1914 /* static body buffer 17 (0x11) bytes */
1915 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
1918 uint64_t unknown1; /* 0x0000000000000000 */
1924 enum smb_lock_level {
1932 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1934 /* union for lock() backend call
1937 /* SMBlockingX and generic interface */
1939 enum smb_lock_level level;
1941 union smb_handle file;
1946 struct smb_lock_entry {
1947 uint32_t pid; /* 16 bits in SMB1 */
1950 } *locks; /* unlocks are first in the arrray */
1954 /* SMBlock and SMBunlock interface */
1956 enum smb_lock_level level;
1958 union smb_handle file;
1966 enum smb_lock_level level;
1968 union smb_handle file;
1970 /* static body buffer 48 (0x30) bytes */
1971 /* uint16_t buffer_code; 0x30 */
1972 uint16_t lock_count;
1974 /* struct smb2_handle handle; */
1975 struct smb2_lock_element {
1978 /* these flags are the same as the SMB2 lock flags */
1979 #define SMB2_LOCK_FLAG_NONE 0x00000000
1980 #define SMB2_LOCK_FLAG_SHARED 0x00000001
1981 #define SMB2_LOCK_FLAG_EXCLUSIVE 0x00000002
1982 #define SMB2_LOCK_FLAG_UNLOCK 0x00000004
1983 #define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY 0x00000010
1984 #define SMB2_LOCK_FLAG_ALL_MASK 0x00000017
1990 /* static body buffer 4 (0x04) bytes */
1991 /* uint16_t buffer_code; 0x04 */
1998 enum smb_lock_level level;
2000 union smb_handle file;
2002 /* static body buffer 24 (0x18) bytes */
2003 uint8_t oplock_level;
2006 /* struct smb2_handle handle; */
2012 enum smb_close_level {
2020 union for close() backend call
2023 /* generic interface */
2025 enum smb_close_level level;
2027 union smb_handle file;
2029 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
2030 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
2038 uint64_t alloc_size;
2044 /* SMBclose interface */
2046 enum smb_close_level level;
2048 union smb_handle file;
2053 /* SMBsplclose interface - empty! */
2055 enum smb_close_level level;
2057 union smb_handle file;
2063 enum smb_close_level level;
2065 union smb_handle file;
2067 /* static body buffer 24 (0x18) bytes */
2068 /* uint16_t buffer_code; 0x18 */
2069 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
2073 /* static body buffer 60 (0x3C) bytes */
2074 /* uint16_t buffer_code; 0x3C */
2081 uint64_t alloc_size;
2089 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
2092 union for lpq() backend
2095 /* generic interface */
2097 enum smb_lpq_level level;
2102 /* SMBsplretq interface */
2104 enum smb_lpq_level level;
2112 uint16_t restart_idx;
2124 enum smb_ioctl_level {
2128 RAW_IOCTL_SMB2_NO_HANDLE
2132 union for ioctl() backend
2135 /* generic interface */
2137 enum smb_ioctl_level level;
2139 union smb_handle file;
2143 /* struct for SMBioctl */
2145 enum smb_ioctl_level level;
2147 union smb_handle file;
2156 /* struct for NT ioctl call */
2158 enum smb_ioctl_level level;
2160 union smb_handle file;
2174 enum smb_ioctl_level level;
2176 union smb_handle file;
2178 /* static body buffer 56 (0x38) bytes */
2179 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2182 /*struct smb2_handle handle;*/
2183 /* uint32_t out_ofs; */
2184 /* uint32_t out_size; */
2186 /* uint32_t in_ofs; */
2187 /* uint32_t in_size; */
2188 uint32_t max_response_size;
2196 union smb_handle file;
2198 /* static body buffer 48 (0x30) bytes */
2199 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2202 /* struct smb2_handle handle; */
2203 /* uint32_t in_ofs; */
2204 /* uint32_t in_size; */
2205 /* uint32_t out_ofs; */
2206 /* uint32_t out_size; */
2217 enum smb_flush_level {
2224 /* struct for SMBflush */
2226 enum smb_flush_level level;
2228 union smb_handle file;
2232 /* SMBflush with 0xFFFF wildcard fnum */
2234 enum smb_flush_level level;
2239 enum smb_flush_level level;
2241 union smb_handle file;
2251 /* struct for SMBcopy */
2266 /* struct for transact/transact2 call */
2274 uint8_t setup_count;
2276 const char *trans_name; /* SMBtrans only */
2282 uint8_t setup_count;
2289 /* struct for nttransact2 call */
2290 struct smb_nttrans {
2295 uint8_t setup_count;
2303 uint8_t setup_count; /* in units of 16 bit words */
2310 enum smb_notify_level {
2316 /* struct for nttrans change notify call */
2318 enum smb_notify_level level;
2321 union smb_handle file;
2322 uint32_t buffer_size;
2323 uint32_t completion_filter;
2328 uint32_t num_changes;
2329 struct notify_changes {
2331 struct smb_wire_string name;
2336 struct smb2_notify {
2337 enum smb_notify_level level;
2340 union smb_handle file;
2341 /* static body buffer 32 (0x20) bytes */
2342 /* uint16_t buffer_code; 0x32 */
2344 uint32_t buffer_size;
2345 /*struct smb2_handle file;*/
2346 uint32_t completion_filter;
2351 /* static body buffer 8 (0x08) bytes */
2352 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2353 /* uint16_t blob_ofs; */
2354 /* uint16_t blob_size; */
2359 /* DATA_BLOB content */
2360 uint32_t num_changes;
2361 struct notify_changes *changes;
2366 enum smb_search_level {
2367 RAW_SEARCH_SEARCH, /* SMBsearch */
2368 RAW_SEARCH_FFIRST, /* SMBffirst */
2369 RAW_SEARCH_FUNIQUE, /* SMBfunique */
2370 RAW_SEARCH_TRANS2, /* SMBtrans2 */
2371 RAW_SEARCH_SMB2 /* SMB2 Find */
2374 enum smb_search_data_level {
2375 RAW_SEARCH_DATA_GENERIC = 0x10000, /* only used in the smbcli_ code */
2376 RAW_SEARCH_DATA_SEARCH,
2377 RAW_SEARCH_DATA_STANDARD = SMB_FIND_STANDARD,
2378 RAW_SEARCH_DATA_EA_SIZE = SMB_FIND_EA_SIZE,
2379 RAW_SEARCH_DATA_EA_LIST = SMB_FIND_EA_LIST,
2380 RAW_SEARCH_DATA_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
2381 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
2382 RAW_SEARCH_DATA_NAME_INFO = SMB_FIND_NAME_INFO,
2383 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
2384 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
2385 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
2386 RAW_SEARCH_DATA_UNIX_INFO = SMB_FIND_UNIX_INFO,
2387 RAW_SEARCH_DATA_UNIX_INFO2 = SMB_FIND_UNIX_INFO2
2390 /* union for file search */
2391 union smb_search_first {
2393 enum smb_search_level level;
2394 enum smb_search_data_level data_level;
2397 /* search (old) findfirst interface.
2398 Also used for ffirst and funique. */
2400 enum smb_search_level level;
2401 enum smb_search_data_level data_level;
2405 uint16_t search_attrib;
2406 const char *pattern;
2413 /* trans2 findfirst interface */
2415 enum smb_search_level level;
2416 enum smb_search_data_level data_level;
2419 uint16_t search_attrib;
2422 uint32_t storage_type;
2423 const char *pattern;
2425 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2427 struct ea_name *ea_names;
2432 uint16_t end_of_search;
2437 SMB2 uses different level numbers for the same old SMB trans2 search levels
2439 #define SMB2_FIND_DIRECTORY_INFO 0x01
2440 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
2441 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
2442 #define SMB2_FIND_NAME_INFO 0x0C
2443 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
2444 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
2446 /* flags for SMB2 find */
2447 #define SMB2_CONTINUE_FLAG_RESTART 0x01
2448 #define SMB2_CONTINUE_FLAG_SINGLE 0x02
2449 #define SMB2_CONTINUE_FLAG_INDEX 0x04
2450 #define SMB2_CONTINUE_FLAG_REOPEN 0x10
2454 enum smb_search_level level;
2455 enum smb_search_data_level data_level;
2457 union smb_handle file;
2459 /* static body buffer 32 (0x20) bytes */
2460 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2462 uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
2463 uint32_t file_index;
2464 /* struct smb2_handle handle; */
2465 /* uint16_t pattern_ofs; */
2466 /* uint16_t pattern_size; */
2467 uint32_t max_response_size;
2470 const char *pattern;
2473 /* static body buffer 8 (0x08) bytes */
2474 /* uint16_t buffer_code; 0x08 */
2475 /* uint16_t blob_ofs; */
2476 /* uint32_t blob_size; */
2484 /* union for file search continue */
2485 union smb_search_next {
2487 enum smb_search_level level;
2488 enum smb_search_data_level data_level;
2491 /* search (old) findnext interface. Also used
2492 for ffirst when continuing */
2494 enum smb_search_level level;
2495 enum smb_search_data_level data_level;
2499 uint16_t search_attrib;
2500 struct smb_search_id {
2504 uint32_t server_cookie;
2505 uint32_t client_cookie;
2513 /* trans2 findnext interface */
2515 enum smb_search_level level;
2516 enum smb_search_data_level data_level;
2521 uint32_t resume_key;
2523 const char *last_name;
2525 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2527 struct ea_name *ea_names;
2531 uint16_t end_of_search;
2536 struct smb2_find smb2;
2539 /* union for search reply file data */
2540 union smb_search_data {
2542 * search (old) findfirst
2543 * RAW_SEARCH_DATA_SEARCH
2549 struct smb_search_id id;
2553 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2555 uint32_t resume_key;
2560 uint32_t alloc_size;
2562 struct smb_wire_string name;
2565 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2567 uint32_t resume_key;
2572 uint32_t alloc_size;
2575 struct smb_wire_string name;
2578 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2580 uint32_t resume_key;
2585 uint32_t alloc_size;
2587 struct smb_ea_list eas;
2588 struct smb_wire_string name;
2591 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2593 uint32_t file_index;
2599 uint64_t alloc_size;
2601 struct smb_wire_string name;
2604 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2606 uint32_t file_index;
2612 uint64_t alloc_size;
2615 struct smb_wire_string name;
2616 } full_directory_info;
2618 /* RAW_SEARCH_DATA_NAME_INFO interface */
2620 uint32_t file_index;
2621 struct smb_wire_string name;
2624 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2626 uint32_t file_index;
2632 uint64_t alloc_size;
2635 struct smb_wire_string short_name;
2636 struct smb_wire_string name;
2637 } both_directory_info;
2639 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2641 uint32_t file_index;
2647 uint64_t alloc_size;
2651 struct smb_wire_string name;
2652 } id_full_directory_info;
2654 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2656 uint32_t file_index;
2662 uint64_t alloc_size;
2666 struct smb_wire_string short_name;
2667 struct smb_wire_string name;
2668 } id_both_directory_info;
2670 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2672 uint32_t file_index;
2674 uint64_t alloc_size;
2675 NTTIME status_change_time;
2684 uint64_t permissions;
2689 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2691 uint32_t file_index;
2692 uint64_t end_of_file;
2694 NTTIME status_change_time;
2703 uint64_t permissions;
2706 uint32_t file_flags;
2707 uint32_t flags_mask;
2708 struct smb_wire_string name;
2712 /* Callback function passed to the raw search interface. */
2713 typedef bool (*smbcli_search_callback)(void *private_data, const union smb_search_data *file);
2715 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2717 /* union for file search close */
2718 union smb_search_close {
2720 enum smb_search_close_level level;
2723 /* SMBfclose (old search) interface */
2725 enum smb_search_close_level level;
2728 /* max_count and search_attrib are not used, but are present */
2730 uint16_t search_attrib;
2731 struct smb_search_id id;
2735 /* SMBfindclose interface */
2737 enum smb_search_close_level level;
2747 struct for SMBecho call
2751 uint16_t repeat_count;
2757 uint16_t sequence_number;
2764 struct for shadow copy volumes
2766 struct smb_shadow_copy {
2768 union smb_handle file;
2772 uint32_t num_volumes;
2778 #endif /* __LIBCLI_RAW_INTERFACES_H__ */