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__
25 #include "source4/libcli/raw/smb.h"
26 #include "../libcli/smb/smb_common.h"
27 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
29 /* this structure is just a wrapper for a string, the only reason we
30 bother with this is that it allows us to check the length provided
31 on the wire in testsuite test code to ensure that we are
32 terminating names in the same way that win2003 is. The *ONLY* time
33 you should ever look at the 'private_length' field in this
34 structure is inside compliance test code, in all other cases just
35 use the null terminated char* as the definitive definition of the
38 also note that this structure is only used in packets where there
39 is an explicit length provided on the wire (hence the name). That
40 length is placed in 'private_length'. For packets where the length
41 is always determined by NULL or packet termination a normal char*
42 is used in the structure definition.
44 struct smb_wire_string
{
45 uint32_t private_length
;
50 * SMB2 uses a 16Byte handle,
51 * (we can maybe use struct GUID later)
57 struct smb2_lease_break
{
58 struct smb2_lease current_lease
;
60 uint32_t new_lease_state
;
61 uint32_t break_reason
; /* should be 0 */
62 uint32_t access_mask_hint
; /* should be 0 */
63 uint32_t share_mask_hint
; /* 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
;
174 unsigned int num_eas
;
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
;
273 uint32_t guest_max_access
;
280 /* SMB2 TreeConnect */
281 struct smb2_tree_connect
{
282 enum smb_tcon_level level
;
285 /* static body buffer 8 (0x08) bytes */
287 /* uint16_t path_ofs */
288 /* uint16_t path_size */
290 const char *path
; /* as non-terminated UTF-16 on the wire */
293 /* static body buffer 16 (0x10) bytes */
294 /* uint16_t buffer_code; 0x10 */
298 uint32_t capabilities
;
299 uint32_t access_mask
;
301 /* extracted from the SMB2 header */
308 enum smb_sesssetup_level
{
311 RAW_SESSSETUP_SPNEGO
,
315 /* union used in session_setup call */
316 union smb_sesssetup
{
317 /* the pre-NT1 interface */
319 enum smb_sesssetup_level level
;
341 /* the NT1 interface */
343 enum smb_sesssetup_level level
;
350 uint32_t capabilities
;
368 /* the SPNEGO interface */
370 enum smb_sesssetup_level level
;
377 uint32_t capabilities
;
381 const char *workgroup
;
393 /* SMB2 SessionSetup */
394 struct smb2_session_setup
{
395 enum smb_sesssetup_level level
;
398 /* static body 24 (0x18) bytes */
400 uint8_t security_mode
;
401 uint32_t capabilities
;
403 /* uint16_t secblob_ofs */
404 /* uint16_t secblob_size */
405 uint64_t previous_sessionid
;
410 /* body buffer 8 (0x08) bytes */
411 uint16_t session_flags
;
412 /* uint16_t secblob_ofs */
413 /* uint16_t secblob_size */
417 /* extracted from the SMB2 header */
423 /* Note that the specified enum values are identical to the actual info-levels used
426 enum smb_fileinfo_level
{
427 RAW_FILEINFO_GENERIC
= 0xF000,
428 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
429 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
430 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
431 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
432 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
433 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
434 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
435 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
436 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
437 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
438 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
439 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
440 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
441 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
442 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
443 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
444 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
445 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
446 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
447 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
448 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
449 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
450 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
451 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
452 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
453 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
454 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
455 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
456 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
457 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
458 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
459 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
460 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
461 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
462 /* SMB2 specific levels */
463 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
464 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
467 /* union used in qfileinfo() and qpathinfo() backend calls */
469 /* generic interface:
470 * matches RAW_FILEINFO_GENERIC */
472 enum smb_fileinfo_level level
;
474 union smb_handle_or_path file
;
479 unsigned int num_eas
;
482 struct smb_wire_string name
;
492 struct smb_wire_string fname
;
493 struct smb_wire_string alt_fname
;
494 uint8_t delete_pending
;
496 uint64_t compressed_size
;
500 uint8_t cluster_shift
;
502 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
505 uint32_t alignment_requirement
;
506 uint32_t reparse_tag
;
507 unsigned int num_streams
;
508 struct stream_struct
{
511 struct smb_wire_string stream_name
;
517 /* SMBgetatr interface:
518 * matches RAW_FILEINFO_GETATTR */
520 enum smb_fileinfo_level level
;
522 union smb_handle_or_path file
;
531 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
533 enum smb_fileinfo_level level
;
535 union smb_handle_or_path file
;
545 } getattre
, standard
;
547 /* trans2 RAW_FILEINFO_EA_SIZE interface */
549 enum smb_fileinfo_level level
;
551 union smb_handle_or_path file
;
564 /* trans2 RAW_FILEINFO_EA_LIST interface */
566 enum smb_fileinfo_level level
;
568 union smb_handle_or_path file
;
569 unsigned int num_names
;
571 struct smb_wire_string name
;
576 unsigned int num_eas
;
577 struct ea_struct
*eas
;
581 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
583 enum smb_fileinfo_level level
;
585 union smb_handle_or_path file
;
586 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
587 uint8_t continue_flags
;
589 struct smb_ea_list out
;
592 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
593 only valid for a QPATHNAME call - no returned data */
595 enum smb_fileinfo_level level
;
597 union smb_handle_or_path file
;
601 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
603 enum smb_fileinfo_level level
;
605 union smb_handle_or_path file
;
617 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
619 enum smb_fileinfo_level level
;
621 union smb_handle_or_path file
;
632 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
634 enum smb_fileinfo_level level
;
636 union smb_handle_or_path file
;
643 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
645 enum smb_fileinfo_level level
;
647 union smb_handle_or_path file
;
650 struct smb_wire_string fname
;
654 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
656 enum smb_fileinfo_level level
;
658 union smb_handle_or_path file
;
669 uint8_t delete_pending
;
672 struct smb_wire_string fname
;
676 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
678 enum smb_fileinfo_level level
;
680 union smb_handle_or_path file
;
692 uint8_t delete_pending
;
697 uint32_t access_mask
;
700 uint32_t alignment_requirement
;
701 struct smb_wire_string fname
;
705 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
707 enum smb_fileinfo_level level
;
709 union smb_handle_or_path file
;
712 struct smb_wire_string fname
;
716 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
718 enum smb_fileinfo_level level
;
720 union smb_handle_or_path file
;
722 struct stream_information
{
723 unsigned int num_streams
;
724 struct stream_struct
*streams
;
728 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
730 enum smb_fileinfo_level level
;
732 union smb_handle_or_path file
;
735 uint64_t compressed_size
;
739 uint8_t cluster_shift
;
743 /* RAW_FILEINFO_UNIX_BASIC interface */
745 enum smb_fileinfo_level level
;
747 union smb_handle_or_path file
;
750 uint64_t end_of_file
;
752 NTTIME status_change_time
;
761 uint64_t permissions
;
766 /* RAW_FILEINFO_UNIX_INFO2 interface */
768 enum smb_fileinfo_level level
;
770 union smb_handle_or_path file
;
773 uint64_t end_of_file
;
775 NTTIME status_change_time
;
784 uint64_t permissions
;
792 /* RAW_FILEINFO_UNIX_LINK interface */
794 enum smb_fileinfo_level level
;
796 union smb_handle_or_path file
;
799 struct smb_wire_string link_dest
;
803 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
805 enum smb_fileinfo_level level
;
807 union smb_handle_or_path file
;
812 } internal_information
;
814 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
816 enum smb_fileinfo_level level
;
818 union smb_handle_or_path file
;
821 uint32_t access_flags
;
823 } access_information
;
825 /* RAW_FILEINFO_POSITION_INFORMATION interface */
827 enum smb_fileinfo_level level
;
829 union smb_handle_or_path file
;
834 } position_information
;
836 /* RAW_FILEINFO_MODE_INFORMATION interface */
838 enum smb_fileinfo_level level
;
840 union smb_handle_or_path file
;
847 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
849 enum smb_fileinfo_level level
;
851 union smb_handle_or_path file
;
854 uint32_t alignment_requirement
;
856 } alignment_information
;
858 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
860 enum smb_fileinfo_level level
;
862 union smb_handle_or_path file
;
873 } network_open_information
;
876 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
878 enum smb_fileinfo_level level
;
880 union smb_handle_or_path file
;
884 uint32_t reparse_tag
;
886 } attribute_tag_information
;
888 /* RAW_FILEINFO_SEC_DESC */
890 enum smb_fileinfo_level level
;
892 union smb_handle_or_path file
;
893 uint32_t secinfo_flags
;
896 struct security_descriptor
*sd
;
902 enum smb_setfileinfo_level
{
903 RAW_SFILEINFO_GENERIC
= 0xF000,
904 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
905 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
906 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
907 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
908 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
909 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
910 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
911 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
912 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
913 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
914 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
915 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
916 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
917 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
918 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
919 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
920 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
921 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
922 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
923 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
924 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
925 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
926 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
927 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
928 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
929 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
930 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
931 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
932 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
933 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
934 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
935 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
936 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
937 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
938 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
939 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
941 /* cope with breakage in SMB2 */
942 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
945 /* union used in setfileinfo() and setpathinfo() calls */
946 union smb_setfileinfo
{
947 /* generic interface */
949 enum smb_setfileinfo_level level
;
951 union smb_handle_or_path file
;
955 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
957 enum smb_setfileinfo_level level
;
959 union smb_handle_or_path file
;
965 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
966 also RAW_SFILEINFO_STANDARD */
968 enum smb_setfileinfo_level level
;
970 union smb_handle_or_path file
;
974 /* notice that size, alloc_size and attrib are not settable,
975 unlike the corresponding qfileinfo level */
977 } setattre
, standard
;
979 /* RAW_SFILEINFO_EA_SET interface */
981 enum smb_setfileinfo_level level
;
983 union smb_handle_or_path file
;
984 unsigned int num_eas
;
985 struct ea_struct
*eas
;
989 /* RAW_SFILEINFO_BASIC_INFO and
990 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
992 enum smb_setfileinfo_level level
;
994 union smb_handle_or_path file
;
1004 /* RAW_SFILEINFO_DISPOSITION_INFO and
1005 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1007 enum smb_setfileinfo_level level
;
1009 union smb_handle_or_path file
;
1010 bool delete_on_close
;
1014 /* RAW_SFILEINFO_ALLOCATION_INFO and
1015 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1017 enum smb_setfileinfo_level level
;
1019 union smb_handle_or_path file
;
1020 /* w2k3 rounds this up to nearest 4096 */
1021 uint64_t alloc_size
;
1025 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1026 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1028 enum smb_setfileinfo_level level
;
1030 union smb_handle_or_path file
;
1035 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1037 enum smb_setfileinfo_level level
;
1039 union smb_handle_or_path file
;
1042 const char *new_name
;
1044 } rename_information
;
1046 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1048 enum smb_setfileinfo_level level
;
1050 union smb_handle_or_path file
;
1053 const char *new_name
;
1057 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1059 enum smb_setfileinfo_level level
;
1061 union smb_handle_or_path file
;
1064 } position_information
;
1066 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1068 enum smb_setfileinfo_level level
;
1070 union smb_handle_or_path file
;
1071 /* valid values seem to be 0, 2, 4 and 6 */
1076 /* RAW_SFILEINFO_UNIX_BASIC interface */
1078 enum smb_setfileinfo_level level
;
1080 union smb_handle_or_path file
;
1081 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1082 uint64_t end_of_file
;
1084 NTTIME status_change_time
;
1093 uint64_t permissions
;
1098 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1100 enum smb_setfileinfo_level level
;
1102 union smb_handle_or_path file
;
1103 uint64_t end_of_file
;
1105 NTTIME status_change_time
;
1114 uint64_t permissions
;
1117 uint32_t file_flags
;
1118 uint32_t flags_mask
;
1122 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1124 enum smb_setfileinfo_level level
;
1126 union smb_handle_or_path file
;
1127 const char *link_dest
;
1129 } unix_link
, unix_hlink
;
1131 /* RAW_SFILEINFO_SEC_DESC */
1133 enum smb_setfileinfo_level level
;
1135 union smb_handle_or_path file
;
1136 uint32_t secinfo_flags
;
1137 struct security_descriptor
*sd
;
1141 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1143 enum smb_setfileinfo_level level
;
1145 union smb_handle_or_path file
;
1146 struct smb_ea_list eas
;
1148 } full_ea_information
;
1152 enum smb_fsinfo_level
{
1153 RAW_QFS_GENERIC
= 0xF000,
1154 RAW_QFS_DSKATTR
, /* SMBdskattr */
1155 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1156 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1157 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1158 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1159 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1160 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1161 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1162 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1163 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1164 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1165 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1166 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1167 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1168 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
};
1171 /* union for fsinfo() backend call. Note that there are no in
1172 structures, as this call only contains out parameters */
1174 /* generic interface */
1176 enum smb_fsinfo_level level
;
1177 struct smb2_handle handle
; /* only for smb2 */
1180 uint32_t block_size
;
1181 uint64_t blocks_total
;
1182 uint64_t blocks_free
;
1185 uint32_t serial_number
;
1187 uint32_t max_file_component_length
;
1188 uint32_t device_type
;
1189 uint32_t device_characteristics
;
1190 uint64_t quota_soft
;
1191 uint64_t quota_hard
;
1192 uint64_t quota_flags
;
1199 /* SMBdskattr interface */
1201 enum smb_fsinfo_level level
;
1204 uint16_t units_total
;
1205 uint16_t blocks_per_unit
;
1206 uint16_t block_size
;
1207 uint16_t units_free
;
1211 /* trans2 RAW_QFS_ALLOCATION interface */
1213 enum smb_fsinfo_level level
;
1217 uint32_t sectors_per_unit
;
1218 uint32_t total_alloc_units
;
1219 uint32_t avail_alloc_units
;
1220 uint16_t bytes_per_sector
;
1224 /* TRANS2 RAW_QFS_VOLUME interface */
1226 enum smb_fsinfo_level level
;
1229 uint32_t serial_number
;
1230 struct smb_wire_string volume_name
;
1234 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1236 enum smb_fsinfo_level level
;
1237 struct smb2_handle handle
; /* only for smb2 */
1241 uint32_t serial_number
;
1242 struct smb_wire_string volume_name
;
1246 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1248 enum smb_fsinfo_level level
;
1249 struct smb2_handle handle
; /* only for smb2 */
1252 uint64_t total_alloc_units
;
1253 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1254 uint32_t sectors_per_unit
;
1255 uint32_t bytes_per_sector
;
1259 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1261 enum smb_fsinfo_level level
;
1262 struct smb2_handle handle
; /* only for smb2 */
1265 uint32_t device_type
;
1266 uint32_t characteristics
;
1271 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1273 enum smb_fsinfo_level level
;
1274 struct smb2_handle handle
; /* only for smb2 */
1278 uint32_t max_file_component_length
;
1279 struct smb_wire_string fs_type
;
1284 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1286 enum smb_fsinfo_level level
;
1289 uint16_t major_version
;
1290 uint16_t minor_version
;
1291 uint64_t capability
;
1295 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1297 enum smb_fsinfo_level level
;
1298 struct smb2_handle handle
; /* only for smb2 */
1301 uint64_t unknown
[3];
1302 uint64_t quota_soft
;
1303 uint64_t quota_hard
;
1304 uint64_t quota_flags
;
1306 } quota_information
;
1308 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1310 enum smb_fsinfo_level level
;
1311 struct smb2_handle handle
; /* only for smb2 */
1314 uint64_t total_alloc_units
;
1315 uint64_t call_avail_alloc_units
;
1316 uint64_t actual_avail_alloc_units
;
1317 uint32_t sectors_per_unit
;
1318 uint32_t bytes_per_sector
;
1320 } full_size_information
;
1322 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1324 enum smb_fsinfo_level level
;
1325 struct smb2_handle handle
; /* only for smb2 */
1329 uint64_t unknown
[6];
1331 } objectid_information
;
1335 enum smb_setfsinfo_level
{
1336 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1338 union smb_setfsinfo
{
1339 /* generic interface */
1341 enum smb_fsinfo_level level
;
1344 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1346 enum smb_fsinfo_level level
;
1349 uint16_t major_version
;
1350 uint16_t minor_version
;
1351 uint64_t capability
;
1356 enum smb_open_level
{
1365 RAW_OPEN_NTTRANS_CREATE
,
1366 RAW_OPEN_OPENX_READX
,
1367 RAW_OPEN_NTCREATEX_READX
,
1371 /* the generic interface is defined to be equal to the NTCREATEX interface */
1372 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1374 /* union for open() backend call */
1377 * because the *.out.file structs are not aligned to the same offset for each level
1378 * we provide a hepler macro that should be used to find the current smb_handle structure
1380 #define SMB_OPEN_OUT_FILE(op, file) do { \
1381 switch (op->generic.level) { \
1382 case RAW_OPEN_OPEN: \
1383 file = &op->openold.out.file; \
1385 case RAW_OPEN_OPENX: \
1386 file = &op->openx.out.file; \
1388 case RAW_OPEN_MKNEW: \
1389 file = &op->mknew.out.file; \
1391 case RAW_OPEN_CREATE: \
1392 file = &op->create.out.file; \
1394 case RAW_OPEN_CTEMP: \
1395 file = &op->ctemp.out.file; \
1397 case RAW_OPEN_SPLOPEN: \
1398 file = &op->splopen.out.file; \
1400 case RAW_OPEN_NTCREATEX: \
1401 file = &op->ntcreatex.out.file; \
1403 case RAW_OPEN_T2OPEN: \
1404 file = &op->t2open.out.file; \
1406 case RAW_OPEN_NTTRANS_CREATE: \
1407 file = &op->nttrans.out.file; \
1409 case RAW_OPEN_OPENX_READX: \
1410 file = &op->openxreadx.out.file; \
1412 case RAW_OPEN_NTCREATEX_READX: \
1413 file = &op->ntcreatexreadx.out.file; \
1415 case RAW_OPEN_SMB2: \
1416 file = &op->smb2.out.file; \
1419 /* this must be a programmer error */ \
1424 /* SMBNTCreateX, nttrans and generic interface */
1426 enum smb_open_level level
;
1429 union smb_handle root_fid
;
1430 uint32_t access_mask
;
1431 uint64_t alloc_size
;
1433 uint32_t share_access
;
1434 uint32_t open_disposition
;
1435 uint32_t create_options
;
1436 uint32_t impersonation
;
1437 uint8_t security_flags
;
1438 /* NOTE: fname can also be a pointer to a
1439 uint64_t file_id if create_options has the
1440 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1443 /* these last 2 elements are only used in the
1444 NTTRANS varient of the call */
1445 struct security_descriptor
*sec_desc
;
1446 struct smb_ea_list
*ea_list
;
1448 /* some optional parameters from the SMB2 varient */
1449 bool query_maximal_access
;
1451 /* private flags for internal use only */
1452 uint8_t private_flags
;
1455 union smb_handle file
;
1456 uint8_t oplock_level
;
1457 uint32_t create_action
;
1463 uint64_t alloc_size
;
1467 uint8_t is_directory
;
1469 /* optional return values matching SMB2 tagged
1470 values in the call */
1471 uint32_t maximal_access
;
1473 } ntcreatex
, nttrans
, generic
;
1475 /* TRANS2_OPEN interface */
1477 enum smb_open_level level
;
1481 uint16_t search_attrs
;
1482 uint16_t file_attrs
;
1488 unsigned int num_eas
;
1489 struct ea_struct
*eas
;
1492 union smb_handle file
;
1504 /* SMBopen interface */
1506 enum smb_open_level level
;
1509 uint16_t search_attrs
;
1513 union smb_handle file
;
1521 /* SMBopenX interface */
1523 enum smb_open_level level
;
1527 uint16_t search_attrs
; /* not honoured by win2003 */
1528 uint16_t file_attrs
;
1529 time_t write_time
; /* not honoured by win2003 */
1531 uint32_t size
; /* note that this sets the
1532 initial file size, not
1533 just allocation size */
1534 uint32_t timeout
; /* not honoured by win2003 */
1538 union smb_handle file
;
1546 uint32_t unique_fid
;
1547 uint32_t access_mask
;
1552 /* SMBmknew interface */
1554 enum smb_open_level level
;
1561 union smb_handle file
;
1565 /* SMBctemp interface */
1567 enum smb_open_level level
;
1571 const char *directory
;
1574 union smb_handle file
;
1575 /* temp name, relative to directory */
1580 /* SMBsplopen interface */
1582 enum smb_open_level level
;
1584 uint16_t setup_length
;
1589 union smb_handle file
;
1594 /* chained OpenX/ReadX interface */
1596 enum smb_open_level level
;
1600 uint16_t search_attrs
; /* not honoured by win2003 */
1601 uint16_t file_attrs
;
1602 time_t write_time
; /* not honoured by win2003 */
1604 uint32_t size
; /* note that this sets the
1605 initial file size, not
1606 just allocation size */
1607 uint32_t timeout
; /* not honoured by win2003 */
1617 union smb_handle file
;
1625 uint32_t unique_fid
;
1626 uint32_t access_mask
;
1632 uint16_t compaction_mode
;
1637 /* chained NTCreateX/ReadX interface */
1639 enum smb_open_level level
;
1642 union smb_handle root_fid
;
1643 uint32_t access_mask
;
1644 uint64_t alloc_size
;
1646 uint32_t share_access
;
1647 uint32_t open_disposition
;
1648 uint32_t create_options
;
1649 uint32_t impersonation
;
1650 uint8_t security_flags
;
1651 /* NOTE: fname can also be a pointer to a
1652 uint64_t file_id if create_options has the
1653 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1663 union smb_handle file
;
1664 uint8_t oplock_level
;
1665 uint32_t create_action
;
1671 uint64_t alloc_size
;
1675 uint8_t is_directory
;
1680 uint16_t compaction_mode
;
1685 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1686 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1687 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1688 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1691 struct smb2_create
{
1692 enum smb_open_level level
;
1694 /* static body buffer 56 (0x38) bytes */
1695 uint8_t security_flags
; /* SMB2_SECURITY_* */
1696 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1697 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1698 uint64_t create_flags
;
1700 uint32_t desired_access
;
1701 uint32_t file_attributes
;
1702 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1703 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1704 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1706 /* uint16_t fname_ofs */
1707 /* uint16_t fname_size */
1708 /* uint32_t blob_ofs; */
1709 /* uint32_t blob_size; */
1714 /* now some optional parameters - encoded as tagged blobs */
1715 struct smb_ea_list eas
;
1716 uint64_t alloc_size
;
1717 struct security_descriptor
*sec_desc
;
1719 struct smb2_handle
*durable_handle
;
1721 /* data for durable handle v2 */
1722 bool durable_open_v2
;
1723 struct GUID create_guid
;
1724 bool persistent_open
;
1726 struct smb2_handle
*durable_handle_v2
;
1728 bool query_maximal_access
;
1730 bool query_on_disk_id
;
1731 struct smb2_lease
*lease_request
;
1732 struct smb2_lease
*lease_request_v2
;
1734 struct GUID
*app_instance_id
;
1736 /* and any additional blobs the caller wants */
1737 struct smb2_create_blobs blobs
;
1740 union smb_handle file
;
1742 /* static body buffer 88 (0x58) bytes */
1743 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1744 uint8_t oplock_level
;
1746 uint32_t create_action
;
1751 uint64_t alloc_size
;
1755 /* struct smb2_handle handle;*/
1756 /* uint32_t blob_ofs; */
1757 /* uint32_t blob_size; */
1759 /* optional return values matching tagged values in the call */
1760 uint32_t maximal_access
;
1761 uint8_t on_disk_id
[32];
1762 struct smb2_lease lease_response
;
1763 struct smb2_lease lease_response_v2
;
1766 /* durable handle v2 */
1767 bool durable_open_v2
;
1768 bool persistent_open
;
1771 /* tagged blobs in the reply */
1772 struct smb2_create_blobs blobs
;
1779 enum smb_read_level
{
1787 #define RAW_READ_GENERIC RAW_READ_READX
1789 /* union for read() backend call
1791 note that .infoX.out.data will be allocated before the backend is
1792 called. It will be big enough to hold the maximum size asked for
1795 /* SMBreadX (and generic) interface */
1797 enum smb_read_level level
;
1799 union smb_handle file
;
1801 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1804 bool read_for_execute
;
1809 uint16_t compaction_mode
;
1814 /* SMBreadbraw interface */
1816 enum smb_read_level level
;
1818 union smb_handle file
;
1831 /* SMBlockandread interface */
1833 enum smb_read_level level
;
1835 union smb_handle file
;
1846 /* SMBread interface */
1848 enum smb_read_level level
;
1850 union smb_handle file
;
1863 enum smb_read_level level
;
1865 union smb_handle file
;
1867 /* static body buffer 48 (0x30) bytes */
1868 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1873 /* struct smb2_handle handle; */
1877 /* the docs give no indication of what
1878 these channel variables are for */
1879 uint16_t channel_offset
;
1880 uint16_t channel_length
;
1883 /* static body buffer 16 (0x10) bytes */
1884 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1885 /* uint8_t data_ofs; */
1886 /* uint8_t reserved; */
1887 /* uint32_t data_size; */
1898 enum smb_write_level
{
1899 RAW_WRITE_WRITEUNLOCK
,
1902 RAW_WRITE_WRITECLOSE
,
1907 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1909 /* union for write() backend call
1912 /* SMBwriteX interface */
1914 enum smb_write_level level
;
1916 union smb_handle file
;
1921 const uint8_t *data
;
1929 /* SMBwriteunlock interface */
1931 enum smb_write_level level
;
1933 union smb_handle file
;
1937 const uint8_t *data
;
1944 /* SMBwrite interface */
1946 enum smb_write_level level
;
1948 union smb_handle file
;
1952 const uint8_t *data
;
1959 /* SMBwriteclose interface */
1961 enum smb_write_level level
;
1963 union smb_handle file
;
1967 const uint8_t *data
;
1974 /* SMBsplwrite interface */
1976 enum smb_write_level level
;
1978 union smb_handle file
;
1980 const uint8_t *data
;
1986 enum smb_write_level level
;
1988 union smb_handle file
;
1990 /* static body buffer 48 (0x30) bytes */
1991 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1992 /* uint16_t data_ofs; */
1993 /* uint32_t data_size; */
1995 /* struct smb2_handle handle; */
1996 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
1997 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2003 /* static body buffer 17 (0x11) bytes */
2004 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2007 uint64_t unknown1
; /* 0x0000000000000000 */
2013 enum smb_lock_level
{
2021 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2023 /* union for lock() backend call
2026 /* SMBlockingX and generic interface */
2028 enum smb_lock_level level
;
2030 union smb_handle file
;
2035 struct smb_lock_entry
{
2036 uint32_t pid
; /* 16 bits in SMB1 */
2039 } *locks
; /* unlocks are first in the arrray */
2043 /* SMBlock and SMBunlock interface */
2045 enum smb_lock_level level
;
2047 union smb_handle file
;
2055 enum smb_lock_level level
;
2057 union smb_handle file
;
2059 /* static body buffer 48 (0x30) bytes */
2060 /* uint16_t buffer_code; 0x30 */
2061 uint16_t lock_count
;
2062 uint32_t lock_sequence
;
2063 /* struct smb2_handle handle; */
2064 struct smb2_lock_element
{
2072 /* static body buffer 4 (0x04) bytes */
2073 /* uint16_t buffer_code; 0x04 */
2080 enum smb_lock_level level
;
2082 union smb_handle file
;
2084 /* static body buffer 24 (0x18) bytes */
2085 uint8_t oplock_level
;
2088 /* struct smb2_handle handle; */
2092 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2093 struct smb2_lease_break_ack
{
2096 struct smb2_lease lease
;
2098 } smb2_lease_break_ack
;
2102 enum smb_close_level
{
2110 union for close() backend call
2113 /* generic interface */
2115 enum smb_close_level level
;
2117 union smb_handle file
;
2119 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2127 uint64_t alloc_size
;
2133 /* SMBclose interface */
2135 enum smb_close_level level
;
2137 union smb_handle file
;
2142 /* SMBsplclose interface - empty! */
2144 enum smb_close_level level
;
2146 union smb_handle file
;
2152 enum smb_close_level level
;
2154 union smb_handle file
;
2156 /* static body buffer 24 (0x18) bytes */
2157 /* uint16_t buffer_code; 0x18 */
2158 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2162 /* static body buffer 60 (0x3C) bytes */
2163 /* uint16_t buffer_code; 0x3C */
2170 uint64_t alloc_size
;
2178 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2181 union for lpq() backend
2184 /* generic interface */
2186 enum smb_lpq_level level
;
2191 /* SMBsplretq interface */
2193 enum smb_lpq_level level
;
2201 uint16_t restart_idx
;
2213 enum smb_ioctl_level
{
2217 RAW_IOCTL_SMB2_NO_HANDLE
2221 union for ioctl() backend
2224 /* generic interface */
2226 enum smb_ioctl_level level
;
2228 union smb_handle file
;
2232 /* struct for SMBioctl */
2234 enum smb_ioctl_level level
;
2236 union smb_handle file
;
2245 /* struct for NT ioctl call */
2247 enum smb_ioctl_level level
;
2249 union smb_handle file
;
2263 enum smb_ioctl_level level
;
2265 union smb_handle file
;
2267 /* static body buffer 56 (0x38) bytes */
2268 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2271 /*struct smb2_handle handle;*/
2272 /* uint32_t out_ofs; */
2273 /* uint32_t out_size; */
2275 /* uint32_t in_ofs; */
2276 /* uint32_t in_size; */
2277 uint32_t max_response_size
;
2285 union smb_handle file
;
2287 /* static body buffer 48 (0x30) bytes */
2288 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2291 /* struct smb2_handle handle; */
2292 /* uint32_t in_ofs; */
2293 /* uint32_t in_size; */
2294 /* uint32_t out_ofs; */
2295 /* uint32_t out_size; */
2306 enum smb_flush_level
{
2313 /* struct for SMBflush */
2315 enum smb_flush_level level
;
2317 union smb_handle file
;
2321 /* SMBflush with 0xFFFF wildcard fnum */
2323 enum smb_flush_level level
;
2328 enum smb_flush_level level
;
2330 union smb_handle file
;
2340 /* struct for SMBcopy */
2355 /* struct for transact/transact2 call */
2363 uint8_t setup_count
;
2365 const char *trans_name
; /* SMBtrans only */
2371 uint8_t setup_count
;
2378 /* struct for nttransact2 call */
2379 struct smb_nttrans
{
2384 uint8_t setup_count
;
2392 uint8_t setup_count
; /* in units of 16 bit words */
2399 enum smb_notify_level
{
2405 /* struct for nttrans change notify call */
2407 enum smb_notify_level level
;
2410 union smb_handle file
;
2411 uint32_t buffer_size
;
2412 uint32_t completion_filter
;
2417 uint32_t num_changes
;
2418 struct notify_changes
{
2420 struct smb_wire_string name
;
2425 struct smb2_notify
{
2426 enum smb_notify_level level
;
2429 union smb_handle file
;
2430 /* static body buffer 32 (0x20) bytes */
2431 /* uint16_t buffer_code; 0x32 */
2433 uint32_t buffer_size
;
2434 /*struct smb2_handle file;*/
2435 uint32_t completion_filter
;
2440 /* static body buffer 8 (0x08) bytes */
2441 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2442 /* uint16_t blob_ofs; */
2443 /* uint16_t blob_size; */
2448 /* DATA_BLOB content */
2449 uint32_t num_changes
;
2450 struct notify_changes
*changes
;
2455 enum smb_search_level
{
2456 RAW_SEARCH_SEARCH
, /* SMBsearch */
2457 RAW_SEARCH_FFIRST
, /* SMBffirst */
2458 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2459 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2460 RAW_SEARCH_SMB2
/* SMB2 Find */
2463 enum smb_search_data_level
{
2464 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2465 RAW_SEARCH_DATA_SEARCH
,
2466 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2467 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2468 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2469 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2470 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2471 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2472 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2473 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2474 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2475 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2476 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2479 /* union for file search */
2480 union smb_search_first
{
2482 enum smb_search_level level
;
2483 enum smb_search_data_level data_level
;
2486 /* search (old) findfirst interface.
2487 Also used for ffirst and funique. */
2489 enum smb_search_level level
;
2490 enum smb_search_data_level data_level
;
2494 uint16_t search_attrib
;
2495 const char *pattern
;
2502 /* trans2 findfirst interface */
2504 enum smb_search_level level
;
2505 enum smb_search_data_level data_level
;
2508 uint16_t search_attrib
;
2511 uint32_t storage_type
;
2512 const char *pattern
;
2514 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2515 unsigned int num_names
;
2516 struct ea_name
*ea_names
;
2521 uint16_t end_of_search
;
2527 enum smb_search_level level
;
2528 enum smb_search_data_level data_level
;
2530 union smb_handle file
;
2532 /* static body buffer 32 (0x20) bytes */
2533 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2535 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2536 uint32_t file_index
;
2537 /* struct smb2_handle handle; */
2538 /* uint16_t pattern_ofs; */
2539 /* uint16_t pattern_size; */
2540 uint32_t max_response_size
;
2543 const char *pattern
;
2546 /* static body buffer 8 (0x08) bytes */
2547 /* uint16_t buffer_code; 0x08 */
2548 /* uint16_t blob_ofs; */
2549 /* uint32_t blob_size; */
2557 /* union for file search continue */
2558 union smb_search_next
{
2560 enum smb_search_level level
;
2561 enum smb_search_data_level data_level
;
2564 /* search (old) findnext interface. Also used
2565 for ffirst when continuing */
2567 enum smb_search_level level
;
2568 enum smb_search_data_level data_level
;
2572 uint16_t search_attrib
;
2573 struct smb_search_id
{
2577 uint32_t server_cookie
;
2578 uint32_t client_cookie
;
2586 /* trans2 findnext interface */
2588 enum smb_search_level level
;
2589 enum smb_search_data_level data_level
;
2594 uint32_t resume_key
;
2596 const char *last_name
;
2598 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2599 unsigned int num_names
;
2600 struct ea_name
*ea_names
;
2604 uint16_t end_of_search
;
2609 struct smb2_find smb2
;
2612 /* union for search reply file data */
2613 union smb_search_data
{
2615 * search (old) findfirst
2616 * RAW_SEARCH_DATA_SEARCH
2622 struct smb_search_id id
;
2626 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2628 uint32_t resume_key
;
2633 uint32_t alloc_size
;
2635 struct smb_wire_string name
;
2638 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2640 uint32_t resume_key
;
2645 uint32_t alloc_size
;
2648 struct smb_wire_string name
;
2651 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2653 uint32_t resume_key
;
2658 uint32_t alloc_size
;
2660 struct smb_ea_list eas
;
2661 struct smb_wire_string name
;
2664 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2666 uint32_t file_index
;
2672 uint64_t alloc_size
;
2674 struct smb_wire_string name
;
2677 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2679 uint32_t file_index
;
2685 uint64_t alloc_size
;
2688 struct smb_wire_string name
;
2689 } full_directory_info
;
2691 /* RAW_SEARCH_DATA_NAME_INFO interface */
2693 uint32_t file_index
;
2694 struct smb_wire_string name
;
2697 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2699 uint32_t file_index
;
2705 uint64_t alloc_size
;
2708 struct smb_wire_string short_name
;
2709 struct smb_wire_string name
;
2710 } both_directory_info
;
2712 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2714 uint32_t file_index
;
2720 uint64_t alloc_size
;
2724 struct smb_wire_string name
;
2725 } id_full_directory_info
;
2727 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2729 uint32_t file_index
;
2735 uint64_t alloc_size
;
2739 struct smb_wire_string short_name
;
2740 struct smb_wire_string name
;
2741 } id_both_directory_info
;
2743 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2745 uint32_t file_index
;
2747 uint64_t alloc_size
;
2748 NTTIME status_change_time
;
2757 uint64_t permissions
;
2762 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2764 uint32_t file_index
;
2765 uint64_t end_of_file
;
2767 NTTIME status_change_time
;
2776 uint64_t permissions
;
2779 uint32_t file_flags
;
2780 uint32_t flags_mask
;
2781 struct smb_wire_string name
;
2785 /* Callback function passed to the raw search interface. */
2786 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2788 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2790 /* union for file search close */
2791 union smb_search_close
{
2793 enum smb_search_close_level level
;
2796 /* SMBfclose (old search) interface */
2798 enum smb_search_close_level level
;
2801 /* max_count and search_attrib are not used, but are present */
2803 uint16_t search_attrib
;
2804 struct smb_search_id id
;
2808 /* SMBfindclose interface */
2810 enum smb_search_close_level level
;
2820 struct for SMBecho call
2824 uint16_t repeat_count
;
2830 uint16_t sequence_number
;
2837 struct for shadow copy volumes
2839 struct smb_shadow_copy
{
2841 union smb_handle file
;
2845 uint32_t num_volumes
;
2851 #endif /* __LIBCLI_RAW_INTERFACES_H__ */