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 */
28 #include "librpc/gen_ndr/smb2_lease_struct.h"
30 /* this structure is just a wrapper for a string, the only reason we
31 bother with this is that it allows us to check the length provided
32 on the wire in testsuite test code to ensure that we are
33 terminating names in the same way that win2003 is. The *ONLY* time
34 you should ever look at the 'private_length' field in this
35 structure is inside compliance test code, in all other cases just
36 use the null terminated char* as the definitive definition of the
39 also note that this structure is only used in packets where there
40 is an explicit length provided on the wire (hence the name). That
41 length is placed in 'private_length'. For packets where the length
42 is always determined by NULL or packet termination a normal char*
43 is used in the structure definition.
45 struct smb_wire_string
{
46 uint32_t private_length
;
51 * SMB2 uses a 16Byte handle,
52 * (we can maybe use struct GUID later)
58 struct smb2_lease_break
{
59 struct smb2_lease current_lease
;
60 uint16_t new_epoch
; /* only for v2 leases */
62 uint32_t new_lease_state
;
63 uint32_t break_reason
; /* should be 0 */
64 uint32_t access_mask_hint
; /* should be 0 */
65 uint32_t share_mask_hint
; /* should be 0 */
71 * a generic container for file handles or file pathes
72 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
74 union smb_handle_or_path
{
77 * the qpathinfo and setpathinfo
82 * this is used as file handle in SMB
87 * this is used as file handle in SMB2
89 struct smb2_handle handle
;
92 * this is used as generic file handle for the NTVFS layer
94 struct ntvfs_handle
*ntvfs
;
98 a generic container for file handles
102 * this is used as file handle in SMB
107 * this is used as file handle in SMB2
109 struct smb2_handle handle
;
112 * this is used as generic file handle for the NTVFS layer
114 struct ntvfs_handle
*ntvfs
;
118 this header defines the structures and unions used between the SMB
119 parser and the backends.
122 /* struct used for SMBlseek call */
126 union smb_handle file
;
128 int32_t offset
; /* signed */
136 /* struct used in unlink() call */
147 /* struct used in chkpath() call */
156 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
158 /* union used in mkdir() call */
162 enum smb_mkdir_level level
;
166 enum smb_mkdir_level level
;
173 enum smb_mkdir_level level
;
176 unsigned int num_eas
;
177 struct ea_struct
*eas
;
182 /* struct used in rmdir() call */
189 /* struct used in rename() call */
190 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
194 enum smb_rename_level level
;
197 /* SMBrename interface */
199 enum smb_rename_level level
;
202 const char *pattern1
;
203 const char *pattern2
;
209 /* SMBntrename interface */
211 enum smb_rename_level level
;
215 uint16_t flags
; /* see RENAME_FLAG_* */
216 uint32_t cluster_size
;
217 const char *old_name
;
218 const char *new_name
;
222 /* NT TRANS rename interface */
224 enum smb_rename_level level
;
227 union smb_handle file
;
228 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
229 const char *new_name
;
234 enum smb_tcon_level
{
240 /* union used in tree connect call */
242 /* generic interface */
244 enum smb_tcon_level level
;
247 /* SMBtcon interface */
249 enum smb_tcon_level level
;
253 const char *password
;
262 /* SMBtconX interface */
264 enum smb_tcon_level level
;
275 uint32_t guest_max_access
;
282 /* SMB2 TreeConnect */
283 struct smb2_tree_connect
{
284 enum smb_tcon_level level
;
287 /* static body buffer 8 (0x08) bytes */
289 /* uint16_t path_ofs */
290 /* uint16_t path_size */
292 const char *path
; /* as non-terminated UTF-16 on the wire */
295 /* static body buffer 16 (0x10) bytes */
296 /* uint16_t buffer_code; 0x10 */
300 uint32_t capabilities
;
301 uint32_t access_mask
;
303 /* extracted from the SMB2 header */
310 enum smb_sesssetup_level
{
313 RAW_SESSSETUP_SPNEGO
,
317 /* union used in session_setup call */
318 union smb_sesssetup
{
319 /* the pre-NT1 interface */
321 enum smb_sesssetup_level level
;
343 /* the NT1 interface */
345 enum smb_sesssetup_level level
;
352 uint32_t capabilities
;
370 /* the SPNEGO interface */
372 enum smb_sesssetup_level level
;
379 uint32_t capabilities
;
383 const char *workgroup
;
395 /* SMB2 SessionSetup */
396 struct smb2_session_setup
{
397 enum smb_sesssetup_level level
;
400 /* static body 24 (0x18) bytes */
402 uint8_t security_mode
;
403 uint32_t capabilities
;
405 /* uint16_t secblob_ofs */
406 /* uint16_t secblob_size */
407 uint64_t previous_sessionid
;
412 /* body buffer 8 (0x08) bytes */
413 uint16_t session_flags
;
414 /* uint16_t secblob_ofs */
415 /* uint16_t secblob_size */
419 /* extracted from the SMB2 header */
425 /* Note that the specified enum values are identical to the actual info-levels used
428 enum smb_fileinfo_level
{
429 RAW_FILEINFO_GENERIC
= 0xF000,
430 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
431 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
432 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
433 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
434 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
435 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
436 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
437 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
438 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
439 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
440 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
441 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
442 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
443 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
444 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
445 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
446 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
447 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
448 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
449 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
450 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
451 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
452 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
453 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
454 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
455 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
456 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
457 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
458 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
459 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
460 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
461 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
462 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
463 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
464 /* SMB2 specific levels */
465 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
466 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
469 /* union used in qfileinfo() and qpathinfo() backend calls */
471 /* generic interface:
472 * matches RAW_FILEINFO_GENERIC */
474 enum smb_fileinfo_level level
;
476 union smb_handle_or_path file
;
481 unsigned int num_eas
;
484 struct smb_wire_string name
;
494 struct smb_wire_string fname
;
495 struct smb_wire_string alt_fname
;
496 uint8_t delete_pending
;
498 uint64_t compressed_size
;
502 uint8_t cluster_shift
;
504 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
507 uint32_t alignment_requirement
;
508 uint32_t reparse_tag
;
509 unsigned int num_streams
;
510 struct stream_struct
{
513 struct smb_wire_string stream_name
;
519 /* SMBgetatr interface:
520 * matches RAW_FILEINFO_GETATTR */
522 enum smb_fileinfo_level level
;
524 union smb_handle_or_path file
;
533 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
535 enum smb_fileinfo_level level
;
537 union smb_handle_or_path file
;
547 } getattre
, standard
;
549 /* trans2 RAW_FILEINFO_EA_SIZE interface */
551 enum smb_fileinfo_level level
;
553 union smb_handle_or_path file
;
566 /* trans2 RAW_FILEINFO_EA_LIST interface */
568 enum smb_fileinfo_level level
;
570 union smb_handle_or_path file
;
571 unsigned int num_names
;
573 struct smb_wire_string name
;
578 unsigned int num_eas
;
579 struct ea_struct
*eas
;
583 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
585 enum smb_fileinfo_level level
;
587 union smb_handle_or_path file
;
588 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
589 uint8_t continue_flags
;
591 struct smb_ea_list out
;
594 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
595 only valid for a QPATHNAME call - no returned data */
597 enum smb_fileinfo_level level
;
599 union smb_handle_or_path file
;
603 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
605 enum smb_fileinfo_level level
;
607 union smb_handle_or_path file
;
619 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
621 enum smb_fileinfo_level level
;
623 union smb_handle_or_path file
;
634 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
636 enum smb_fileinfo_level level
;
638 union smb_handle_or_path file
;
645 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
647 enum smb_fileinfo_level level
;
649 union smb_handle_or_path file
;
652 struct smb_wire_string fname
;
656 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
658 enum smb_fileinfo_level level
;
660 union smb_handle_or_path file
;
671 uint8_t delete_pending
;
674 struct smb_wire_string fname
;
678 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
680 enum smb_fileinfo_level level
;
682 union smb_handle_or_path file
;
694 uint8_t delete_pending
;
699 uint32_t access_mask
;
702 uint32_t alignment_requirement
;
703 struct smb_wire_string fname
;
707 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
709 enum smb_fileinfo_level level
;
711 union smb_handle_or_path file
;
714 struct smb_wire_string fname
;
718 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
720 enum smb_fileinfo_level level
;
722 union smb_handle_or_path file
;
724 struct stream_information
{
725 unsigned int num_streams
;
726 struct stream_struct
*streams
;
730 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
732 enum smb_fileinfo_level level
;
734 union smb_handle_or_path file
;
737 uint64_t compressed_size
;
741 uint8_t cluster_shift
;
745 /* RAW_FILEINFO_UNIX_BASIC interface */
747 enum smb_fileinfo_level level
;
749 union smb_handle_or_path file
;
752 uint64_t end_of_file
;
754 NTTIME status_change_time
;
763 uint64_t permissions
;
768 /* RAW_FILEINFO_UNIX_INFO2 interface */
770 enum smb_fileinfo_level level
;
772 union smb_handle_or_path file
;
775 uint64_t end_of_file
;
777 NTTIME status_change_time
;
786 uint64_t permissions
;
794 /* RAW_FILEINFO_UNIX_LINK interface */
796 enum smb_fileinfo_level level
;
798 union smb_handle_or_path file
;
801 struct smb_wire_string link_dest
;
805 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
807 enum smb_fileinfo_level level
;
809 union smb_handle_or_path file
;
814 } internal_information
;
816 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
818 enum smb_fileinfo_level level
;
820 union smb_handle_or_path file
;
823 uint32_t access_flags
;
825 } access_information
;
827 /* RAW_FILEINFO_POSITION_INFORMATION interface */
829 enum smb_fileinfo_level level
;
831 union smb_handle_or_path file
;
836 } position_information
;
838 /* RAW_FILEINFO_MODE_INFORMATION interface */
840 enum smb_fileinfo_level level
;
842 union smb_handle_or_path file
;
849 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
851 enum smb_fileinfo_level level
;
853 union smb_handle_or_path file
;
856 uint32_t alignment_requirement
;
858 } alignment_information
;
860 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
862 enum smb_fileinfo_level level
;
864 union smb_handle_or_path file
;
875 } network_open_information
;
878 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
880 enum smb_fileinfo_level level
;
882 union smb_handle_or_path file
;
886 uint32_t reparse_tag
;
888 } attribute_tag_information
;
890 /* RAW_FILEINFO_SEC_DESC */
892 enum smb_fileinfo_level level
;
894 union smb_handle_or_path file
;
895 uint32_t secinfo_flags
;
898 struct security_descriptor
*sd
;
904 enum smb_setfileinfo_level
{
905 RAW_SFILEINFO_GENERIC
= 0xF000,
906 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
907 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
908 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
909 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
910 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
911 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
912 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
913 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
914 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
915 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
916 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
917 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
918 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
919 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
920 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
921 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
922 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
923 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
924 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
925 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
926 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
927 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
928 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
929 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
930 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
931 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
932 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
933 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
934 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
935 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
936 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
937 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
938 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
939 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
940 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
941 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
943 /* cope with breakage in SMB2 */
944 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
947 /* union used in setfileinfo() and setpathinfo() calls */
948 union smb_setfileinfo
{
949 /* generic interface */
951 enum smb_setfileinfo_level level
;
953 union smb_handle_or_path file
;
957 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
959 enum smb_setfileinfo_level level
;
961 union smb_handle_or_path file
;
967 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
968 also RAW_SFILEINFO_STANDARD */
970 enum smb_setfileinfo_level level
;
972 union smb_handle_or_path file
;
976 /* notice that size, alloc_size and attrib are not settable,
977 unlike the corresponding qfileinfo level */
979 } setattre
, standard
;
981 /* RAW_SFILEINFO_EA_SET interface */
983 enum smb_setfileinfo_level level
;
985 union smb_handle_or_path file
;
986 unsigned int num_eas
;
987 struct ea_struct
*eas
;
991 /* RAW_SFILEINFO_BASIC_INFO and
992 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
994 enum smb_setfileinfo_level level
;
996 union smb_handle_or_path file
;
1006 /* RAW_SFILEINFO_DISPOSITION_INFO and
1007 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1009 enum smb_setfileinfo_level level
;
1011 union smb_handle_or_path file
;
1012 bool delete_on_close
;
1016 /* RAW_SFILEINFO_ALLOCATION_INFO and
1017 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1019 enum smb_setfileinfo_level level
;
1021 union smb_handle_or_path file
;
1022 /* w2k3 rounds this up to nearest 4096 */
1023 uint64_t alloc_size
;
1027 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1028 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1030 enum smb_setfileinfo_level level
;
1032 union smb_handle_or_path file
;
1037 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1039 enum smb_setfileinfo_level level
;
1041 union smb_handle_or_path file
;
1044 const char *new_name
;
1046 } rename_information
;
1048 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1050 enum smb_setfileinfo_level level
;
1052 union smb_handle_or_path file
;
1055 const char *new_name
;
1059 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1061 enum smb_setfileinfo_level level
;
1063 union smb_handle_or_path file
;
1066 } position_information
;
1068 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1070 enum smb_setfileinfo_level level
;
1072 union smb_handle_or_path file
;
1073 /* valid values seem to be 0, 2, 4 and 6 */
1078 /* RAW_SFILEINFO_UNIX_BASIC interface */
1080 enum smb_setfileinfo_level level
;
1082 union smb_handle_or_path file
;
1083 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1084 uint64_t end_of_file
;
1086 NTTIME status_change_time
;
1095 uint64_t permissions
;
1100 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1102 enum smb_setfileinfo_level level
;
1104 union smb_handle_or_path file
;
1105 uint64_t end_of_file
;
1107 NTTIME status_change_time
;
1116 uint64_t permissions
;
1119 uint32_t file_flags
;
1120 uint32_t flags_mask
;
1124 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1126 enum smb_setfileinfo_level level
;
1128 union smb_handle_or_path file
;
1129 const char *link_dest
;
1131 } unix_link
, unix_hlink
;
1133 /* RAW_SFILEINFO_SEC_DESC */
1135 enum smb_setfileinfo_level level
;
1137 union smb_handle_or_path file
;
1138 uint32_t secinfo_flags
;
1139 struct security_descriptor
*sd
;
1143 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1145 enum smb_setfileinfo_level level
;
1147 union smb_handle_or_path file
;
1148 struct smb_ea_list eas
;
1150 } full_ea_information
;
1154 enum smb_fsinfo_level
{
1155 RAW_QFS_GENERIC
= 0xF000,
1156 RAW_QFS_DSKATTR
, /* SMBdskattr */
1157 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1158 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1159 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1160 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1161 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1162 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1163 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1164 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1165 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1166 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1167 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1168 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1169 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1170 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
,
1171 RAW_QFS_SECTOR_SIZE_INFORMATION
= SMB_QFS_SECTOR_SIZE_INFORMATION
,
1175 /* union for fsinfo() backend call. Note that there are no in
1176 structures, as this call only contains out parameters */
1178 /* generic interface */
1180 enum smb_fsinfo_level level
;
1181 struct smb2_handle handle
; /* only for smb2 */
1184 uint32_t block_size
;
1185 uint64_t blocks_total
;
1186 uint64_t blocks_free
;
1189 uint32_t serial_number
;
1191 uint32_t max_file_component_length
;
1192 uint32_t device_type
;
1193 uint32_t device_characteristics
;
1194 uint64_t quota_soft
;
1195 uint64_t quota_hard
;
1196 uint64_t quota_flags
;
1203 /* SMBdskattr interface */
1205 enum smb_fsinfo_level level
;
1208 uint16_t units_total
;
1209 uint16_t blocks_per_unit
;
1210 uint16_t block_size
;
1211 uint16_t units_free
;
1215 /* trans2 RAW_QFS_ALLOCATION interface */
1217 enum smb_fsinfo_level level
;
1221 uint32_t sectors_per_unit
;
1222 uint32_t total_alloc_units
;
1223 uint32_t avail_alloc_units
;
1224 uint16_t bytes_per_sector
;
1228 /* TRANS2 RAW_QFS_VOLUME interface */
1230 enum smb_fsinfo_level level
;
1233 uint32_t serial_number
;
1234 struct smb_wire_string volume_name
;
1238 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1240 enum smb_fsinfo_level level
;
1241 struct smb2_handle handle
; /* only for smb2 */
1245 uint32_t serial_number
;
1246 struct smb_wire_string volume_name
;
1250 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1252 enum smb_fsinfo_level level
;
1253 struct smb2_handle handle
; /* only for smb2 */
1256 uint64_t total_alloc_units
;
1257 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1258 uint32_t sectors_per_unit
;
1259 uint32_t bytes_per_sector
;
1263 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1265 enum smb_fsinfo_level level
;
1266 struct smb2_handle handle
; /* only for smb2 */
1269 uint32_t device_type
;
1270 uint32_t characteristics
;
1275 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1277 enum smb_fsinfo_level level
;
1278 struct smb2_handle handle
; /* only for smb2 */
1282 uint32_t max_file_component_length
;
1283 struct smb_wire_string fs_type
;
1288 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1290 enum smb_fsinfo_level level
;
1293 uint16_t major_version
;
1294 uint16_t minor_version
;
1295 uint64_t capability
;
1299 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1301 enum smb_fsinfo_level level
;
1302 struct smb2_handle handle
; /* only for smb2 */
1305 uint64_t unknown
[3];
1306 uint64_t quota_soft
;
1307 uint64_t quota_hard
;
1308 uint64_t quota_flags
;
1310 } quota_information
;
1312 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1314 enum smb_fsinfo_level level
;
1315 struct smb2_handle handle
; /* only for smb2 */
1318 uint64_t total_alloc_units
;
1319 uint64_t call_avail_alloc_units
;
1320 uint64_t actual_avail_alloc_units
;
1321 uint32_t sectors_per_unit
;
1322 uint32_t bytes_per_sector
;
1324 } full_size_information
;
1326 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1328 enum smb_fsinfo_level level
;
1329 struct smb2_handle handle
; /* only for smb2 */
1333 uint64_t unknown
[6];
1335 } objectid_information
;
1337 /* trans2 RAW_QFS_SECTOR_SIZE_INFORMATION interface */
1339 enum smb_fsinfo_level level
;
1340 struct smb2_handle handle
; /* only for smb2 */
1343 uint32_t logical_bytes_per_sector
;
1344 uint32_t phys_bytes_per_sector_atomic
;
1345 uint32_t phys_bytes_per_sector_perf
;
1346 uint32_t fs_effective_phys_bytes_per_sector_atomic
;
1348 uint32_t byte_off_sector_align
;
1349 uint32_t byte_off_partition_align
;
1355 enum smb_setfsinfo_level
{
1356 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1358 union smb_setfsinfo
{
1359 /* generic interface */
1361 enum smb_setfsinfo_level level
;
1364 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1366 enum smb_setfsinfo_level level
;
1369 uint16_t major_version
;
1370 uint16_t minor_version
;
1371 uint64_t capability
;
1376 enum smb_open_level
{
1385 RAW_OPEN_NTTRANS_CREATE
,
1386 RAW_OPEN_OPENX_READX
,
1387 RAW_OPEN_NTCREATEX_READX
,
1391 /* the generic interface is defined to be equal to the NTCREATEX interface */
1392 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1394 /* union for open() backend call */
1397 * because the *.out.file structs are not aligned to the same offset for each level
1398 * we provide a hepler macro that should be used to find the current smb_handle structure
1400 #define SMB_OPEN_OUT_FILE(op, file) do { \
1401 switch (op->generic.level) { \
1402 case RAW_OPEN_OPEN: \
1403 file = &op->openold.out.file; \
1405 case RAW_OPEN_OPENX: \
1406 file = &op->openx.out.file; \
1408 case RAW_OPEN_MKNEW: \
1409 file = &op->mknew.out.file; \
1411 case RAW_OPEN_CREATE: \
1412 file = &op->create.out.file; \
1414 case RAW_OPEN_CTEMP: \
1415 file = &op->ctemp.out.file; \
1417 case RAW_OPEN_SPLOPEN: \
1418 file = &op->splopen.out.file; \
1420 case RAW_OPEN_NTCREATEX: \
1421 file = &op->ntcreatex.out.file; \
1423 case RAW_OPEN_T2OPEN: \
1424 file = &op->t2open.out.file; \
1426 case RAW_OPEN_NTTRANS_CREATE: \
1427 file = &op->nttrans.out.file; \
1429 case RAW_OPEN_OPENX_READX: \
1430 file = &op->openxreadx.out.file; \
1432 case RAW_OPEN_NTCREATEX_READX: \
1433 file = &op->ntcreatexreadx.out.file; \
1435 case RAW_OPEN_SMB2: \
1436 file = &op->smb2.out.file; \
1439 /* this must be a programmer error */ \
1444 /* SMBNTCreateX, nttrans and generic interface */
1446 enum smb_open_level level
;
1449 union smb_handle root_fid
;
1450 uint32_t access_mask
;
1451 uint64_t alloc_size
;
1453 uint32_t share_access
;
1454 uint32_t open_disposition
;
1455 uint32_t create_options
;
1456 uint32_t impersonation
;
1457 uint8_t security_flags
;
1458 /* NOTE: fname can also be a pointer to a
1459 uint64_t file_id if create_options has the
1460 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1463 /* these last 2 elements are only used in the
1464 NTTRANS varient of the call */
1465 struct security_descriptor
*sec_desc
;
1466 struct smb_ea_list
*ea_list
;
1468 /* some optional parameters from the SMB2 varient */
1469 bool query_maximal_access
;
1470 bool query_on_disk_id
;
1472 /* private flags for internal use only */
1473 uint8_t private_flags
;
1476 union smb_handle file
;
1477 uint8_t oplock_level
;
1478 uint32_t create_action
;
1484 uint64_t alloc_size
;
1488 uint8_t is_directory
;
1490 /* optional return values matching SMB2 tagged
1491 values in the call */
1492 uint32_t maximal_access
;
1493 uint8_t on_disk_id
[32];
1495 } ntcreatex
, nttrans
, generic
;
1497 /* TRANS2_OPEN interface */
1499 enum smb_open_level level
;
1503 uint16_t search_attrs
;
1504 uint16_t file_attrs
;
1510 unsigned int num_eas
;
1511 struct ea_struct
*eas
;
1514 union smb_handle file
;
1526 /* SMBopen interface */
1528 enum smb_open_level level
;
1531 uint16_t search_attrs
;
1535 union smb_handle file
;
1543 /* SMBopenX interface */
1545 enum smb_open_level level
;
1549 uint16_t search_attrs
; /* not honoured by win2003 */
1550 uint16_t file_attrs
;
1551 time_t write_time
; /* not honoured by win2003 */
1553 uint32_t size
; /* note that this sets the
1554 initial file size, not
1555 just allocation size */
1556 uint32_t timeout
; /* not honoured by win2003 */
1560 union smb_handle file
;
1568 uint32_t unique_fid
;
1569 uint32_t access_mask
;
1574 /* SMBmknew interface */
1576 enum smb_open_level level
;
1583 union smb_handle file
;
1587 /* SMBctemp interface */
1589 enum smb_open_level level
;
1593 const char *directory
;
1596 union smb_handle file
;
1597 /* temp name, relative to directory */
1602 /* SMBsplopen interface */
1604 enum smb_open_level level
;
1606 uint16_t setup_length
;
1611 union smb_handle file
;
1616 /* chained OpenX/ReadX interface */
1618 enum smb_open_level level
;
1622 uint16_t search_attrs
; /* not honoured by win2003 */
1623 uint16_t file_attrs
;
1624 time_t write_time
; /* not honoured by win2003 */
1626 uint32_t size
; /* note that this sets the
1627 initial file size, not
1628 just allocation size */
1629 uint32_t timeout
; /* not honoured by win2003 */
1639 union smb_handle file
;
1647 uint32_t unique_fid
;
1648 uint32_t access_mask
;
1654 uint16_t compaction_mode
;
1659 /* chained NTCreateX/ReadX interface */
1661 enum smb_open_level level
;
1664 union smb_handle root_fid
;
1665 uint32_t access_mask
;
1666 uint64_t alloc_size
;
1668 uint32_t share_access
;
1669 uint32_t open_disposition
;
1670 uint32_t create_options
;
1671 uint32_t impersonation
;
1672 uint8_t security_flags
;
1673 /* NOTE: fname can also be a pointer to a
1674 uint64_t file_id if create_options has the
1675 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1685 union smb_handle file
;
1686 uint8_t oplock_level
;
1687 uint32_t create_action
;
1693 uint64_t alloc_size
;
1697 uint8_t is_directory
;
1702 uint16_t compaction_mode
;
1707 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1708 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1709 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1710 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1713 struct smb2_create
{
1714 enum smb_open_level level
;
1716 /* static body buffer 56 (0x38) bytes */
1717 uint8_t security_flags
; /* SMB2_SECURITY_* */
1718 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1719 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1720 uint64_t create_flags
;
1722 uint32_t desired_access
;
1723 uint32_t file_attributes
;
1724 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1725 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1726 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1728 /* uint16_t fname_ofs */
1729 /* uint16_t fname_size */
1730 /* uint32_t blob_ofs; */
1731 /* uint32_t blob_size; */
1736 /* now some optional parameters - encoded as tagged blobs */
1737 struct smb_ea_list eas
;
1738 uint64_t alloc_size
;
1739 struct security_descriptor
*sec_desc
;
1741 struct smb2_handle
*durable_handle
;
1743 /* data for durable handle v2 */
1744 bool durable_open_v2
;
1745 struct GUID create_guid
;
1746 bool persistent_open
;
1748 struct smb2_handle
*durable_handle_v2
;
1750 bool query_maximal_access
;
1752 bool query_on_disk_id
;
1753 struct smb2_lease
*lease_request
;
1754 struct smb2_lease
*lease_request_v2
;
1756 struct GUID
*app_instance_id
;
1758 /* and any additional blobs the caller wants */
1759 struct smb2_create_blobs blobs
;
1762 union smb_handle file
;
1764 /* static body buffer 88 (0x58) bytes */
1765 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1766 uint8_t oplock_level
;
1768 uint32_t create_action
;
1773 uint64_t alloc_size
;
1777 /* struct smb2_handle handle;*/
1778 /* uint32_t blob_ofs; */
1779 /* uint32_t blob_size; */
1781 /* optional return values matching tagged values in the call */
1782 uint32_t maximal_access
;
1783 uint8_t on_disk_id
[32];
1784 struct smb2_lease lease_response
;
1785 struct smb2_lease lease_response_v2
;
1788 /* durable handle v2 */
1789 bool durable_open_v2
;
1790 bool persistent_open
;
1793 /* tagged blobs in the reply */
1794 struct smb2_create_blobs blobs
;
1801 enum smb_read_level
{
1809 #define RAW_READ_GENERIC RAW_READ_READX
1811 /* union for read() backend call
1813 note that .infoX.out.data will be allocated before the backend is
1814 called. It will be big enough to hold the maximum size asked for
1817 /* SMBreadX (and generic) interface */
1819 enum smb_read_level level
;
1821 union smb_handle file
;
1823 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1826 bool read_for_execute
;
1831 uint16_t compaction_mode
;
1834 uint16_t data_offset
;
1838 /* SMBreadbraw interface */
1840 enum smb_read_level level
;
1842 union smb_handle file
;
1855 /* SMBlockandread interface */
1857 enum smb_read_level level
;
1859 union smb_handle file
;
1870 /* SMBread interface */
1872 enum smb_read_level level
;
1874 union smb_handle file
;
1887 enum smb_read_level level
;
1889 union smb_handle file
;
1891 /* static body buffer 48 (0x30) bytes */
1892 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1897 /* struct smb2_handle handle; */
1901 /* the docs give no indication of what
1902 these channel variables are for */
1903 uint16_t channel_offset
;
1904 uint16_t channel_length
;
1907 /* static body buffer 16 (0x10) bytes */
1908 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1909 /* uint8_t data_ofs; */
1910 /* uint8_t reserved; */
1911 /* uint32_t data_size; */
1922 enum smb_write_level
{
1923 RAW_WRITE_WRITEUNLOCK
,
1926 RAW_WRITE_WRITECLOSE
,
1931 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1933 /* union for write() backend call
1936 /* SMBwriteX interface */
1938 enum smb_write_level level
;
1940 union smb_handle file
;
1945 const uint8_t *data
;
1953 /* SMBwriteunlock interface */
1955 enum smb_write_level level
;
1957 union smb_handle file
;
1961 const uint8_t *data
;
1968 /* SMBwrite interface */
1970 enum smb_write_level level
;
1972 union smb_handle file
;
1976 const uint8_t *data
;
1983 /* SMBwriteclose interface */
1985 enum smb_write_level level
;
1987 union smb_handle file
;
1991 const uint8_t *data
;
1998 /* SMBsplwrite interface */
2000 enum smb_write_level level
;
2002 union smb_handle file
;
2004 const uint8_t *data
;
2010 enum smb_write_level level
;
2012 union smb_handle file
;
2014 /* static body buffer 48 (0x30) bytes */
2015 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2016 /* uint16_t data_ofs; */
2017 /* uint32_t data_size; */
2019 /* struct smb2_handle handle; */
2020 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2021 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2027 /* static body buffer 17 (0x11) bytes */
2028 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2031 uint64_t unknown1
; /* 0x0000000000000000 */
2037 enum smb_lock_level
{
2045 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2047 /* union for lock() backend call
2050 /* SMBlockingX and generic interface */
2052 enum smb_lock_level level
;
2054 union smb_handle file
;
2059 struct smb_lock_entry
{
2060 uint32_t pid
; /* 16 bits in SMB1 */
2063 } *locks
; /* unlocks are first in the arrray */
2067 /* SMBlock and SMBunlock interface */
2069 enum smb_lock_level level
;
2071 union smb_handle file
;
2079 enum smb_lock_level level
;
2081 union smb_handle file
;
2083 /* static body buffer 48 (0x30) bytes */
2084 /* uint16_t buffer_code; 0x30 */
2085 uint16_t lock_count
;
2086 uint32_t lock_sequence
;
2087 /* struct smb2_handle handle; */
2088 struct smb2_lock_element
{
2096 /* static body buffer 4 (0x04) bytes */
2097 /* uint16_t buffer_code; 0x04 */
2104 enum smb_lock_level level
;
2106 union smb_handle file
;
2108 /* static body buffer 24 (0x18) bytes */
2109 uint8_t oplock_level
;
2112 /* struct smb2_handle handle; */
2116 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2117 struct smb2_lease_break_ack
{
2120 struct smb2_lease lease
;
2122 } smb2_lease_break_ack
;
2126 enum smb_close_level
{
2134 union for close() backend call
2137 /* generic interface */
2139 enum smb_close_level level
;
2141 union smb_handle file
;
2143 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2151 uint64_t alloc_size
;
2157 /* SMBclose interface */
2159 enum smb_close_level level
;
2161 union smb_handle file
;
2166 /* SMBsplclose interface - empty! */
2168 enum smb_close_level level
;
2170 union smb_handle file
;
2176 enum smb_close_level level
;
2178 union smb_handle file
;
2180 /* static body buffer 24 (0x18) bytes */
2181 /* uint16_t buffer_code; 0x18 */
2182 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2186 /* static body buffer 60 (0x3C) bytes */
2187 /* uint16_t buffer_code; 0x3C */
2194 uint64_t alloc_size
;
2202 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2205 union for lpq() backend
2208 /* generic interface */
2210 enum smb_lpq_level level
;
2215 /* SMBsplretq interface */
2217 enum smb_lpq_level level
;
2225 uint16_t restart_idx
;
2237 enum smb_ioctl_level
{
2241 RAW_IOCTL_SMB2_NO_HANDLE
2245 union for ioctl() backend
2248 /* generic interface */
2250 enum smb_ioctl_level level
;
2252 union smb_handle file
;
2256 /* struct for SMBioctl */
2258 enum smb_ioctl_level level
;
2260 union smb_handle file
;
2269 /* struct for NT ioctl call */
2271 enum smb_ioctl_level level
;
2273 union smb_handle file
;
2287 enum smb_ioctl_level level
;
2289 union smb_handle file
;
2291 /* static body buffer 56 (0x38) bytes */
2292 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2295 /*struct smb2_handle handle;*/
2296 /* uint32_t out_ofs; */
2297 /* uint32_t out_size; */
2299 /* uint32_t in_ofs; */
2300 /* uint32_t in_size; */
2301 uint32_t max_response_size
;
2309 union smb_handle file
;
2311 /* static body buffer 48 (0x30) bytes */
2312 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2315 /* struct smb2_handle handle; */
2316 /* uint32_t in_ofs; */
2317 /* uint32_t in_size; */
2318 /* uint32_t out_ofs; */
2319 /* uint32_t out_size; */
2330 enum smb_flush_level
{
2337 /* struct for SMBflush */
2339 enum smb_flush_level level
;
2341 union smb_handle file
;
2345 /* SMBflush with 0xFFFF wildcard fnum */
2347 enum smb_flush_level level
;
2352 enum smb_flush_level level
;
2354 union smb_handle file
;
2364 /* struct for SMBcopy */
2379 /* struct for transact/transact2 call */
2387 uint8_t setup_count
;
2389 const char *trans_name
; /* SMBtrans only */
2395 uint8_t setup_count
;
2402 /* struct for nttransact2 call */
2403 struct smb_nttrans
{
2408 uint8_t setup_count
;
2416 uint8_t setup_count
; /* in units of 16 bit words */
2423 enum smb_notify_level
{
2429 /* struct for nttrans change notify call */
2431 enum smb_notify_level level
;
2434 union smb_handle file
;
2435 uint32_t buffer_size
;
2436 uint32_t completion_filter
;
2441 uint32_t num_changes
;
2442 struct notify_changes
{
2444 struct smb_wire_string name
;
2449 struct smb2_notify
{
2450 enum smb_notify_level level
;
2453 union smb_handle file
;
2454 /* static body buffer 32 (0x20) bytes */
2455 /* uint16_t buffer_code; 0x32 */
2457 uint32_t buffer_size
;
2458 /*struct smb2_handle file;*/
2459 uint32_t completion_filter
;
2464 /* static body buffer 8 (0x08) bytes */
2465 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2466 /* uint16_t blob_ofs; */
2467 /* uint16_t blob_size; */
2472 /* DATA_BLOB content */
2473 uint32_t num_changes
;
2474 struct notify_changes
*changes
;
2479 enum smb_search_level
{
2480 RAW_SEARCH_SEARCH
, /* SMBsearch */
2481 RAW_SEARCH_FFIRST
, /* SMBffirst */
2482 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2483 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2484 RAW_SEARCH_SMB2
/* SMB2 Find */
2487 enum smb_search_data_level
{
2488 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2489 RAW_SEARCH_DATA_SEARCH
,
2490 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2491 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2492 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2493 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2494 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2495 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2496 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2497 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2498 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2499 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2500 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2503 /* union for file search */
2504 union smb_search_first
{
2506 enum smb_search_level level
;
2507 enum smb_search_data_level data_level
;
2510 /* search (old) findfirst interface.
2511 Also used for ffirst and funique. */
2513 enum smb_search_level level
;
2514 enum smb_search_data_level data_level
;
2518 uint16_t search_attrib
;
2519 const char *pattern
;
2526 /* trans2 findfirst interface */
2528 enum smb_search_level level
;
2529 enum smb_search_data_level data_level
;
2532 uint16_t search_attrib
;
2535 uint32_t storage_type
;
2536 const char *pattern
;
2538 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2539 unsigned int num_names
;
2540 struct ea_name
*ea_names
;
2545 uint16_t end_of_search
;
2551 enum smb_search_level level
;
2552 enum smb_search_data_level data_level
;
2554 union smb_handle file
;
2556 /* static body buffer 32 (0x20) bytes */
2557 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2559 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2560 uint32_t file_index
;
2561 /* struct smb2_handle handle; */
2562 /* uint16_t pattern_ofs; */
2563 /* uint16_t pattern_size; */
2564 uint32_t max_response_size
;
2567 const char *pattern
;
2570 /* static body buffer 8 (0x08) bytes */
2571 /* uint16_t buffer_code; 0x08 */
2572 /* uint16_t blob_ofs; */
2573 /* uint32_t blob_size; */
2581 /* union for file search continue */
2582 union smb_search_next
{
2584 enum smb_search_level level
;
2585 enum smb_search_data_level data_level
;
2588 /* search (old) findnext interface. Also used
2589 for ffirst when continuing */
2591 enum smb_search_level level
;
2592 enum smb_search_data_level data_level
;
2596 uint16_t search_attrib
;
2597 struct smb_search_id
{
2601 uint32_t server_cookie
;
2602 uint32_t client_cookie
;
2610 /* trans2 findnext interface */
2612 enum smb_search_level level
;
2613 enum smb_search_data_level data_level
;
2618 uint32_t resume_key
;
2620 const char *last_name
;
2622 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2623 unsigned int num_names
;
2624 struct ea_name
*ea_names
;
2628 uint16_t end_of_search
;
2633 struct smb2_find smb2
;
2636 /* union for search reply file data */
2637 union smb_search_data
{
2639 * search (old) findfirst
2640 * RAW_SEARCH_DATA_SEARCH
2646 struct smb_search_id id
;
2650 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2652 uint32_t resume_key
;
2657 uint32_t alloc_size
;
2659 struct smb_wire_string name
;
2662 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2664 uint32_t resume_key
;
2669 uint32_t alloc_size
;
2672 struct smb_wire_string name
;
2675 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2677 uint32_t resume_key
;
2682 uint32_t alloc_size
;
2684 struct smb_ea_list eas
;
2685 struct smb_wire_string name
;
2688 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2690 uint32_t file_index
;
2696 uint64_t alloc_size
;
2698 struct smb_wire_string name
;
2701 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2703 uint32_t file_index
;
2709 uint64_t alloc_size
;
2712 struct smb_wire_string name
;
2713 } full_directory_info
;
2715 /* RAW_SEARCH_DATA_NAME_INFO interface */
2717 uint32_t file_index
;
2718 struct smb_wire_string name
;
2721 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2723 uint32_t file_index
;
2729 uint64_t alloc_size
;
2732 struct smb_wire_string short_name
;
2733 struct smb_wire_string name
;
2734 } both_directory_info
;
2736 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2738 uint32_t file_index
;
2744 uint64_t alloc_size
;
2748 struct smb_wire_string name
;
2749 } id_full_directory_info
;
2751 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2753 uint32_t file_index
;
2759 uint64_t alloc_size
;
2763 uint8_t short_name_buf
[24];
2764 struct smb_wire_string short_name
;
2765 struct smb_wire_string name
;
2766 } id_both_directory_info
;
2768 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2770 uint32_t file_index
;
2772 uint64_t alloc_size
;
2773 NTTIME status_change_time
;
2782 uint64_t permissions
;
2787 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2789 uint32_t file_index
;
2790 uint64_t end_of_file
;
2792 NTTIME status_change_time
;
2801 uint64_t permissions
;
2804 uint32_t file_flags
;
2805 uint32_t flags_mask
;
2806 struct smb_wire_string name
;
2810 /* Callback function passed to the raw search interface. */
2811 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2813 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2815 /* union for file search close */
2816 union smb_search_close
{
2818 enum smb_search_close_level level
;
2821 /* SMBfclose (old search) interface */
2823 enum smb_search_close_level level
;
2826 /* max_count and search_attrib are not used, but are present */
2828 uint16_t search_attrib
;
2829 struct smb_search_id id
;
2833 /* SMBfindclose interface */
2835 enum smb_search_close_level level
;
2845 struct for SMBecho call
2849 uint16_t repeat_count
;
2855 uint16_t sequence_number
;
2862 struct for shadow copy volumes
2864 struct smb_shadow_copy
{
2866 union smb_handle file
;
2870 uint32_t num_volumes
;
2876 #endif /* __LIBCLI_RAW_INTERFACES_H__ */