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 paths
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 */
145 * smb2_composite_unlink*
147 bool truncate_if_needed
;
153 /* struct used in chkpath() call */
162 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
164 /* union used in mkdir() call */
168 enum smb_mkdir_level level
;
172 enum smb_mkdir_level level
;
179 enum smb_mkdir_level level
;
182 unsigned int num_eas
;
183 struct ea_struct
*eas
;
188 /* struct used in rmdir() call */
195 /* struct used in rename() call */
196 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
200 enum smb_rename_level level
;
203 /* SMBrename interface */
205 enum smb_rename_level level
;
208 const char *pattern1
;
209 const char *pattern2
;
215 /* SMBntrename interface */
217 enum smb_rename_level level
;
221 uint16_t flags
; /* see RENAME_FLAG_* */
222 uint32_t cluster_size
;
223 const char *old_name
;
224 const char *new_name
;
228 /* NT TRANS rename interface */
230 enum smb_rename_level level
;
233 union smb_handle file
;
234 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
235 const char *new_name
;
240 enum smb_tcon_level
{
246 /* union used in tree connect call */
248 /* generic interface */
250 enum smb_tcon_level level
;
253 /* SMBtcon interface */
255 enum smb_tcon_level level
;
259 const char *password
;
268 /* SMBtconX interface */
270 enum smb_tcon_level level
;
281 uint32_t guest_max_access
;
288 /* SMB2 TreeConnect */
289 struct smb2_tree_connect
{
290 enum smb_tcon_level level
;
293 /* static body buffer 8 (0x08) bytes */
295 /* uint16_t path_ofs */
296 /* uint16_t path_size */
298 const char *path
; /* as non-terminated UTF-16 on the wire */
301 /* static body buffer 16 (0x10) bytes */
302 /* uint16_t buffer_code; 0x10 */
306 uint32_t capabilities
;
307 uint32_t access_mask
;
309 /* extracted from the SMB2 header */
316 enum smb_sesssetup_level
{
319 RAW_SESSSETUP_SPNEGO
,
323 /* union used in session_setup call */
324 union smb_sesssetup
{
325 /* the pre-NT1 interface */
327 enum smb_sesssetup_level level
;
349 /* the NT1 interface */
351 enum smb_sesssetup_level level
;
358 uint32_t capabilities
;
376 /* the SPNEGO interface */
378 enum smb_sesssetup_level level
;
385 uint32_t capabilities
;
389 const char *workgroup
;
401 /* SMB2 SessionSetup */
402 struct smb2_session_setup
{
403 enum smb_sesssetup_level level
;
406 /* static body 24 (0x18) bytes */
408 uint8_t security_mode
;
409 uint32_t capabilities
;
411 /* uint16_t secblob_ofs */
412 /* uint16_t secblob_size */
413 uint64_t previous_sessionid
;
418 /* body buffer 8 (0x08) bytes */
419 uint16_t session_flags
;
420 /* uint16_t secblob_ofs */
421 /* uint16_t secblob_size */
425 /* extracted from the SMB2 header */
431 /* Note that the specified enum values are identical to the actual info-levels used
434 enum smb_fileinfo_level
{
435 RAW_FILEINFO_GENERIC
= 0xF000,
436 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
437 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
438 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
439 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
440 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
441 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
442 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
443 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
444 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
445 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
446 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
447 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
448 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
449 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
450 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
451 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
452 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
453 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
454 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
455 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
456 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
457 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
458 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
459 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
460 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
461 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
462 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
463 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
464 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
465 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
466 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
467 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
468 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
469 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
470 RAW_FILEINFO_NORMALIZED_NAME_INFORMATION
= SMB_QFILEINFO_NORMALIZED_NAME_INFORMATION
,
471 /* SMB2 specific levels */
472 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
473 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201,
474 RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION
= 0x1501
477 /* union used in qfileinfo() and qpathinfo() backend calls */
479 /* generic interface:
480 * matches RAW_FILEINFO_GENERIC */
482 enum smb_fileinfo_level level
;
484 union smb_handle_or_path file
;
489 unsigned int num_eas
;
492 struct smb_wire_string name
;
502 struct smb_wire_string fname
;
503 struct smb_wire_string alt_fname
;
504 uint8_t delete_pending
;
506 uint64_t compressed_size
;
510 uint8_t cluster_shift
;
512 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
515 uint32_t alignment_requirement
;
516 uint32_t reparse_tag
;
517 unsigned int num_streams
;
518 struct stream_struct
{
521 struct smb_wire_string stream_name
;
527 /* SMBgetatr interface:
528 * matches RAW_FILEINFO_GETATTR */
530 enum smb_fileinfo_level level
;
532 union smb_handle_or_path file
;
541 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
543 enum smb_fileinfo_level level
;
545 union smb_handle_or_path file
;
555 } getattre
, standard
;
557 /* trans2 RAW_FILEINFO_EA_SIZE interface */
559 enum smb_fileinfo_level level
;
561 union smb_handle_or_path file
;
574 /* trans2 RAW_FILEINFO_EA_LIST interface */
576 enum smb_fileinfo_level level
;
578 union smb_handle_or_path file
;
579 unsigned int num_names
;
581 struct smb_wire_string name
;
586 unsigned int num_eas
;
587 struct ea_struct
*eas
;
591 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
593 enum smb_fileinfo_level level
;
595 union smb_handle_or_path file
;
596 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
597 uint8_t continue_flags
;
599 struct smb_ea_list out
;
602 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
603 only valid for a QPATHNAME call - no returned data */
605 enum smb_fileinfo_level level
;
607 union smb_handle_or_path file
;
611 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
613 enum smb_fileinfo_level level
;
615 union smb_handle_or_path file
;
627 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
629 enum smb_fileinfo_level level
;
631 union smb_handle_or_path file
;
642 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
644 enum smb_fileinfo_level level
;
646 union smb_handle_or_path file
;
653 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
654 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
655 /* RAW_FILEINFO_NORMALIZED_NAME_INFORMATION interface */
656 /* RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION interface */
658 enum smb_fileinfo_level level
;
660 union smb_handle_or_path file
;
663 struct smb_wire_string fname
;
665 } name_info
, alt_name_info
, normalized_name_info
;
667 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
669 enum smb_fileinfo_level level
;
671 union smb_handle_or_path file
;
682 uint8_t delete_pending
;
685 struct smb_wire_string fname
;
689 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
691 enum smb_fileinfo_level level
;
693 union smb_handle_or_path file
;
705 uint8_t delete_pending
;
710 uint32_t access_mask
;
713 uint32_t alignment_requirement
;
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 helper 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 variant of the call */
1465 struct security_descriptor
*sec_desc
;
1466 struct smb_ea_list
*ea_list
;
1468 /* some optional parameters from the SMB2 variant */
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_status
;
1783 uint32_t maximal_access
;
1784 uint8_t on_disk_id
[32];
1785 struct smb2_lease lease_response
;
1786 struct smb2_lease lease_response_v2
;
1789 /* durable handle v2 */
1790 bool durable_open_v2
;
1791 bool persistent_open
;
1794 /* tagged blobs in the reply */
1795 struct smb2_create_blobs blobs
;
1802 enum smb_read_level
{
1810 #define RAW_READ_GENERIC RAW_READ_READX
1812 /* union for read() backend call
1814 note that .infoX.out.data will be allocated before the backend is
1815 called. It will be big enough to hold the maximum size asked for
1818 /* SMBreadX (and generic) interface */
1820 enum smb_read_level level
;
1822 union smb_handle file
;
1824 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1827 bool read_for_execute
;
1832 uint16_t compaction_mode
;
1835 uint16_t data_offset
;
1839 /* SMBreadbraw interface */
1841 enum smb_read_level level
;
1843 union smb_handle file
;
1856 /* SMBlockandread interface */
1858 enum smb_read_level level
;
1860 union smb_handle file
;
1871 /* SMBread interface */
1873 enum smb_read_level level
;
1875 union smb_handle file
;
1888 enum smb_read_level level
;
1890 union smb_handle file
;
1892 /* static body buffer 48 (0x30) bytes */
1893 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1898 /* struct smb2_handle handle; */
1902 /* the docs give no indication of what
1903 these channel variables are for */
1904 uint16_t channel_offset
;
1905 uint16_t channel_length
;
1908 /* static body buffer 16 (0x10) bytes */
1909 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1910 /* uint8_t data_ofs; */
1911 /* uint8_t reserved; */
1912 /* uint32_t data_size; */
1923 enum smb_write_level
{
1924 RAW_WRITE_WRITEUNLOCK
,
1927 RAW_WRITE_WRITECLOSE
,
1932 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1934 /* union for write() backend call
1937 /* SMBwriteX interface */
1939 enum smb_write_level level
;
1941 union smb_handle file
;
1946 const uint8_t *data
;
1954 /* SMBwriteunlock interface */
1956 enum smb_write_level level
;
1958 union smb_handle file
;
1962 const uint8_t *data
;
1969 /* SMBwrite interface */
1971 enum smb_write_level level
;
1973 union smb_handle file
;
1977 const uint8_t *data
;
1984 /* SMBwriteclose interface */
1986 enum smb_write_level level
;
1988 union smb_handle file
;
1992 const uint8_t *data
;
1999 /* SMBsplwrite interface */
2001 enum smb_write_level level
;
2003 union smb_handle file
;
2005 const uint8_t *data
;
2011 enum smb_write_level level
;
2013 union smb_handle file
;
2015 /* static body buffer 48 (0x30) bytes */
2016 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2017 /* uint16_t data_ofs; */
2018 /* uint32_t data_size; */
2020 /* struct smb2_handle handle; */
2021 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2022 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2028 /* static body buffer 17 (0x11) bytes */
2029 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2032 uint64_t unknown1
; /* 0x0000000000000000 */
2038 enum smb_lock_level
{
2046 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2048 /* union for lock() backend call
2051 /* SMBlockingX and generic interface */
2053 enum smb_lock_level level
;
2055 union smb_handle file
;
2060 struct smb_lock_entry
{
2061 uint32_t pid
; /* 16 bits in SMB1 */
2064 } *locks
; /* unlocks are first in the array */
2068 /* SMBlock and SMBunlock interface */
2070 enum smb_lock_level level
;
2072 union smb_handle file
;
2080 enum smb_lock_level level
;
2082 union smb_handle file
;
2084 /* static body buffer 48 (0x30) bytes */
2085 /* uint16_t buffer_code; 0x30 */
2086 uint16_t lock_count
;
2087 uint32_t lock_sequence
;
2088 /* struct smb2_handle handle; */
2089 struct smb2_lock_element
*locks
;
2092 /* static body buffer 4 (0x04) bytes */
2093 /* uint16_t buffer_code; 0x04 */
2100 enum smb_lock_level level
;
2102 union smb_handle file
;
2104 /* static body buffer 24 (0x18) bytes */
2105 uint8_t oplock_level
;
2108 /* struct smb2_handle handle; */
2112 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2113 struct smb2_lease_break_ack
{
2116 struct smb2_lease lease
;
2118 } smb2_lease_break_ack
;
2122 enum smb_close_level
{
2130 union for close() backend call
2133 /* generic interface */
2135 enum smb_close_level level
;
2137 union smb_handle file
;
2139 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2147 uint64_t alloc_size
;
2153 /* SMBclose interface */
2155 enum smb_close_level level
;
2157 union smb_handle file
;
2162 /* SMBsplclose interface - empty! */
2164 enum smb_close_level level
;
2166 union smb_handle file
;
2172 enum smb_close_level level
;
2174 union smb_handle file
;
2176 /* static body buffer 24 (0x18) bytes */
2177 /* uint16_t buffer_code; 0x18 */
2178 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2182 /* static body buffer 60 (0x3C) bytes */
2183 /* uint16_t buffer_code; 0x3C */
2190 uint64_t alloc_size
;
2198 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2201 union for lpq() backend
2204 /* generic interface */
2206 enum smb_lpq_level level
;
2211 /* SMBsplretq interface */
2213 enum smb_lpq_level level
;
2221 uint16_t restart_idx
;
2233 enum smb_ioctl_level
{
2237 RAW_IOCTL_SMB2_NO_HANDLE
2241 union for ioctl() backend
2244 /* generic interface */
2246 enum smb_ioctl_level level
;
2248 union smb_handle file
;
2252 /* struct for SMBioctl */
2254 enum smb_ioctl_level level
;
2256 union smb_handle file
;
2265 /* struct for NT ioctl call */
2267 enum smb_ioctl_level level
;
2269 union smb_handle file
;
2283 enum smb_ioctl_level level
;
2285 union smb_handle file
;
2287 /* static body buffer 56 (0x38) bytes */
2288 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2291 /*struct smb2_handle handle;*/
2292 /* uint32_t out_ofs; */
2293 /* uint32_t out_size; */
2294 uint32_t max_input_response
;
2295 /* uint32_t in_ofs; */
2296 /* uint32_t in_size; */
2297 uint32_t max_output_response
;
2306 union smb_handle file
;
2308 /* static body buffer 48 (0x30) bytes */
2309 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2312 /* struct smb2_handle handle; */
2313 /* uint32_t in_ofs; */
2314 /* uint32_t in_size; */
2315 /* uint32_t out_ofs; */
2316 /* uint32_t out_size; */
2327 enum smb_flush_level
{
2334 /* struct for SMBflush */
2336 enum smb_flush_level level
;
2338 union smb_handle file
;
2342 /* SMBflush with 0xFFFF wildcard fnum */
2344 enum smb_flush_level level
;
2349 enum smb_flush_level level
;
2351 union smb_handle file
;
2361 /* struct for SMBcopy */
2376 /* struct for transact/transact2 call */
2384 uint8_t setup_count
;
2386 const char *trans_name
; /* SMBtrans only */
2392 uint8_t setup_count
;
2399 /* struct for nttransact2 call */
2400 struct smb_nttrans
{
2405 uint8_t setup_count
;
2413 uint8_t setup_count
; /* in units of 16 bit words */
2420 enum smb_notify_level
{
2426 /* struct for nttrans change notify call */
2428 enum smb_notify_level level
;
2431 union smb_handle file
;
2432 uint32_t buffer_size
;
2433 uint32_t completion_filter
;
2438 uint32_t num_changes
;
2439 struct notify_changes
{
2441 struct smb_wire_string name
;
2446 struct smb2_notify
{
2447 enum smb_notify_level level
;
2450 union smb_handle file
;
2451 /* static body buffer 32 (0x20) bytes */
2452 /* uint16_t buffer_code; 0x32 */
2454 uint32_t buffer_size
;
2455 /*struct smb2_handle file;*/
2456 uint32_t completion_filter
;
2461 /* static body buffer 8 (0x08) bytes */
2462 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2463 /* uint16_t blob_ofs; */
2464 /* uint16_t blob_size; */
2469 /* DATA_BLOB content */
2470 uint32_t num_changes
;
2471 struct notify_changes
*changes
;
2476 enum smb_search_level
{
2477 RAW_SEARCH_SEARCH
, /* SMBsearch */
2478 RAW_SEARCH_FFIRST
, /* SMBffirst */
2479 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2480 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2481 RAW_SEARCH_SMB2
/* SMB2 Find */
2484 enum smb_search_data_level
{
2485 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2486 RAW_SEARCH_DATA_SEARCH
,
2487 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2488 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2489 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2490 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2491 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2492 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2493 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2494 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2495 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2496 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2497 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2500 /* union for file search */
2501 union smb_search_first
{
2503 enum smb_search_level level
;
2504 enum smb_search_data_level data_level
;
2507 /* search (old) findfirst interface.
2508 Also used for ffirst and funique. */
2510 enum smb_search_level level
;
2511 enum smb_search_data_level data_level
;
2515 uint16_t search_attrib
;
2516 const char *pattern
;
2523 /* trans2 findfirst interface */
2525 enum smb_search_level level
;
2526 enum smb_search_data_level data_level
;
2529 uint16_t search_attrib
;
2532 uint32_t storage_type
;
2533 const char *pattern
;
2535 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2536 unsigned int num_names
;
2537 struct ea_name
*ea_names
;
2542 uint16_t end_of_search
;
2548 enum smb_search_level level
;
2549 enum smb_search_data_level data_level
;
2551 union smb_handle file
;
2553 /* static body buffer 32 (0x20) bytes */
2554 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2556 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2557 uint32_t file_index
;
2558 /* struct smb2_handle handle; */
2559 /* uint16_t pattern_ofs; */
2560 /* uint16_t pattern_size; */
2561 uint32_t max_response_size
;
2564 const char *pattern
;
2567 /* static body buffer 8 (0x08) bytes */
2568 /* uint16_t buffer_code; 0x08 */
2569 /* uint16_t blob_ofs; */
2570 /* uint32_t blob_size; */
2578 /* union for file search continue */
2579 union smb_search_next
{
2581 enum smb_search_level level
;
2582 enum smb_search_data_level data_level
;
2585 /* search (old) findnext interface. Also used
2586 for ffirst when continuing */
2588 enum smb_search_level level
;
2589 enum smb_search_data_level data_level
;
2593 uint16_t search_attrib
;
2594 struct smb_search_id
{
2598 uint32_t server_cookie
;
2599 uint32_t client_cookie
;
2607 /* trans2 findnext interface */
2609 enum smb_search_level level
;
2610 enum smb_search_data_level data_level
;
2615 uint32_t resume_key
;
2617 const char *last_name
;
2619 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2620 unsigned int num_names
;
2621 struct ea_name
*ea_names
;
2625 uint16_t end_of_search
;
2630 struct smb2_find smb2
;
2633 /* union for search reply file data */
2634 union smb_search_data
{
2636 * search (old) findfirst
2637 * RAW_SEARCH_DATA_SEARCH
2643 struct smb_search_id id
;
2647 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2649 uint32_t resume_key
;
2654 uint32_t alloc_size
;
2656 struct smb_wire_string name
;
2659 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2661 uint32_t resume_key
;
2666 uint32_t alloc_size
;
2669 struct smb_wire_string name
;
2672 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2674 uint32_t resume_key
;
2679 uint32_t alloc_size
;
2681 struct smb_ea_list eas
;
2682 struct smb_wire_string name
;
2685 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2687 uint32_t file_index
;
2693 uint64_t alloc_size
;
2695 struct smb_wire_string name
;
2698 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2700 uint32_t file_index
;
2706 uint64_t alloc_size
;
2709 struct smb_wire_string name
;
2710 } full_directory_info
;
2712 /* RAW_SEARCH_DATA_NAME_INFO interface */
2714 uint32_t file_index
;
2715 struct smb_wire_string name
;
2718 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2720 uint32_t file_index
;
2726 uint64_t alloc_size
;
2729 struct smb_wire_string short_name
;
2730 struct smb_wire_string name
;
2731 } both_directory_info
;
2733 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2735 uint32_t file_index
;
2741 uint64_t alloc_size
;
2745 struct smb_wire_string name
;
2746 } id_full_directory_info
;
2748 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2750 uint32_t file_index
;
2756 uint64_t alloc_size
;
2760 uint8_t short_name_buf
[24];
2761 struct smb_wire_string short_name
;
2762 struct smb_wire_string name
;
2763 } id_both_directory_info
;
2765 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2767 uint32_t file_index
;
2769 uint64_t alloc_size
;
2770 NTTIME status_change_time
;
2779 uint64_t permissions
;
2784 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2786 uint32_t file_index
;
2787 uint64_t end_of_file
;
2789 NTTIME status_change_time
;
2798 uint64_t permissions
;
2801 uint32_t file_flags
;
2802 uint32_t flags_mask
;
2803 struct smb_wire_string name
;
2807 /* Callback function passed to the raw search interface. */
2808 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2810 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2812 /* union for file search close */
2813 union smb_search_close
{
2815 enum smb_search_close_level level
;
2818 /* SMBfclose (old search) interface */
2820 enum smb_search_close_level level
;
2823 /* max_count and search_attrib are not used, but are present */
2825 uint16_t search_attrib
;
2826 struct smb_search_id id
;
2830 /* SMBfindclose interface */
2832 enum smb_search_close_level level
;
2842 struct for SMBecho call
2846 uint16_t repeat_count
;
2852 uint16_t sequence_number
;
2859 struct for shadow copy volumes
2861 struct smb_shadow_copy
{
2863 union smb_handle file
;
2867 uint32_t num_volumes
;
2873 #endif /* __LIBCLI_RAW_INTERFACES_H__ */