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 "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)
58 SMB2 lease structure (per MS-SMB2 2.2.13)
60 struct smb2_lease_key
{
65 struct smb2_lease_key lease_key
;
67 uint32_t lease_flags
; /* should be 0 */
68 uint64_t lease_duration
; /* should be 0 */
71 struct smb2_lease_break
{
72 struct smb2_lease current_lease
;
74 uint32_t new_lease_state
;
75 uint32_t break_reason
; /* should be 0 */
76 uint32_t access_mask_hint
; /* should be 0 */
77 uint32_t share_mask_hint
; /* should be 0 */
83 * a generic container for file handles or file pathes
84 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
86 union smb_handle_or_path
{
89 * the qpathinfo and setpathinfo
94 * this is used as file handle in SMB
99 * this is used as file handle in SMB2
101 struct smb2_handle handle
;
104 * this is used as generic file handle for the NTVFS layer
106 struct ntvfs_handle
*ntvfs
;
110 a generic container for file handles
114 * this is used as file handle in SMB
119 * this is used as file handle in SMB2
121 struct smb2_handle handle
;
124 * this is used as generic file handle for the NTVFS layer
126 struct ntvfs_handle
*ntvfs
;
130 this header defines the structures and unions used between the SMB
131 parser and the backends.
134 /* struct used for SMBlseek call */
138 union smb_handle file
;
140 int32_t offset
; /* signed */
148 /* struct used in unlink() call */
159 /* struct used in chkpath() call */
168 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
170 /* union used in mkdir() call */
174 enum smb_mkdir_level level
;
178 enum smb_mkdir_level level
;
185 enum smb_mkdir_level level
;
189 struct ea_struct
*eas
;
194 /* struct used in rmdir() call */
201 /* struct used in rename() call */
202 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
206 enum smb_rename_level level
;
209 /* SMBrename interface */
211 enum smb_rename_level level
;
214 const char *pattern1
;
215 const char *pattern2
;
221 /* SMBntrename interface */
223 enum smb_rename_level level
;
227 uint16_t flags
; /* see RENAME_FLAG_* */
228 uint32_t cluster_size
;
229 const char *old_name
;
230 const char *new_name
;
234 /* NT TRANS rename interface */
236 enum smb_rename_level level
;
239 union smb_handle file
;
240 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
241 const char *new_name
;
246 enum smb_tcon_level
{
252 /* union used in tree connect call */
254 /* generic interface */
256 enum smb_tcon_level level
;
259 /* SMBtcon interface */
261 enum smb_tcon_level level
;
265 const char *password
;
274 /* SMBtconX interface */
276 enum smb_tcon_level level
;
292 /* SMB2 TreeConnect */
293 struct smb2_tree_connect
{
294 enum smb_tcon_level level
;
297 /* static body buffer 8 (0x08) bytes */
299 /* uint16_t path_ofs */
300 /* uint16_t path_size */
302 const char *path
; /* as non-terminated UTF-16 on the wire */
305 /* static body buffer 16 (0x10) bytes */
306 /* uint16_t buffer_code; 0x10 */
310 uint32_t capabilities
;
311 uint32_t access_mask
;
313 /* extracted from the SMB2 header */
320 enum smb_sesssetup_level
{
323 RAW_SESSSETUP_SPNEGO
,
327 /* union used in session_setup call */
328 union smb_sesssetup
{
329 /* the pre-NT1 interface */
331 enum smb_sesssetup_level level
;
353 /* the NT1 interface */
355 enum smb_sesssetup_level level
;
362 uint32_t capabilities
;
380 /* the SPNEGO interface */
382 enum smb_sesssetup_level level
;
389 uint32_t capabilities
;
393 const char *workgroup
;
405 /* SMB2 SessionSetup */
406 struct smb2_session_setup
{
407 enum smb_sesssetup_level level
;
410 /* static body 24 (0x18) bytes */
412 uint8_t security_mode
;
413 uint32_t capabilities
;
415 /* uint16_t secblob_ofs */
416 /* uint16_t secblob_size */
417 uint64_t previous_sessionid
;
422 /* body buffer 8 (0x08) bytes */
423 uint16_t session_flags
;
424 /* uint16_t secblob_ofs */
425 /* uint16_t secblob_size */
429 /* extracted from the SMB2 header */
435 /* Note that the specified enum values are identical to the actual info-levels used
438 enum smb_fileinfo_level
{
439 RAW_FILEINFO_GENERIC
= 0xF000,
440 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
441 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
442 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
443 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
444 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
445 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
446 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
447 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
448 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
449 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
450 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
451 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
452 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
453 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
454 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
455 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
456 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
457 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
458 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
459 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
460 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
461 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
462 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
463 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
464 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
465 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
466 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
467 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
468 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
469 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
470 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
471 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
472 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
473 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
474 /* SMB2 specific levels */
475 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
476 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
479 /* union used in qfileinfo() and qpathinfo() backend calls */
481 /* generic interface:
482 * matches RAW_FILEINFO_GENERIC */
484 enum smb_fileinfo_level level
;
486 union smb_handle_or_path file
;
494 struct smb_wire_string name
;
504 struct smb_wire_string fname
;
505 struct smb_wire_string alt_fname
;
506 uint8_t delete_pending
;
508 uint64_t compressed_size
;
512 uint8_t cluster_shift
;
514 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
517 uint32_t alignment_requirement
;
518 uint32_t reparse_tag
;
520 struct stream_struct
{
523 struct smb_wire_string stream_name
;
529 /* SMBgetatr interface:
530 * matches RAW_FILEINFO_GETATTR */
532 enum smb_fileinfo_level level
;
534 union smb_handle_or_path file
;
543 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
545 enum smb_fileinfo_level level
;
547 union smb_handle_or_path file
;
557 } getattre
, standard
;
559 /* trans2 RAW_FILEINFO_EA_SIZE interface */
561 enum smb_fileinfo_level level
;
563 union smb_handle_or_path file
;
576 /* trans2 RAW_FILEINFO_EA_LIST interface */
578 enum smb_fileinfo_level level
;
580 union smb_handle_or_path file
;
583 struct smb_wire_string name
;
589 struct ea_struct
*eas
;
593 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
595 enum smb_fileinfo_level level
;
597 union smb_handle_or_path file
;
598 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
599 uint8_t continue_flags
;
601 struct smb_ea_list out
;
604 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
605 only valid for a QPATHNAME call - no returned data */
607 enum smb_fileinfo_level level
;
609 union smb_handle_or_path file
;
613 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
615 enum smb_fileinfo_level level
;
617 union smb_handle_or_path file
;
629 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
631 enum smb_fileinfo_level level
;
633 union smb_handle_or_path file
;
644 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
646 enum smb_fileinfo_level level
;
648 union smb_handle_or_path file
;
655 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
657 enum smb_fileinfo_level level
;
659 union smb_handle_or_path file
;
662 struct smb_wire_string fname
;
666 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
668 enum smb_fileinfo_level level
;
670 union smb_handle_or_path file
;
681 uint8_t delete_pending
;
684 struct smb_wire_string fname
;
688 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
690 enum smb_fileinfo_level level
;
692 union smb_handle_or_path file
;
704 uint8_t delete_pending
;
709 uint32_t access_mask
;
712 uint32_t alignment_requirement
;
713 struct smb_wire_string fname
;
717 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
719 enum smb_fileinfo_level level
;
721 union smb_handle_or_path file
;
724 struct smb_wire_string fname
;
728 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
730 enum smb_fileinfo_level level
;
732 union smb_handle_or_path file
;
734 struct stream_information
{
736 struct stream_struct
*streams
;
740 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
742 enum smb_fileinfo_level level
;
744 union smb_handle_or_path file
;
747 uint64_t compressed_size
;
751 uint8_t cluster_shift
;
755 /* RAW_FILEINFO_UNIX_BASIC interface */
757 enum smb_fileinfo_level level
;
759 union smb_handle_or_path file
;
762 uint64_t end_of_file
;
764 NTTIME status_change_time
;
773 uint64_t permissions
;
778 /* RAW_FILEINFO_UNIX_INFO2 interface */
780 enum smb_fileinfo_level level
;
782 union smb_handle_or_path file
;
785 uint64_t end_of_file
;
787 NTTIME status_change_time
;
796 uint64_t permissions
;
804 /* RAW_FILEINFO_UNIX_LINK interface */
806 enum smb_fileinfo_level level
;
808 union smb_handle_or_path file
;
811 struct smb_wire_string link_dest
;
815 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
817 enum smb_fileinfo_level level
;
819 union smb_handle_or_path file
;
824 } internal_information
;
826 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
828 enum smb_fileinfo_level level
;
830 union smb_handle_or_path file
;
833 uint32_t access_flags
;
835 } access_information
;
837 /* RAW_FILEINFO_POSITION_INFORMATION interface */
839 enum smb_fileinfo_level level
;
841 union smb_handle_or_path file
;
846 } position_information
;
848 /* RAW_FILEINFO_MODE_INFORMATION interface */
850 enum smb_fileinfo_level level
;
852 union smb_handle_or_path file
;
859 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
861 enum smb_fileinfo_level level
;
863 union smb_handle_or_path file
;
866 uint32_t alignment_requirement
;
868 } alignment_information
;
870 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
872 enum smb_fileinfo_level level
;
874 union smb_handle_or_path file
;
885 } network_open_information
;
888 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
890 enum smb_fileinfo_level level
;
892 union smb_handle_or_path file
;
896 uint32_t reparse_tag
;
898 } attribute_tag_information
;
900 /* RAW_FILEINFO_SEC_DESC */
902 enum smb_fileinfo_level level
;
904 union smb_handle_or_path file
;
905 uint32_t secinfo_flags
;
908 struct security_descriptor
*sd
;
914 enum smb_setfileinfo_level
{
915 RAW_SFILEINFO_GENERIC
= 0xF000,
916 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
917 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
918 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
919 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
920 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
921 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
922 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
923 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
924 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
925 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
926 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
927 RAW_SFILEINFO_UNIX_LINK
= SMB_SFILEINFO_UNIX_LINK
,
928 RAW_SFILEINFO_UNIX_HLINK
= SMB_SFILEINFO_UNIX_HLINK
,
929 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
930 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
931 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
932 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
933 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
934 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
935 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
936 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
937 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
938 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
939 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
940 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
941 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
942 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
943 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
944 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
945 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
946 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
947 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
948 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
949 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
950 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
951 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
953 /* cope with breakage in SMB2 */
954 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
957 /* union used in setfileinfo() and setpathinfo() calls */
958 union smb_setfileinfo
{
959 /* generic interface */
961 enum smb_setfileinfo_level level
;
963 union smb_handle_or_path file
;
967 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
969 enum smb_setfileinfo_level level
;
971 union smb_handle_or_path file
;
977 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
978 also RAW_SFILEINFO_STANDARD */
980 enum smb_setfileinfo_level level
;
982 union smb_handle_or_path file
;
986 /* notice that size, alloc_size and attrib are not settable,
987 unlike the corresponding qfileinfo level */
989 } setattre
, standard
;
991 /* RAW_SFILEINFO_EA_SET interface */
993 enum smb_setfileinfo_level level
;
995 union smb_handle_or_path file
;
997 struct ea_struct
*eas
;
1001 /* RAW_SFILEINFO_BASIC_INFO and
1002 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
1004 enum smb_setfileinfo_level level
;
1006 union smb_handle_or_path file
;
1016 /* RAW_SFILEINFO_DISPOSITION_INFO and
1017 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1019 enum smb_setfileinfo_level level
;
1021 union smb_handle_or_path file
;
1022 bool delete_on_close
;
1026 /* RAW_SFILEINFO_ALLOCATION_INFO and
1027 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1029 enum smb_setfileinfo_level level
;
1031 union smb_handle_or_path file
;
1032 /* w2k3 rounds this up to nearest 4096 */
1033 uint64_t alloc_size
;
1037 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1038 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1040 enum smb_setfileinfo_level level
;
1042 union smb_handle_or_path file
;
1047 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1049 enum smb_setfileinfo_level level
;
1051 union smb_handle_or_path file
;
1054 const char *new_name
;
1056 } rename_information
;
1058 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1060 enum smb_setfileinfo_level level
;
1062 union smb_handle_or_path file
;
1065 const char *new_name
;
1069 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1071 enum smb_setfileinfo_level level
;
1073 union smb_handle_or_path file
;
1076 } position_information
;
1078 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1080 enum smb_setfileinfo_level level
;
1082 union smb_handle_or_path file
;
1083 /* valid values seem to be 0, 2, 4 and 6 */
1088 /* RAW_SFILEINFO_UNIX_BASIC interface */
1090 enum smb_setfileinfo_level level
;
1092 union smb_handle_or_path file
;
1093 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1094 uint64_t end_of_file
;
1096 NTTIME status_change_time
;
1105 uint64_t permissions
;
1110 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1112 enum smb_setfileinfo_level level
;
1114 union smb_handle_or_path file
;
1115 uint64_t end_of_file
;
1117 NTTIME status_change_time
;
1126 uint64_t permissions
;
1129 uint32_t file_flags
;
1130 uint32_t flags_mask
;
1134 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1136 enum smb_setfileinfo_level level
;
1138 union smb_handle_or_path file
;
1139 const char *link_dest
;
1141 } unix_link
, unix_hlink
;
1143 /* RAW_FILEINFO_SET_SEC_DESC */
1145 enum smb_setfileinfo_level level
;
1147 union smb_handle_or_path file
;
1148 uint32_t secinfo_flags
;
1149 struct security_descriptor
*sd
;
1153 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1155 enum smb_setfileinfo_level level
;
1157 union smb_handle_or_path file
;
1158 struct smb_ea_list eas
;
1160 } full_ea_information
;
1164 enum smb_fsinfo_level
{
1165 RAW_QFS_GENERIC
= 0xF000,
1166 RAW_QFS_DSKATTR
, /* SMBdskattr */
1167 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1168 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1169 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1170 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1171 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1172 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1173 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1174 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1175 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1176 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1177 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1178 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1179 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1180 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
};
1183 /* union for fsinfo() backend call. Note that there are no in
1184 structures, as this call only contains out parameters */
1186 /* generic interface */
1188 enum smb_fsinfo_level level
;
1189 struct smb2_handle handle
; /* only for smb2 */
1192 uint32_t block_size
;
1193 uint64_t blocks_total
;
1194 uint64_t blocks_free
;
1197 uint32_t serial_number
;
1199 uint32_t max_file_component_length
;
1200 uint32_t device_type
;
1201 uint32_t device_characteristics
;
1202 uint64_t quota_soft
;
1203 uint64_t quota_hard
;
1204 uint64_t quota_flags
;
1211 /* SMBdskattr interface */
1213 enum smb_fsinfo_level level
;
1216 uint16_t units_total
;
1217 uint16_t blocks_per_unit
;
1218 uint16_t block_size
;
1219 uint16_t units_free
;
1223 /* trans2 RAW_QFS_ALLOCATION interface */
1225 enum smb_fsinfo_level level
;
1229 uint32_t sectors_per_unit
;
1230 uint32_t total_alloc_units
;
1231 uint32_t avail_alloc_units
;
1232 uint16_t bytes_per_sector
;
1236 /* TRANS2 RAW_QFS_VOLUME interface */
1238 enum smb_fsinfo_level level
;
1241 uint32_t serial_number
;
1242 struct smb_wire_string volume_name
;
1246 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1248 enum smb_fsinfo_level level
;
1249 struct smb2_handle handle
; /* only for smb2 */
1253 uint32_t serial_number
;
1254 struct smb_wire_string volume_name
;
1258 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1260 enum smb_fsinfo_level level
;
1261 struct smb2_handle handle
; /* only for smb2 */
1264 uint64_t total_alloc_units
;
1265 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1266 uint32_t sectors_per_unit
;
1267 uint32_t bytes_per_sector
;
1271 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1273 enum smb_fsinfo_level level
;
1274 struct smb2_handle handle
; /* only for smb2 */
1277 uint32_t device_type
;
1278 uint32_t characteristics
;
1283 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1285 enum smb_fsinfo_level level
;
1286 struct smb2_handle handle
; /* only for smb2 */
1290 uint32_t max_file_component_length
;
1291 struct smb_wire_string fs_type
;
1296 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1298 enum smb_fsinfo_level level
;
1301 uint16_t major_version
;
1302 uint16_t minor_version
;
1303 uint64_t capability
;
1307 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1309 enum smb_fsinfo_level level
;
1310 struct smb2_handle handle
; /* only for smb2 */
1313 uint64_t unknown
[3];
1314 uint64_t quota_soft
;
1315 uint64_t quota_hard
;
1316 uint64_t quota_flags
;
1318 } quota_information
;
1320 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1322 enum smb_fsinfo_level level
;
1323 struct smb2_handle handle
; /* only for smb2 */
1326 uint64_t total_alloc_units
;
1327 uint64_t call_avail_alloc_units
;
1328 uint64_t actual_avail_alloc_units
;
1329 uint32_t sectors_per_unit
;
1330 uint32_t bytes_per_sector
;
1332 } full_size_information
;
1334 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1336 enum smb_fsinfo_level level
;
1337 struct smb2_handle handle
; /* only for smb2 */
1341 uint64_t unknown
[6];
1343 } objectid_information
;
1348 enum smb_open_level
{
1357 RAW_OPEN_NTTRANS_CREATE
,
1358 RAW_OPEN_OPENX_READX
,
1362 /* the generic interface is defined to be equal to the NTCREATEX interface */
1363 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1365 /* union for open() backend call */
1368 * because the *.out.file structs are not aligned to the same offset for each level
1369 * we provide a hepler macro that should be used to find the current smb_handle structure
1371 #define SMB_OPEN_OUT_FILE(op, file) do { \
1372 switch (op->generic.level) { \
1373 case RAW_OPEN_OPEN: \
1374 file = &op->openold.out.file; \
1376 case RAW_OPEN_OPENX: \
1377 file = &op->openx.out.file; \
1379 case RAW_OPEN_MKNEW: \
1380 file = &op->mknew.out.file; \
1382 case RAW_OPEN_CREATE: \
1383 file = &op->create.out.file; \
1385 case RAW_OPEN_CTEMP: \
1386 file = &op->ctemp.out.file; \
1388 case RAW_OPEN_SPLOPEN: \
1389 file = &op->splopen.out.file; \
1391 case RAW_OPEN_NTCREATEX: \
1392 file = &op->ntcreatex.out.file; \
1394 case RAW_OPEN_T2OPEN: \
1395 file = &op->t2open.out.file; \
1397 case RAW_OPEN_NTTRANS_CREATE: \
1398 file = &op->nttrans.out.file; \
1400 case RAW_OPEN_OPENX_READX: \
1401 file = &op->openxreadx.out.file; \
1403 case RAW_OPEN_SMB2: \
1404 file = &op->smb2.out.file; \
1407 /* this must be a programmer error */ \
1412 /* SMBNTCreateX, nttrans and generic interface */
1414 enum smb_open_level level
;
1418 uint32_t access_mask
;
1419 uint64_t alloc_size
;
1421 uint32_t share_access
;
1422 uint32_t open_disposition
;
1423 uint32_t create_options
;
1424 uint32_t impersonation
;
1425 uint8_t security_flags
;
1426 /* NOTE: fname can also be a pointer to a
1427 uint64_t file_id if create_options has the
1428 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1431 /* these last 2 elements are only used in the
1432 NTTRANS varient of the call */
1433 struct security_descriptor
*sec_desc
;
1434 struct smb_ea_list
*ea_list
;
1436 /* some optional parameters from the SMB2 varient */
1437 bool query_maximal_access
;
1440 union smb_handle file
;
1441 uint8_t oplock_level
;
1442 uint32_t create_action
;
1448 uint64_t alloc_size
;
1452 uint8_t is_directory
;
1454 /* optional return values matching SMB2 tagged
1455 values in the call */
1456 uint32_t maximal_access
;
1458 } ntcreatex
, nttrans
, generic
;
1460 /* TRANS2_OPEN interface */
1462 enum smb_open_level level
;
1466 uint16_t search_attrs
;
1467 uint16_t file_attrs
;
1474 struct ea_struct
*eas
;
1477 union smb_handle file
;
1489 /* SMBopen interface */
1491 enum smb_open_level level
;
1494 uint16_t search_attrs
;
1498 union smb_handle file
;
1506 /* SMBopenX interface */
1508 enum smb_open_level level
;
1512 uint16_t search_attrs
; /* not honoured by win2003 */
1513 uint16_t file_attrs
;
1514 time_t write_time
; /* not honoured by win2003 */
1516 uint32_t size
; /* note that this sets the
1517 initial file size, not
1518 just allocation size */
1519 uint32_t timeout
; /* not honoured by win2003 */
1523 union smb_handle file
;
1531 uint32_t unique_fid
;
1532 uint32_t access_mask
;
1537 /* SMBmknew interface */
1539 enum smb_open_level level
;
1546 union smb_handle file
;
1550 /* SMBctemp interface */
1552 enum smb_open_level level
;
1556 const char *directory
;
1559 union smb_handle file
;
1560 /* temp name, relative to directory */
1565 /* SMBsplopen interface */
1567 enum smb_open_level level
;
1569 uint16_t setup_length
;
1574 union smb_handle file
;
1579 /* chained OpenX/ReadX interface */
1581 enum smb_open_level level
;
1585 uint16_t search_attrs
; /* not honoured by win2003 */
1586 uint16_t file_attrs
;
1587 time_t write_time
; /* not honoured by win2003 */
1589 uint32_t size
; /* note that this sets the
1590 initial file size, not
1591 just allocation size */
1592 uint32_t timeout
; /* not honoured by win2003 */
1602 union smb_handle file
;
1610 uint32_t unique_fid
;
1611 uint32_t access_mask
;
1617 uint16_t compaction_mode
;
1622 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1623 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1624 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1625 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1628 struct smb2_create
{
1629 enum smb_open_level level
;
1631 /* static body buffer 56 (0x38) bytes */
1632 uint8_t security_flags
; /* SMB2_SECURITY_* */
1633 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1634 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1635 uint64_t create_flags
;
1637 uint32_t desired_access
;
1638 uint32_t file_attributes
;
1639 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1640 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1641 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1643 /* uint16_t fname_ofs */
1644 /* uint16_t fname_size */
1645 /* uint32_t blob_ofs; */
1646 /* uint32_t blob_size; */
1651 /* now some optional parameters - encoded as tagged blobs */
1652 struct smb_ea_list eas
;
1653 uint64_t alloc_size
;
1654 struct security_descriptor
*sec_desc
;
1656 struct smb2_handle
*durable_handle
;
1657 bool query_maximal_access
;
1659 bool query_on_disk_id
;
1660 struct smb2_lease
*lease_request
;
1662 /* and any additional blobs the caller wants */
1663 struct smb2_create_blobs blobs
;
1666 union smb_handle file
;
1668 /* static body buffer 88 (0x58) bytes */
1669 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1670 uint8_t oplock_level
;
1672 uint32_t create_action
;
1677 uint64_t alloc_size
;
1681 /* struct smb2_handle handle;*/
1682 /* uint32_t blob_ofs; */
1683 /* uint32_t blob_size; */
1685 /* optional return values matching tagged values in the call */
1686 uint32_t maximal_access
;
1687 uint8_t on_disk_id
[32];
1688 struct smb2_lease lease_response
;
1690 /* tagged blobs in the reply */
1691 struct smb2_create_blobs blobs
;
1698 enum smb_read_level
{
1706 #define RAW_READ_GENERIC RAW_READ_READX
1708 /* union for read() backend call
1710 note that .infoX.out.data will be allocated before the backend is
1711 called. It will be big enough to hold the maximum size asked for
1714 /* SMBreadX (and generic) interface */
1716 enum smb_read_level level
;
1718 union smb_handle file
;
1720 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1723 bool read_for_execute
;
1728 uint16_t compaction_mode
;
1733 /* SMBreadbraw interface */
1735 enum smb_read_level level
;
1737 union smb_handle file
;
1750 /* SMBlockandread interface */
1752 enum smb_read_level level
;
1754 union smb_handle file
;
1765 /* SMBread interface */
1767 enum smb_read_level level
;
1769 union smb_handle file
;
1782 enum smb_read_level level
;
1784 union smb_handle file
;
1786 /* static body buffer 48 (0x30) bytes */
1787 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1792 /* struct smb2_handle handle; */
1796 /* the docs give no indication of what
1797 these channel variables are for */
1798 uint16_t channel_offset
;
1799 uint16_t channel_length
;
1802 /* static body buffer 16 (0x10) bytes */
1803 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1804 /* uint8_t data_ofs; */
1805 /* uint8_t reserved; */
1806 /* uint32_t data_size; */
1817 enum smb_write_level
{
1818 RAW_WRITE_WRITEUNLOCK
,
1821 RAW_WRITE_WRITECLOSE
,
1826 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1828 /* union for write() backend call
1831 /* SMBwriteX interface */
1833 enum smb_write_level level
;
1835 union smb_handle file
;
1840 const uint8_t *data
;
1848 /* SMBwriteunlock interface */
1850 enum smb_write_level level
;
1852 union smb_handle file
;
1856 const uint8_t *data
;
1863 /* SMBwrite interface */
1865 enum smb_write_level level
;
1867 union smb_handle file
;
1871 const uint8_t *data
;
1878 /* SMBwriteclose interface */
1880 enum smb_write_level level
;
1882 union smb_handle file
;
1886 const uint8_t *data
;
1893 /* SMBsplwrite interface */
1895 enum smb_write_level level
;
1897 union smb_handle file
;
1899 const uint8_t *data
;
1905 enum smb_write_level level
;
1907 union smb_handle file
;
1909 /* static body buffer 48 (0x30) bytes */
1910 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1911 /* uint16_t data_ofs; */
1912 /* uint32_t data_size; */
1914 /* struct smb2_handle handle; */
1915 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
1916 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
1922 /* static body buffer 17 (0x11) bytes */
1923 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
1926 uint64_t unknown1
; /* 0x0000000000000000 */
1932 enum smb_lock_level
{
1940 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1942 /* union for lock() backend call
1945 /* SMBlockingX and generic interface */
1947 enum smb_lock_level level
;
1949 union smb_handle file
;
1954 struct smb_lock_entry
{
1955 uint32_t pid
; /* 16 bits in SMB1 */
1958 } *locks
; /* unlocks are first in the arrray */
1962 /* SMBlock and SMBunlock interface */
1964 enum smb_lock_level level
;
1966 union smb_handle file
;
1974 enum smb_lock_level level
;
1976 union smb_handle file
;
1978 /* static body buffer 48 (0x30) bytes */
1979 /* uint16_t buffer_code; 0x30 */
1980 uint16_t lock_count
;
1982 /* struct smb2_handle handle; */
1983 struct smb2_lock_element
{
1991 /* static body buffer 4 (0x04) bytes */
1992 /* uint16_t buffer_code; 0x04 */
1999 enum smb_lock_level level
;
2001 union smb_handle file
;
2003 /* static body buffer 24 (0x18) bytes */
2004 uint8_t oplock_level
;
2007 /* struct smb2_handle handle; */
2011 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2012 struct smb2_lease_break_ack
{
2015 struct smb2_lease lease
;
2017 } smb2_lease_break_ack
;
2021 enum smb_close_level
{
2029 union for close() backend call
2032 /* generic interface */
2034 enum smb_close_level level
;
2036 union smb_handle file
;
2038 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
2039 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2047 uint64_t alloc_size
;
2053 /* SMBclose interface */
2055 enum smb_close_level level
;
2057 union smb_handle file
;
2062 /* SMBsplclose interface - empty! */
2064 enum smb_close_level level
;
2066 union smb_handle file
;
2072 enum smb_close_level level
;
2074 union smb_handle file
;
2076 /* static body buffer 24 (0x18) bytes */
2077 /* uint16_t buffer_code; 0x18 */
2078 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2082 /* static body buffer 60 (0x3C) bytes */
2083 /* uint16_t buffer_code; 0x3C */
2090 uint64_t alloc_size
;
2098 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2101 union for lpq() backend
2104 /* generic interface */
2106 enum smb_lpq_level level
;
2111 /* SMBsplretq interface */
2113 enum smb_lpq_level level
;
2121 uint16_t restart_idx
;
2133 enum smb_ioctl_level
{
2137 RAW_IOCTL_SMB2_NO_HANDLE
2141 union for ioctl() backend
2144 /* generic interface */
2146 enum smb_ioctl_level level
;
2148 union smb_handle file
;
2152 /* struct for SMBioctl */
2154 enum smb_ioctl_level level
;
2156 union smb_handle file
;
2165 /* struct for NT ioctl call */
2167 enum smb_ioctl_level level
;
2169 union smb_handle file
;
2183 enum smb_ioctl_level level
;
2185 union smb_handle file
;
2187 /* static body buffer 56 (0x38) bytes */
2188 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2191 /*struct smb2_handle handle;*/
2192 /* uint32_t out_ofs; */
2193 /* uint32_t out_size; */
2195 /* uint32_t in_ofs; */
2196 /* uint32_t in_size; */
2197 uint32_t max_response_size
;
2205 union smb_handle file
;
2207 /* static body buffer 48 (0x30) bytes */
2208 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2211 /* struct smb2_handle handle; */
2212 /* uint32_t in_ofs; */
2213 /* uint32_t in_size; */
2214 /* uint32_t out_ofs; */
2215 /* uint32_t out_size; */
2226 enum smb_flush_level
{
2233 /* struct for SMBflush */
2235 enum smb_flush_level level
;
2237 union smb_handle file
;
2241 /* SMBflush with 0xFFFF wildcard fnum */
2243 enum smb_flush_level level
;
2248 enum smb_flush_level level
;
2250 union smb_handle file
;
2260 /* struct for SMBcopy */
2275 /* struct for transact/transact2 call */
2283 uint8_t setup_count
;
2285 const char *trans_name
; /* SMBtrans only */
2291 uint8_t setup_count
;
2298 /* struct for nttransact2 call */
2299 struct smb_nttrans
{
2304 uint8_t setup_count
;
2312 uint8_t setup_count
; /* in units of 16 bit words */
2319 enum smb_notify_level
{
2325 /* struct for nttrans change notify call */
2327 enum smb_notify_level level
;
2330 union smb_handle file
;
2331 uint32_t buffer_size
;
2332 uint32_t completion_filter
;
2337 uint32_t num_changes
;
2338 struct notify_changes
{
2340 struct smb_wire_string name
;
2345 struct smb2_notify
{
2346 enum smb_notify_level level
;
2349 union smb_handle file
;
2350 /* static body buffer 32 (0x20) bytes */
2351 /* uint16_t buffer_code; 0x32 */
2353 uint32_t buffer_size
;
2354 /*struct smb2_handle file;*/
2355 uint32_t completion_filter
;
2360 /* static body buffer 8 (0x08) bytes */
2361 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2362 /* uint16_t blob_ofs; */
2363 /* uint16_t blob_size; */
2368 /* DATA_BLOB content */
2369 uint32_t num_changes
;
2370 struct notify_changes
*changes
;
2375 enum smb_search_level
{
2376 RAW_SEARCH_SEARCH
, /* SMBsearch */
2377 RAW_SEARCH_FFIRST
, /* SMBffirst */
2378 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2379 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2380 RAW_SEARCH_SMB2
/* SMB2 Find */
2383 enum smb_search_data_level
{
2384 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2385 RAW_SEARCH_DATA_SEARCH
,
2386 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2387 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2388 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2389 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2390 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2391 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2392 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2393 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2394 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2395 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2396 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2399 /* union for file search */
2400 union smb_search_first
{
2402 enum smb_search_level level
;
2403 enum smb_search_data_level data_level
;
2406 /* search (old) findfirst interface.
2407 Also used for ffirst and funique. */
2409 enum smb_search_level level
;
2410 enum smb_search_data_level data_level
;
2414 uint16_t search_attrib
;
2415 const char *pattern
;
2422 /* trans2 findfirst interface */
2424 enum smb_search_level level
;
2425 enum smb_search_data_level data_level
;
2428 uint16_t search_attrib
;
2431 uint32_t storage_type
;
2432 const char *pattern
;
2434 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2436 struct ea_name
*ea_names
;
2441 uint16_t end_of_search
;
2447 enum smb_search_level level
;
2448 enum smb_search_data_level data_level
;
2450 union smb_handle file
;
2452 /* static body buffer 32 (0x20) bytes */
2453 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2455 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2456 uint32_t file_index
;
2457 /* struct smb2_handle handle; */
2458 /* uint16_t pattern_ofs; */
2459 /* uint16_t pattern_size; */
2460 uint32_t max_response_size
;
2463 const char *pattern
;
2466 /* static body buffer 8 (0x08) bytes */
2467 /* uint16_t buffer_code; 0x08 */
2468 /* uint16_t blob_ofs; */
2469 /* uint32_t blob_size; */
2477 /* union for file search continue */
2478 union smb_search_next
{
2480 enum smb_search_level level
;
2481 enum smb_search_data_level data_level
;
2484 /* search (old) findnext interface. Also used
2485 for ffirst when continuing */
2487 enum smb_search_level level
;
2488 enum smb_search_data_level data_level
;
2492 uint16_t search_attrib
;
2493 struct smb_search_id
{
2497 uint32_t server_cookie
;
2498 uint32_t client_cookie
;
2506 /* trans2 findnext interface */
2508 enum smb_search_level level
;
2509 enum smb_search_data_level data_level
;
2514 uint32_t resume_key
;
2516 const char *last_name
;
2518 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2520 struct ea_name
*ea_names
;
2524 uint16_t end_of_search
;
2529 struct smb2_find smb2
;
2532 /* union for search reply file data */
2533 union smb_search_data
{
2535 * search (old) findfirst
2536 * RAW_SEARCH_DATA_SEARCH
2542 struct smb_search_id id
;
2546 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2548 uint32_t resume_key
;
2553 uint32_t alloc_size
;
2555 struct smb_wire_string name
;
2558 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2560 uint32_t resume_key
;
2565 uint32_t alloc_size
;
2568 struct smb_wire_string name
;
2571 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2573 uint32_t resume_key
;
2578 uint32_t alloc_size
;
2580 struct smb_ea_list eas
;
2581 struct smb_wire_string name
;
2584 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2586 uint32_t file_index
;
2592 uint64_t alloc_size
;
2594 struct smb_wire_string name
;
2597 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2599 uint32_t file_index
;
2605 uint64_t alloc_size
;
2608 struct smb_wire_string name
;
2609 } full_directory_info
;
2611 /* RAW_SEARCH_DATA_NAME_INFO interface */
2613 uint32_t file_index
;
2614 struct smb_wire_string name
;
2617 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2619 uint32_t file_index
;
2625 uint64_t alloc_size
;
2628 struct smb_wire_string short_name
;
2629 struct smb_wire_string name
;
2630 } both_directory_info
;
2632 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2634 uint32_t file_index
;
2640 uint64_t alloc_size
;
2644 struct smb_wire_string name
;
2645 } id_full_directory_info
;
2647 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2649 uint32_t file_index
;
2655 uint64_t alloc_size
;
2659 struct smb_wire_string short_name
;
2660 struct smb_wire_string name
;
2661 } id_both_directory_info
;
2663 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2665 uint32_t file_index
;
2667 uint64_t alloc_size
;
2668 NTTIME status_change_time
;
2677 uint64_t permissions
;
2682 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2684 uint32_t file_index
;
2685 uint64_t end_of_file
;
2687 NTTIME status_change_time
;
2696 uint64_t permissions
;
2699 uint32_t file_flags
;
2700 uint32_t flags_mask
;
2701 struct smb_wire_string name
;
2705 /* Callback function passed to the raw search interface. */
2706 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2708 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2710 /* union for file search close */
2711 union smb_search_close
{
2713 enum smb_search_close_level level
;
2716 /* SMBfclose (old search) interface */
2718 enum smb_search_close_level level
;
2721 /* max_count and search_attrib are not used, but are present */
2723 uint16_t search_attrib
;
2724 struct smb_search_id id
;
2728 /* SMBfindclose interface */
2730 enum smb_search_close_level level
;
2740 struct for SMBecho call
2744 uint16_t repeat_count
;
2750 uint16_t sequence_number
;
2757 struct for shadow copy volumes
2759 struct smb_shadow_copy
{
2761 union smb_handle file
;
2765 uint32_t num_volumes
;
2771 #endif /* __LIBCLI_RAW_INTERFACES_H__ */