2 Unix SMB/CIFS implementation.
3 SMB request interface structures
4 Copyright (C) Andrew Tridgell 2003
5 Copyright (C) James J Myers 2003 <myersjj@samba.org>
6 Copyright (C) James Peach 2007
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LIBCLI_RAW_INTERFACES_H__
23 #define __LIBCLI_RAW_INTERFACES_H__
25 #include "source4/libcli/raw/smb.h"
26 #include "../libcli/smb/smb_common.h"
27 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
29 /* this structure is just a wrapper for a string, the only reason we
30 bother with this is that it allows us to check the length provided
31 on the wire in testsuite test code to ensure that we are
32 terminating names in the same way that win2003 is. The *ONLY* time
33 you should ever look at the 'private_length' field in this
34 structure is inside compliance test code, in all other cases just
35 use the null terminated char* as the definitive definition of the
38 also note that this structure is only used in packets where there
39 is an explicit length provided on the wire (hence the name). That
40 length is placed in 'private_length'. For packets where the length
41 is always determined by NULL or packet termination a normal char*
42 is used in the structure definition.
44 struct smb_wire_string
{
45 uint32_t private_length
;
50 * SMB2 uses a 16Byte handle,
51 * (we can maybe use struct GUID later)
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
;
188 unsigned int num_eas
;
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
;
287 uint32_t guest_max_access
;
294 /* SMB2 TreeConnect */
295 struct smb2_tree_connect
{
296 enum smb_tcon_level level
;
299 /* static body buffer 8 (0x08) bytes */
301 /* uint16_t path_ofs */
302 /* uint16_t path_size */
304 const char *path
; /* as non-terminated UTF-16 on the wire */
307 /* static body buffer 16 (0x10) bytes */
308 /* uint16_t buffer_code; 0x10 */
312 uint32_t capabilities
;
313 uint32_t access_mask
;
315 /* extracted from the SMB2 header */
322 enum smb_sesssetup_level
{
325 RAW_SESSSETUP_SPNEGO
,
329 /* union used in session_setup call */
330 union smb_sesssetup
{
331 /* the pre-NT1 interface */
333 enum smb_sesssetup_level level
;
355 /* the NT1 interface */
357 enum smb_sesssetup_level level
;
364 uint32_t capabilities
;
382 /* the SPNEGO interface */
384 enum smb_sesssetup_level level
;
391 uint32_t capabilities
;
395 const char *workgroup
;
407 /* SMB2 SessionSetup */
408 struct smb2_session_setup
{
409 enum smb_sesssetup_level level
;
412 /* static body 24 (0x18) bytes */
414 uint8_t security_mode
;
415 uint32_t capabilities
;
417 /* uint16_t secblob_ofs */
418 /* uint16_t secblob_size */
419 uint64_t previous_sessionid
;
424 /* body buffer 8 (0x08) bytes */
425 uint16_t session_flags
;
426 /* uint16_t secblob_ofs */
427 /* uint16_t secblob_size */
431 /* extracted from the SMB2 header */
437 /* Note that the specified enum values are identical to the actual info-levels used
440 enum smb_fileinfo_level
{
441 RAW_FILEINFO_GENERIC
= 0xF000,
442 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
443 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
444 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
445 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
446 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
447 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
448 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
449 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
450 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
451 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
452 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
453 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
454 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
455 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
456 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
457 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
458 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
459 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
460 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
461 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
462 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
463 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
464 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
465 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
466 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
467 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
468 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
469 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
470 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
471 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
472 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
473 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
474 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
475 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
476 /* SMB2 specific levels */
477 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
478 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
481 /* union used in qfileinfo() and qpathinfo() backend calls */
483 /* generic interface:
484 * matches RAW_FILEINFO_GENERIC */
486 enum smb_fileinfo_level level
;
488 union smb_handle_or_path file
;
493 unsigned int num_eas
;
496 struct smb_wire_string name
;
506 struct smb_wire_string fname
;
507 struct smb_wire_string alt_fname
;
508 uint8_t delete_pending
;
510 uint64_t compressed_size
;
514 uint8_t cluster_shift
;
516 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
519 uint32_t alignment_requirement
;
520 uint32_t reparse_tag
;
521 unsigned int num_streams
;
522 struct stream_struct
{
525 struct smb_wire_string stream_name
;
531 /* SMBgetatr interface:
532 * matches RAW_FILEINFO_GETATTR */
534 enum smb_fileinfo_level level
;
536 union smb_handle_or_path file
;
545 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
547 enum smb_fileinfo_level level
;
549 union smb_handle_or_path file
;
559 } getattre
, standard
;
561 /* trans2 RAW_FILEINFO_EA_SIZE interface */
563 enum smb_fileinfo_level level
;
565 union smb_handle_or_path file
;
578 /* trans2 RAW_FILEINFO_EA_LIST interface */
580 enum smb_fileinfo_level level
;
582 union smb_handle_or_path file
;
583 unsigned int num_names
;
585 struct smb_wire_string name
;
590 unsigned int num_eas
;
591 struct ea_struct
*eas
;
595 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
597 enum smb_fileinfo_level level
;
599 union smb_handle_or_path file
;
600 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
601 uint8_t continue_flags
;
603 struct smb_ea_list out
;
606 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
607 only valid for a QPATHNAME call - no returned data */
609 enum smb_fileinfo_level level
;
611 union smb_handle_or_path file
;
615 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
617 enum smb_fileinfo_level level
;
619 union smb_handle_or_path file
;
631 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
633 enum smb_fileinfo_level level
;
635 union smb_handle_or_path file
;
646 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
648 enum smb_fileinfo_level level
;
650 union smb_handle_or_path file
;
657 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
659 enum smb_fileinfo_level level
;
661 union smb_handle_or_path file
;
664 struct smb_wire_string fname
;
668 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
670 enum smb_fileinfo_level level
;
672 union smb_handle_or_path file
;
683 uint8_t delete_pending
;
686 struct smb_wire_string fname
;
690 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
692 enum smb_fileinfo_level level
;
694 union smb_handle_or_path file
;
706 uint8_t delete_pending
;
711 uint32_t access_mask
;
714 uint32_t alignment_requirement
;
715 struct smb_wire_string fname
;
719 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
721 enum smb_fileinfo_level level
;
723 union smb_handle_or_path file
;
726 struct smb_wire_string fname
;
730 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
732 enum smb_fileinfo_level level
;
734 union smb_handle_or_path file
;
736 struct stream_information
{
737 unsigned int num_streams
;
738 struct stream_struct
*streams
;
742 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
744 enum smb_fileinfo_level level
;
746 union smb_handle_or_path file
;
749 uint64_t compressed_size
;
753 uint8_t cluster_shift
;
757 /* RAW_FILEINFO_UNIX_BASIC interface */
759 enum smb_fileinfo_level level
;
761 union smb_handle_or_path file
;
764 uint64_t end_of_file
;
766 NTTIME status_change_time
;
775 uint64_t permissions
;
780 /* RAW_FILEINFO_UNIX_INFO2 interface */
782 enum smb_fileinfo_level level
;
784 union smb_handle_or_path file
;
787 uint64_t end_of_file
;
789 NTTIME status_change_time
;
798 uint64_t permissions
;
806 /* RAW_FILEINFO_UNIX_LINK interface */
808 enum smb_fileinfo_level level
;
810 union smb_handle_or_path file
;
813 struct smb_wire_string link_dest
;
817 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
819 enum smb_fileinfo_level level
;
821 union smb_handle_or_path file
;
826 } internal_information
;
828 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
830 enum smb_fileinfo_level level
;
832 union smb_handle_or_path file
;
835 uint32_t access_flags
;
837 } access_information
;
839 /* RAW_FILEINFO_POSITION_INFORMATION interface */
841 enum smb_fileinfo_level level
;
843 union smb_handle_or_path file
;
848 } position_information
;
850 /* RAW_FILEINFO_MODE_INFORMATION interface */
852 enum smb_fileinfo_level level
;
854 union smb_handle_or_path file
;
861 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
863 enum smb_fileinfo_level level
;
865 union smb_handle_or_path file
;
868 uint32_t alignment_requirement
;
870 } alignment_information
;
872 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
874 enum smb_fileinfo_level level
;
876 union smb_handle_or_path file
;
887 } network_open_information
;
890 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
892 enum smb_fileinfo_level level
;
894 union smb_handle_or_path file
;
898 uint32_t reparse_tag
;
900 } attribute_tag_information
;
902 /* RAW_FILEINFO_SEC_DESC */
904 enum smb_fileinfo_level level
;
906 union smb_handle_or_path file
;
907 uint32_t secinfo_flags
;
910 struct security_descriptor
*sd
;
916 enum smb_setfileinfo_level
{
917 RAW_SFILEINFO_GENERIC
= 0xF000,
918 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
919 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
920 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
921 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
922 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
923 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
924 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
925 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
926 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
927 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
928 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
929 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
930 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
931 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
932 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
933 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
934 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
935 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
936 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
937 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
938 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
939 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
940 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
941 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
942 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
943 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
944 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
945 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
946 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
947 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
948 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
949 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
950 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
951 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
952 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
953 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
955 /* cope with breakage in SMB2 */
956 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
959 /* union used in setfileinfo() and setpathinfo() calls */
960 union smb_setfileinfo
{
961 /* generic interface */
963 enum smb_setfileinfo_level level
;
965 union smb_handle_or_path file
;
969 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
971 enum smb_setfileinfo_level level
;
973 union smb_handle_or_path file
;
979 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
980 also RAW_SFILEINFO_STANDARD */
982 enum smb_setfileinfo_level level
;
984 union smb_handle_or_path file
;
988 /* notice that size, alloc_size and attrib are not settable,
989 unlike the corresponding qfileinfo level */
991 } setattre
, standard
;
993 /* RAW_SFILEINFO_EA_SET interface */
995 enum smb_setfileinfo_level level
;
997 union smb_handle_or_path file
;
998 unsigned int num_eas
;
999 struct ea_struct
*eas
;
1003 /* RAW_SFILEINFO_BASIC_INFO and
1004 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
1006 enum smb_setfileinfo_level level
;
1008 union smb_handle_or_path file
;
1018 /* RAW_SFILEINFO_DISPOSITION_INFO and
1019 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1021 enum smb_setfileinfo_level level
;
1023 union smb_handle_or_path file
;
1024 bool delete_on_close
;
1028 /* RAW_SFILEINFO_ALLOCATION_INFO and
1029 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1031 enum smb_setfileinfo_level level
;
1033 union smb_handle_or_path file
;
1034 /* w2k3 rounds this up to nearest 4096 */
1035 uint64_t alloc_size
;
1039 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1040 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1042 enum smb_setfileinfo_level level
;
1044 union smb_handle_or_path file
;
1049 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1051 enum smb_setfileinfo_level level
;
1053 union smb_handle_or_path file
;
1056 const char *new_name
;
1058 } rename_information
;
1060 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1062 enum smb_setfileinfo_level level
;
1064 union smb_handle_or_path file
;
1067 const char *new_name
;
1071 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1073 enum smb_setfileinfo_level level
;
1075 union smb_handle_or_path file
;
1078 } position_information
;
1080 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1082 enum smb_setfileinfo_level level
;
1084 union smb_handle_or_path file
;
1085 /* valid values seem to be 0, 2, 4 and 6 */
1090 /* RAW_SFILEINFO_UNIX_BASIC interface */
1092 enum smb_setfileinfo_level level
;
1094 union smb_handle_or_path file
;
1095 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1096 uint64_t end_of_file
;
1098 NTTIME status_change_time
;
1107 uint64_t permissions
;
1112 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1114 enum smb_setfileinfo_level level
;
1116 union smb_handle_or_path file
;
1117 uint64_t end_of_file
;
1119 NTTIME status_change_time
;
1128 uint64_t permissions
;
1131 uint32_t file_flags
;
1132 uint32_t flags_mask
;
1136 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1138 enum smb_setfileinfo_level level
;
1140 union smb_handle_or_path file
;
1141 const char *link_dest
;
1143 } unix_link
, unix_hlink
;
1145 /* RAW_SFILEINFO_SEC_DESC */
1147 enum smb_setfileinfo_level level
;
1149 union smb_handle_or_path file
;
1150 uint32_t secinfo_flags
;
1151 struct security_descriptor
*sd
;
1155 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1157 enum smb_setfileinfo_level level
;
1159 union smb_handle_or_path file
;
1160 struct smb_ea_list eas
;
1162 } full_ea_information
;
1166 enum smb_fsinfo_level
{
1167 RAW_QFS_GENERIC
= 0xF000,
1168 RAW_QFS_DSKATTR
, /* SMBdskattr */
1169 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1170 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1171 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1172 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1173 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1174 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1175 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1176 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1177 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1178 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1179 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1180 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1181 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1182 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
};
1185 /* union for fsinfo() backend call. Note that there are no in
1186 structures, as this call only contains out parameters */
1188 /* generic interface */
1190 enum smb_fsinfo_level level
;
1191 struct smb2_handle handle
; /* only for smb2 */
1194 uint32_t block_size
;
1195 uint64_t blocks_total
;
1196 uint64_t blocks_free
;
1199 uint32_t serial_number
;
1201 uint32_t max_file_component_length
;
1202 uint32_t device_type
;
1203 uint32_t device_characteristics
;
1204 uint64_t quota_soft
;
1205 uint64_t quota_hard
;
1206 uint64_t quota_flags
;
1213 /* SMBdskattr interface */
1215 enum smb_fsinfo_level level
;
1218 uint16_t units_total
;
1219 uint16_t blocks_per_unit
;
1220 uint16_t block_size
;
1221 uint16_t units_free
;
1225 /* trans2 RAW_QFS_ALLOCATION interface */
1227 enum smb_fsinfo_level level
;
1231 uint32_t sectors_per_unit
;
1232 uint32_t total_alloc_units
;
1233 uint32_t avail_alloc_units
;
1234 uint16_t bytes_per_sector
;
1238 /* TRANS2 RAW_QFS_VOLUME interface */
1240 enum smb_fsinfo_level level
;
1243 uint32_t serial_number
;
1244 struct smb_wire_string volume_name
;
1248 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1250 enum smb_fsinfo_level level
;
1251 struct smb2_handle handle
; /* only for smb2 */
1255 uint32_t serial_number
;
1256 struct smb_wire_string volume_name
;
1260 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1262 enum smb_fsinfo_level level
;
1263 struct smb2_handle handle
; /* only for smb2 */
1266 uint64_t total_alloc_units
;
1267 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1268 uint32_t sectors_per_unit
;
1269 uint32_t bytes_per_sector
;
1273 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1275 enum smb_fsinfo_level level
;
1276 struct smb2_handle handle
; /* only for smb2 */
1279 uint32_t device_type
;
1280 uint32_t characteristics
;
1285 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1287 enum smb_fsinfo_level level
;
1288 struct smb2_handle handle
; /* only for smb2 */
1292 uint32_t max_file_component_length
;
1293 struct smb_wire_string fs_type
;
1298 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1300 enum smb_fsinfo_level level
;
1303 uint16_t major_version
;
1304 uint16_t minor_version
;
1305 uint64_t capability
;
1309 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1311 enum smb_fsinfo_level level
;
1312 struct smb2_handle handle
; /* only for smb2 */
1315 uint64_t unknown
[3];
1316 uint64_t quota_soft
;
1317 uint64_t quota_hard
;
1318 uint64_t quota_flags
;
1320 } quota_information
;
1322 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1324 enum smb_fsinfo_level level
;
1325 struct smb2_handle handle
; /* only for smb2 */
1328 uint64_t total_alloc_units
;
1329 uint64_t call_avail_alloc_units
;
1330 uint64_t actual_avail_alloc_units
;
1331 uint32_t sectors_per_unit
;
1332 uint32_t bytes_per_sector
;
1334 } full_size_information
;
1336 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1338 enum smb_fsinfo_level level
;
1339 struct smb2_handle handle
; /* only for smb2 */
1343 uint64_t unknown
[6];
1345 } objectid_information
;
1349 enum smb_setfsinfo_level
{
1350 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1352 union smb_setfsinfo
{
1353 /* generic interface */
1355 enum smb_fsinfo_level level
;
1358 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1360 enum smb_fsinfo_level level
;
1363 uint16_t major_version
;
1364 uint16_t minor_version
;
1365 uint64_t capability
;
1370 enum smb_open_level
{
1379 RAW_OPEN_NTTRANS_CREATE
,
1380 RAW_OPEN_OPENX_READX
,
1381 RAW_OPEN_NTCREATEX_READX
,
1385 /* the generic interface is defined to be equal to the NTCREATEX interface */
1386 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1388 /* union for open() backend call */
1391 * because the *.out.file structs are not aligned to the same offset for each level
1392 * we provide a hepler macro that should be used to find the current smb_handle structure
1394 #define SMB_OPEN_OUT_FILE(op, file) do { \
1395 switch (op->generic.level) { \
1396 case RAW_OPEN_OPEN: \
1397 file = &op->openold.out.file; \
1399 case RAW_OPEN_OPENX: \
1400 file = &op->openx.out.file; \
1402 case RAW_OPEN_MKNEW: \
1403 file = &op->mknew.out.file; \
1405 case RAW_OPEN_CREATE: \
1406 file = &op->create.out.file; \
1408 case RAW_OPEN_CTEMP: \
1409 file = &op->ctemp.out.file; \
1411 case RAW_OPEN_SPLOPEN: \
1412 file = &op->splopen.out.file; \
1414 case RAW_OPEN_NTCREATEX: \
1415 file = &op->ntcreatex.out.file; \
1417 case RAW_OPEN_T2OPEN: \
1418 file = &op->t2open.out.file; \
1420 case RAW_OPEN_NTTRANS_CREATE: \
1421 file = &op->nttrans.out.file; \
1423 case RAW_OPEN_OPENX_READX: \
1424 file = &op->openxreadx.out.file; \
1426 case RAW_OPEN_NTCREATEX_READX: \
1427 file = &op->ntcreatexreadx.out.file; \
1429 case RAW_OPEN_SMB2: \
1430 file = &op->smb2.out.file; \
1433 /* this must be a programmer error */ \
1438 /* SMBNTCreateX, nttrans and generic interface */
1440 enum smb_open_level level
;
1443 union smb_handle root_fid
;
1444 uint32_t access_mask
;
1445 uint64_t alloc_size
;
1447 uint32_t share_access
;
1448 uint32_t open_disposition
;
1449 uint32_t create_options
;
1450 uint32_t impersonation
;
1451 uint8_t security_flags
;
1452 /* NOTE: fname can also be a pointer to a
1453 uint64_t file_id if create_options has the
1454 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1457 /* these last 2 elements are only used in the
1458 NTTRANS varient of the call */
1459 struct security_descriptor
*sec_desc
;
1460 struct smb_ea_list
*ea_list
;
1462 /* some optional parameters from the SMB2 varient */
1463 bool query_maximal_access
;
1465 /* private flags for internal use only */
1466 uint8_t private_flags
;
1469 union smb_handle file
;
1470 uint8_t oplock_level
;
1471 uint32_t create_action
;
1477 uint64_t alloc_size
;
1481 uint8_t is_directory
;
1483 /* optional return values matching SMB2 tagged
1484 values in the call */
1485 uint32_t maximal_access
;
1487 } ntcreatex
, nttrans
, generic
;
1489 /* TRANS2_OPEN interface */
1491 enum smb_open_level level
;
1495 uint16_t search_attrs
;
1496 uint16_t file_attrs
;
1502 unsigned int num_eas
;
1503 struct ea_struct
*eas
;
1506 union smb_handle file
;
1518 /* SMBopen interface */
1520 enum smb_open_level level
;
1523 uint16_t search_attrs
;
1527 union smb_handle file
;
1535 /* SMBopenX interface */
1537 enum smb_open_level level
;
1541 uint16_t search_attrs
; /* not honoured by win2003 */
1542 uint16_t file_attrs
;
1543 time_t write_time
; /* not honoured by win2003 */
1545 uint32_t size
; /* note that this sets the
1546 initial file size, not
1547 just allocation size */
1548 uint32_t timeout
; /* not honoured by win2003 */
1552 union smb_handle file
;
1560 uint32_t unique_fid
;
1561 uint32_t access_mask
;
1566 /* SMBmknew interface */
1568 enum smb_open_level level
;
1575 union smb_handle file
;
1579 /* SMBctemp interface */
1581 enum smb_open_level level
;
1585 const char *directory
;
1588 union smb_handle file
;
1589 /* temp name, relative to directory */
1594 /* SMBsplopen interface */
1596 enum smb_open_level level
;
1598 uint16_t setup_length
;
1603 union smb_handle file
;
1608 /* chained OpenX/ReadX interface */
1610 enum smb_open_level level
;
1614 uint16_t search_attrs
; /* not honoured by win2003 */
1615 uint16_t file_attrs
;
1616 time_t write_time
; /* not honoured by win2003 */
1618 uint32_t size
; /* note that this sets the
1619 initial file size, not
1620 just allocation size */
1621 uint32_t timeout
; /* not honoured by win2003 */
1631 union smb_handle file
;
1639 uint32_t unique_fid
;
1640 uint32_t access_mask
;
1646 uint16_t compaction_mode
;
1651 /* chained NTCreateX/ReadX interface */
1653 enum smb_open_level level
;
1656 union smb_handle root_fid
;
1657 uint32_t access_mask
;
1658 uint64_t alloc_size
;
1660 uint32_t share_access
;
1661 uint32_t open_disposition
;
1662 uint32_t create_options
;
1663 uint32_t impersonation
;
1664 uint8_t security_flags
;
1665 /* NOTE: fname can also be a pointer to a
1666 uint64_t file_id if create_options has the
1667 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1677 union smb_handle file
;
1678 uint8_t oplock_level
;
1679 uint32_t create_action
;
1685 uint64_t alloc_size
;
1689 uint8_t is_directory
;
1694 uint16_t compaction_mode
;
1699 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1700 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1701 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1702 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1705 struct smb2_create
{
1706 enum smb_open_level level
;
1708 /* static body buffer 56 (0x38) bytes */
1709 uint8_t security_flags
; /* SMB2_SECURITY_* */
1710 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1711 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1712 uint64_t create_flags
;
1714 uint32_t desired_access
;
1715 uint32_t file_attributes
;
1716 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1717 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1718 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1720 /* uint16_t fname_ofs */
1721 /* uint16_t fname_size */
1722 /* uint32_t blob_ofs; */
1723 /* uint32_t blob_size; */
1728 /* now some optional parameters - encoded as tagged blobs */
1729 struct smb_ea_list eas
;
1730 uint64_t alloc_size
;
1731 struct security_descriptor
*sec_desc
;
1733 struct smb2_handle
*durable_handle
;
1735 /* data for durable handle v2 */
1736 bool durable_open_v2
;
1737 struct GUID create_guid
;
1738 bool persistent_open
;
1740 struct smb2_handle
*durable_handle_v2
;
1742 bool query_maximal_access
;
1744 bool query_on_disk_id
;
1745 struct smb2_lease
*lease_request
;
1747 /* and any additional blobs the caller wants */
1748 struct smb2_create_blobs blobs
;
1751 union smb_handle file
;
1753 /* static body buffer 88 (0x58) bytes */
1754 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1755 uint8_t oplock_level
;
1757 uint32_t create_action
;
1762 uint64_t alloc_size
;
1766 /* struct smb2_handle handle;*/
1767 /* uint32_t blob_ofs; */
1768 /* uint32_t blob_size; */
1770 /* optional return values matching tagged values in the call */
1771 uint32_t maximal_access
;
1772 uint8_t on_disk_id
[32];
1773 struct smb2_lease lease_response
;
1776 /* durable handle v2 */
1777 bool durable_open_v2
;
1778 bool persistent_open
;
1781 /* tagged blobs in the reply */
1782 struct smb2_create_blobs blobs
;
1789 enum smb_read_level
{
1797 #define RAW_READ_GENERIC RAW_READ_READX
1799 /* union for read() backend call
1801 note that .infoX.out.data will be allocated before the backend is
1802 called. It will be big enough to hold the maximum size asked for
1805 /* SMBreadX (and generic) interface */
1807 enum smb_read_level level
;
1809 union smb_handle file
;
1811 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1814 bool read_for_execute
;
1819 uint16_t compaction_mode
;
1824 /* SMBreadbraw interface */
1826 enum smb_read_level level
;
1828 union smb_handle file
;
1841 /* SMBlockandread interface */
1843 enum smb_read_level level
;
1845 union smb_handle file
;
1856 /* SMBread interface */
1858 enum smb_read_level level
;
1860 union smb_handle file
;
1873 enum smb_read_level level
;
1875 union smb_handle file
;
1877 /* static body buffer 48 (0x30) bytes */
1878 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1883 /* struct smb2_handle handle; */
1887 /* the docs give no indication of what
1888 these channel variables are for */
1889 uint16_t channel_offset
;
1890 uint16_t channel_length
;
1893 /* static body buffer 16 (0x10) bytes */
1894 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1895 /* uint8_t data_ofs; */
1896 /* uint8_t reserved; */
1897 /* uint32_t data_size; */
1908 enum smb_write_level
{
1909 RAW_WRITE_WRITEUNLOCK
,
1912 RAW_WRITE_WRITECLOSE
,
1917 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1919 /* union for write() backend call
1922 /* SMBwriteX interface */
1924 enum smb_write_level level
;
1926 union smb_handle file
;
1931 const uint8_t *data
;
1939 /* SMBwriteunlock interface */
1941 enum smb_write_level level
;
1943 union smb_handle file
;
1947 const uint8_t *data
;
1954 /* SMBwrite interface */
1956 enum smb_write_level level
;
1958 union smb_handle file
;
1962 const uint8_t *data
;
1969 /* SMBwriteclose interface */
1971 enum smb_write_level level
;
1973 union smb_handle file
;
1977 const uint8_t *data
;
1984 /* SMBsplwrite interface */
1986 enum smb_write_level level
;
1988 union smb_handle file
;
1990 const uint8_t *data
;
1996 enum smb_write_level level
;
1998 union smb_handle file
;
2000 /* static body buffer 48 (0x30) bytes */
2001 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2002 /* uint16_t data_ofs; */
2003 /* uint32_t data_size; */
2005 /* struct smb2_handle handle; */
2006 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2007 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2013 /* static body buffer 17 (0x11) bytes */
2014 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2017 uint64_t unknown1
; /* 0x0000000000000000 */
2023 enum smb_lock_level
{
2031 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2033 /* union for lock() backend call
2036 /* SMBlockingX and generic interface */
2038 enum smb_lock_level level
;
2040 union smb_handle file
;
2045 struct smb_lock_entry
{
2046 uint32_t pid
; /* 16 bits in SMB1 */
2049 } *locks
; /* unlocks are first in the arrray */
2053 /* SMBlock and SMBunlock interface */
2055 enum smb_lock_level level
;
2057 union smb_handle file
;
2065 enum smb_lock_level level
;
2067 union smb_handle file
;
2069 /* static body buffer 48 (0x30) bytes */
2070 /* uint16_t buffer_code; 0x30 */
2071 uint16_t lock_count
;
2072 uint32_t lock_sequence
;
2073 /* struct smb2_handle handle; */
2074 struct smb2_lock_element
{
2082 /* static body buffer 4 (0x04) bytes */
2083 /* uint16_t buffer_code; 0x04 */
2090 enum smb_lock_level level
;
2092 union smb_handle file
;
2094 /* static body buffer 24 (0x18) bytes */
2095 uint8_t oplock_level
;
2098 /* struct smb2_handle handle; */
2102 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2103 struct smb2_lease_break_ack
{
2106 struct smb2_lease lease
;
2108 } smb2_lease_break_ack
;
2112 enum smb_close_level
{
2120 union for close() backend call
2123 /* generic interface */
2125 enum smb_close_level level
;
2127 union smb_handle file
;
2129 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2137 uint64_t alloc_size
;
2143 /* SMBclose interface */
2145 enum smb_close_level level
;
2147 union smb_handle file
;
2152 /* SMBsplclose interface - empty! */
2154 enum smb_close_level level
;
2156 union smb_handle file
;
2162 enum smb_close_level level
;
2164 union smb_handle file
;
2166 /* static body buffer 24 (0x18) bytes */
2167 /* uint16_t buffer_code; 0x18 */
2168 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2172 /* static body buffer 60 (0x3C) bytes */
2173 /* uint16_t buffer_code; 0x3C */
2180 uint64_t alloc_size
;
2188 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2191 union for lpq() backend
2194 /* generic interface */
2196 enum smb_lpq_level level
;
2201 /* SMBsplretq interface */
2203 enum smb_lpq_level level
;
2211 uint16_t restart_idx
;
2223 enum smb_ioctl_level
{
2227 RAW_IOCTL_SMB2_NO_HANDLE
2231 union for ioctl() backend
2234 /* generic interface */
2236 enum smb_ioctl_level level
;
2238 union smb_handle file
;
2242 /* struct for SMBioctl */
2244 enum smb_ioctl_level level
;
2246 union smb_handle file
;
2255 /* struct for NT ioctl call */
2257 enum smb_ioctl_level level
;
2259 union smb_handle file
;
2273 enum smb_ioctl_level level
;
2275 union smb_handle file
;
2277 /* static body buffer 56 (0x38) bytes */
2278 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2281 /*struct smb2_handle handle;*/
2282 /* uint32_t out_ofs; */
2283 /* uint32_t out_size; */
2285 /* uint32_t in_ofs; */
2286 /* uint32_t in_size; */
2287 uint32_t max_response_size
;
2295 union smb_handle file
;
2297 /* static body buffer 48 (0x30) bytes */
2298 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2301 /* struct smb2_handle handle; */
2302 /* uint32_t in_ofs; */
2303 /* uint32_t in_size; */
2304 /* uint32_t out_ofs; */
2305 /* uint32_t out_size; */
2316 enum smb_flush_level
{
2323 /* struct for SMBflush */
2325 enum smb_flush_level level
;
2327 union smb_handle file
;
2331 /* SMBflush with 0xFFFF wildcard fnum */
2333 enum smb_flush_level level
;
2338 enum smb_flush_level level
;
2340 union smb_handle file
;
2350 /* struct for SMBcopy */
2365 /* struct for transact/transact2 call */
2373 uint8_t setup_count
;
2375 const char *trans_name
; /* SMBtrans only */
2381 uint8_t setup_count
;
2388 /* struct for nttransact2 call */
2389 struct smb_nttrans
{
2394 uint8_t setup_count
;
2402 uint8_t setup_count
; /* in units of 16 bit words */
2409 enum smb_notify_level
{
2415 /* struct for nttrans change notify call */
2417 enum smb_notify_level level
;
2420 union smb_handle file
;
2421 uint32_t buffer_size
;
2422 uint32_t completion_filter
;
2427 uint32_t num_changes
;
2428 struct notify_changes
{
2430 struct smb_wire_string name
;
2435 struct smb2_notify
{
2436 enum smb_notify_level level
;
2439 union smb_handle file
;
2440 /* static body buffer 32 (0x20) bytes */
2441 /* uint16_t buffer_code; 0x32 */
2443 uint32_t buffer_size
;
2444 /*struct smb2_handle file;*/
2445 uint32_t completion_filter
;
2450 /* static body buffer 8 (0x08) bytes */
2451 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2452 /* uint16_t blob_ofs; */
2453 /* uint16_t blob_size; */
2458 /* DATA_BLOB content */
2459 uint32_t num_changes
;
2460 struct notify_changes
*changes
;
2465 enum smb_search_level
{
2466 RAW_SEARCH_SEARCH
, /* SMBsearch */
2467 RAW_SEARCH_FFIRST
, /* SMBffirst */
2468 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2469 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2470 RAW_SEARCH_SMB2
/* SMB2 Find */
2473 enum smb_search_data_level
{
2474 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2475 RAW_SEARCH_DATA_SEARCH
,
2476 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2477 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2478 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2479 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2480 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2481 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2482 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2483 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2484 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2485 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2486 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2489 /* union for file search */
2490 union smb_search_first
{
2492 enum smb_search_level level
;
2493 enum smb_search_data_level data_level
;
2496 /* search (old) findfirst interface.
2497 Also used for ffirst and funique. */
2499 enum smb_search_level level
;
2500 enum smb_search_data_level data_level
;
2504 uint16_t search_attrib
;
2505 const char *pattern
;
2512 /* trans2 findfirst interface */
2514 enum smb_search_level level
;
2515 enum smb_search_data_level data_level
;
2518 uint16_t search_attrib
;
2521 uint32_t storage_type
;
2522 const char *pattern
;
2524 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2525 unsigned int num_names
;
2526 struct ea_name
*ea_names
;
2531 uint16_t end_of_search
;
2537 enum smb_search_level level
;
2538 enum smb_search_data_level data_level
;
2540 union smb_handle file
;
2542 /* static body buffer 32 (0x20) bytes */
2543 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2545 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2546 uint32_t file_index
;
2547 /* struct smb2_handle handle; */
2548 /* uint16_t pattern_ofs; */
2549 /* uint16_t pattern_size; */
2550 uint32_t max_response_size
;
2553 const char *pattern
;
2556 /* static body buffer 8 (0x08) bytes */
2557 /* uint16_t buffer_code; 0x08 */
2558 /* uint16_t blob_ofs; */
2559 /* uint32_t blob_size; */
2567 /* union for file search continue */
2568 union smb_search_next
{
2570 enum smb_search_level level
;
2571 enum smb_search_data_level data_level
;
2574 /* search (old) findnext interface. Also used
2575 for ffirst when continuing */
2577 enum smb_search_level level
;
2578 enum smb_search_data_level data_level
;
2582 uint16_t search_attrib
;
2583 struct smb_search_id
{
2587 uint32_t server_cookie
;
2588 uint32_t client_cookie
;
2596 /* trans2 findnext interface */
2598 enum smb_search_level level
;
2599 enum smb_search_data_level data_level
;
2604 uint32_t resume_key
;
2606 const char *last_name
;
2608 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2609 unsigned int num_names
;
2610 struct ea_name
*ea_names
;
2614 uint16_t end_of_search
;
2619 struct smb2_find smb2
;
2622 /* union for search reply file data */
2623 union smb_search_data
{
2625 * search (old) findfirst
2626 * RAW_SEARCH_DATA_SEARCH
2632 struct smb_search_id id
;
2636 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2638 uint32_t resume_key
;
2643 uint32_t alloc_size
;
2645 struct smb_wire_string name
;
2648 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2650 uint32_t resume_key
;
2655 uint32_t alloc_size
;
2658 struct smb_wire_string name
;
2661 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2663 uint32_t resume_key
;
2668 uint32_t alloc_size
;
2670 struct smb_ea_list eas
;
2671 struct smb_wire_string name
;
2674 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2676 uint32_t file_index
;
2682 uint64_t alloc_size
;
2684 struct smb_wire_string name
;
2687 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2689 uint32_t file_index
;
2695 uint64_t alloc_size
;
2698 struct smb_wire_string name
;
2699 } full_directory_info
;
2701 /* RAW_SEARCH_DATA_NAME_INFO interface */
2703 uint32_t file_index
;
2704 struct smb_wire_string name
;
2707 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2709 uint32_t file_index
;
2715 uint64_t alloc_size
;
2718 struct smb_wire_string short_name
;
2719 struct smb_wire_string name
;
2720 } both_directory_info
;
2722 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2724 uint32_t file_index
;
2730 uint64_t alloc_size
;
2734 struct smb_wire_string name
;
2735 } id_full_directory_info
;
2737 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2739 uint32_t file_index
;
2745 uint64_t alloc_size
;
2749 struct smb_wire_string short_name
;
2750 struct smb_wire_string name
;
2751 } id_both_directory_info
;
2753 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2755 uint32_t file_index
;
2757 uint64_t alloc_size
;
2758 NTTIME status_change_time
;
2767 uint64_t permissions
;
2772 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2774 uint32_t file_index
;
2775 uint64_t end_of_file
;
2777 NTTIME status_change_time
;
2786 uint64_t permissions
;
2789 uint32_t file_flags
;
2790 uint32_t flags_mask
;
2791 struct smb_wire_string name
;
2795 /* Callback function passed to the raw search interface. */
2796 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2798 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2800 /* union for file search close */
2801 union smb_search_close
{
2803 enum smb_search_close_level level
;
2806 /* SMBfclose (old search) interface */
2808 enum smb_search_close_level level
;
2811 /* max_count and search_attrib are not used, but are present */
2813 uint16_t search_attrib
;
2814 struct smb_search_id id
;
2818 /* SMBfindclose interface */
2820 enum smb_search_close_level level
;
2830 struct for SMBecho call
2834 uint16_t repeat_count
;
2840 uint16_t sequence_number
;
2847 struct for shadow copy volumes
2849 struct smb_shadow_copy
{
2851 union smb_handle file
;
2855 uint32_t num_volumes
;
2861 #endif /* __LIBCLI_RAW_INTERFACES_H__ */