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
;
61 uint32_t new_lease_state
;
62 uint32_t break_reason
; /* should be 0 */
63 uint32_t access_mask_hint
; /* should be 0 */
64 uint32_t share_mask_hint
; /* should be 0 */
70 * a generic container for file handles or file pathes
71 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
73 union smb_handle_or_path
{
76 * the qpathinfo and setpathinfo
81 * this is used as file handle in SMB
86 * this is used as file handle in SMB2
88 struct smb2_handle handle
;
91 * this is used as generic file handle for the NTVFS layer
93 struct ntvfs_handle
*ntvfs
;
97 a generic container for file handles
101 * this is used as file handle in SMB
106 * this is used as file handle in SMB2
108 struct smb2_handle handle
;
111 * this is used as generic file handle for the NTVFS layer
113 struct ntvfs_handle
*ntvfs
;
117 this header defines the structures and unions used between the SMB
118 parser and the backends.
121 /* struct used for SMBlseek call */
125 union smb_handle file
;
127 int32_t offset
; /* signed */
135 /* struct used in unlink() call */
146 /* struct used in chkpath() call */
155 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
157 /* union used in mkdir() call */
161 enum smb_mkdir_level level
;
165 enum smb_mkdir_level level
;
172 enum smb_mkdir_level level
;
175 unsigned int num_eas
;
176 struct ea_struct
*eas
;
181 /* struct used in rmdir() call */
188 /* struct used in rename() call */
189 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
193 enum smb_rename_level level
;
196 /* SMBrename interface */
198 enum smb_rename_level level
;
201 const char *pattern1
;
202 const char *pattern2
;
208 /* SMBntrename interface */
210 enum smb_rename_level level
;
214 uint16_t flags
; /* see RENAME_FLAG_* */
215 uint32_t cluster_size
;
216 const char *old_name
;
217 const char *new_name
;
221 /* NT TRANS rename interface */
223 enum smb_rename_level level
;
226 union smb_handle file
;
227 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
228 const char *new_name
;
233 enum smb_tcon_level
{
239 /* union used in tree connect call */
241 /* generic interface */
243 enum smb_tcon_level level
;
246 /* SMBtcon interface */
248 enum smb_tcon_level level
;
252 const char *password
;
261 /* SMBtconX interface */
263 enum smb_tcon_level level
;
274 uint32_t guest_max_access
;
281 /* SMB2 TreeConnect */
282 struct smb2_tree_connect
{
283 enum smb_tcon_level level
;
286 /* static body buffer 8 (0x08) bytes */
288 /* uint16_t path_ofs */
289 /* uint16_t path_size */
291 const char *path
; /* as non-terminated UTF-16 on the wire */
294 /* static body buffer 16 (0x10) bytes */
295 /* uint16_t buffer_code; 0x10 */
299 uint32_t capabilities
;
300 uint32_t access_mask
;
302 /* extracted from the SMB2 header */
309 enum smb_sesssetup_level
{
312 RAW_SESSSETUP_SPNEGO
,
316 /* union used in session_setup call */
317 union smb_sesssetup
{
318 /* the pre-NT1 interface */
320 enum smb_sesssetup_level level
;
342 /* the NT1 interface */
344 enum smb_sesssetup_level level
;
351 uint32_t capabilities
;
369 /* the SPNEGO interface */
371 enum smb_sesssetup_level level
;
378 uint32_t capabilities
;
382 const char *workgroup
;
394 /* SMB2 SessionSetup */
395 struct smb2_session_setup
{
396 enum smb_sesssetup_level level
;
399 /* static body 24 (0x18) bytes */
401 uint8_t security_mode
;
402 uint32_t capabilities
;
404 /* uint16_t secblob_ofs */
405 /* uint16_t secblob_size */
406 uint64_t previous_sessionid
;
411 /* body buffer 8 (0x08) bytes */
412 uint16_t session_flags
;
413 /* uint16_t secblob_ofs */
414 /* uint16_t secblob_size */
418 /* extracted from the SMB2 header */
424 /* Note that the specified enum values are identical to the actual info-levels used
427 enum smb_fileinfo_level
{
428 RAW_FILEINFO_GENERIC
= 0xF000,
429 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
430 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
431 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
432 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
433 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
434 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
435 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
436 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
437 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
438 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
439 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
440 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
441 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
442 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
443 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
444 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
445 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
446 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
447 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
448 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
449 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
450 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
451 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
452 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
453 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
454 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
455 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
456 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
457 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
458 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
459 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
460 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
461 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
462 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
463 /* SMB2 specific levels */
464 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
465 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
468 /* union used in qfileinfo() and qpathinfo() backend calls */
470 /* generic interface:
471 * matches RAW_FILEINFO_GENERIC */
473 enum smb_fileinfo_level level
;
475 union smb_handle_or_path file
;
480 unsigned int num_eas
;
483 struct smb_wire_string name
;
493 struct smb_wire_string fname
;
494 struct smb_wire_string alt_fname
;
495 uint8_t delete_pending
;
497 uint64_t compressed_size
;
501 uint8_t cluster_shift
;
503 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
506 uint32_t alignment_requirement
;
507 uint32_t reparse_tag
;
508 unsigned int num_streams
;
509 struct stream_struct
{
512 struct smb_wire_string stream_name
;
518 /* SMBgetatr interface:
519 * matches RAW_FILEINFO_GETATTR */
521 enum smb_fileinfo_level level
;
523 union smb_handle_or_path file
;
532 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
534 enum smb_fileinfo_level level
;
536 union smb_handle_or_path file
;
546 } getattre
, standard
;
548 /* trans2 RAW_FILEINFO_EA_SIZE interface */
550 enum smb_fileinfo_level level
;
552 union smb_handle_or_path file
;
565 /* trans2 RAW_FILEINFO_EA_LIST interface */
567 enum smb_fileinfo_level level
;
569 union smb_handle_or_path file
;
570 unsigned int num_names
;
572 struct smb_wire_string name
;
577 unsigned int num_eas
;
578 struct ea_struct
*eas
;
582 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
584 enum smb_fileinfo_level level
;
586 union smb_handle_or_path file
;
587 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
588 uint8_t continue_flags
;
590 struct smb_ea_list out
;
593 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
594 only valid for a QPATHNAME call - no returned data */
596 enum smb_fileinfo_level level
;
598 union smb_handle_or_path file
;
602 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
604 enum smb_fileinfo_level level
;
606 union smb_handle_or_path file
;
618 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
620 enum smb_fileinfo_level level
;
622 union smb_handle_or_path file
;
633 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
635 enum smb_fileinfo_level level
;
637 union smb_handle_or_path file
;
644 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
646 enum smb_fileinfo_level level
;
648 union smb_handle_or_path file
;
651 struct smb_wire_string fname
;
655 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
657 enum smb_fileinfo_level level
;
659 union smb_handle_or_path file
;
670 uint8_t delete_pending
;
673 struct smb_wire_string fname
;
677 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
679 enum smb_fileinfo_level level
;
681 union smb_handle_or_path file
;
693 uint8_t delete_pending
;
698 uint32_t access_mask
;
701 uint32_t alignment_requirement
;
702 struct smb_wire_string fname
;
706 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
708 enum smb_fileinfo_level level
;
710 union smb_handle_or_path file
;
713 struct smb_wire_string fname
;
717 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
719 enum smb_fileinfo_level level
;
721 union smb_handle_or_path file
;
723 struct stream_information
{
724 unsigned int num_streams
;
725 struct stream_struct
*streams
;
729 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
731 enum smb_fileinfo_level level
;
733 union smb_handle_or_path file
;
736 uint64_t compressed_size
;
740 uint8_t cluster_shift
;
744 /* RAW_FILEINFO_UNIX_BASIC interface */
746 enum smb_fileinfo_level level
;
748 union smb_handle_or_path file
;
751 uint64_t end_of_file
;
753 NTTIME status_change_time
;
762 uint64_t permissions
;
767 /* RAW_FILEINFO_UNIX_INFO2 interface */
769 enum smb_fileinfo_level level
;
771 union smb_handle_or_path file
;
774 uint64_t end_of_file
;
776 NTTIME status_change_time
;
785 uint64_t permissions
;
793 /* RAW_FILEINFO_UNIX_LINK interface */
795 enum smb_fileinfo_level level
;
797 union smb_handle_or_path file
;
800 struct smb_wire_string link_dest
;
804 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
806 enum smb_fileinfo_level level
;
808 union smb_handle_or_path file
;
813 } internal_information
;
815 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
817 enum smb_fileinfo_level level
;
819 union smb_handle_or_path file
;
822 uint32_t access_flags
;
824 } access_information
;
826 /* RAW_FILEINFO_POSITION_INFORMATION interface */
828 enum smb_fileinfo_level level
;
830 union smb_handle_or_path file
;
835 } position_information
;
837 /* RAW_FILEINFO_MODE_INFORMATION interface */
839 enum smb_fileinfo_level level
;
841 union smb_handle_or_path file
;
848 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
850 enum smb_fileinfo_level level
;
852 union smb_handle_or_path file
;
855 uint32_t alignment_requirement
;
857 } alignment_information
;
859 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
861 enum smb_fileinfo_level level
;
863 union smb_handle_or_path file
;
874 } network_open_information
;
877 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
879 enum smb_fileinfo_level level
;
881 union smb_handle_or_path file
;
885 uint32_t reparse_tag
;
887 } attribute_tag_information
;
889 /* RAW_FILEINFO_SEC_DESC */
891 enum smb_fileinfo_level level
;
893 union smb_handle_or_path file
;
894 uint32_t secinfo_flags
;
897 struct security_descriptor
*sd
;
903 enum smb_setfileinfo_level
{
904 RAW_SFILEINFO_GENERIC
= 0xF000,
905 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
906 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
907 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
908 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
909 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
910 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
911 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
912 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
913 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
914 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
915 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
916 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
917 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
918 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
919 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
920 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
921 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
922 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
923 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
924 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
925 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
926 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
927 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
928 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
929 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
930 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
931 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
932 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
933 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
934 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
935 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
936 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
937 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
938 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
939 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
940 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
942 /* cope with breakage in SMB2 */
943 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
946 /* union used in setfileinfo() and setpathinfo() calls */
947 union smb_setfileinfo
{
948 /* generic interface */
950 enum smb_setfileinfo_level level
;
952 union smb_handle_or_path file
;
956 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
958 enum smb_setfileinfo_level level
;
960 union smb_handle_or_path file
;
966 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
967 also RAW_SFILEINFO_STANDARD */
969 enum smb_setfileinfo_level level
;
971 union smb_handle_or_path file
;
975 /* notice that size, alloc_size and attrib are not settable,
976 unlike the corresponding qfileinfo level */
978 } setattre
, standard
;
980 /* RAW_SFILEINFO_EA_SET interface */
982 enum smb_setfileinfo_level level
;
984 union smb_handle_or_path file
;
985 unsigned int num_eas
;
986 struct ea_struct
*eas
;
990 /* RAW_SFILEINFO_BASIC_INFO and
991 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
993 enum smb_setfileinfo_level level
;
995 union smb_handle_or_path file
;
1005 /* RAW_SFILEINFO_DISPOSITION_INFO and
1006 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1008 enum smb_setfileinfo_level level
;
1010 union smb_handle_or_path file
;
1011 bool delete_on_close
;
1015 /* RAW_SFILEINFO_ALLOCATION_INFO and
1016 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1018 enum smb_setfileinfo_level level
;
1020 union smb_handle_or_path file
;
1021 /* w2k3 rounds this up to nearest 4096 */
1022 uint64_t alloc_size
;
1026 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1027 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1029 enum smb_setfileinfo_level level
;
1031 union smb_handle_or_path file
;
1036 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1038 enum smb_setfileinfo_level level
;
1040 union smb_handle_or_path file
;
1043 const char *new_name
;
1045 } rename_information
;
1047 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1049 enum smb_setfileinfo_level level
;
1051 union smb_handle_or_path file
;
1054 const char *new_name
;
1058 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1060 enum smb_setfileinfo_level level
;
1062 union smb_handle_or_path file
;
1065 } position_information
;
1067 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1069 enum smb_setfileinfo_level level
;
1071 union smb_handle_or_path file
;
1072 /* valid values seem to be 0, 2, 4 and 6 */
1077 /* RAW_SFILEINFO_UNIX_BASIC interface */
1079 enum smb_setfileinfo_level level
;
1081 union smb_handle_or_path file
;
1082 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1083 uint64_t end_of_file
;
1085 NTTIME status_change_time
;
1094 uint64_t permissions
;
1099 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1101 enum smb_setfileinfo_level level
;
1103 union smb_handle_or_path file
;
1104 uint64_t end_of_file
;
1106 NTTIME status_change_time
;
1115 uint64_t permissions
;
1118 uint32_t file_flags
;
1119 uint32_t flags_mask
;
1123 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1125 enum smb_setfileinfo_level level
;
1127 union smb_handle_or_path file
;
1128 const char *link_dest
;
1130 } unix_link
, unix_hlink
;
1132 /* RAW_SFILEINFO_SEC_DESC */
1134 enum smb_setfileinfo_level level
;
1136 union smb_handle_or_path file
;
1137 uint32_t secinfo_flags
;
1138 struct security_descriptor
*sd
;
1142 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1144 enum smb_setfileinfo_level level
;
1146 union smb_handle_or_path file
;
1147 struct smb_ea_list eas
;
1149 } full_ea_information
;
1153 enum smb_fsinfo_level
{
1154 RAW_QFS_GENERIC
= 0xF000,
1155 RAW_QFS_DSKATTR
, /* SMBdskattr */
1156 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1157 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1158 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1159 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1160 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1161 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1162 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1163 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1164 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1165 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1166 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1167 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1168 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1169 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
};
1172 /* union for fsinfo() backend call. Note that there are no in
1173 structures, as this call only contains out parameters */
1175 /* generic interface */
1177 enum smb_fsinfo_level level
;
1178 struct smb2_handle handle
; /* only for smb2 */
1181 uint32_t block_size
;
1182 uint64_t blocks_total
;
1183 uint64_t blocks_free
;
1186 uint32_t serial_number
;
1188 uint32_t max_file_component_length
;
1189 uint32_t device_type
;
1190 uint32_t device_characteristics
;
1191 uint64_t quota_soft
;
1192 uint64_t quota_hard
;
1193 uint64_t quota_flags
;
1200 /* SMBdskattr interface */
1202 enum smb_fsinfo_level level
;
1205 uint16_t units_total
;
1206 uint16_t blocks_per_unit
;
1207 uint16_t block_size
;
1208 uint16_t units_free
;
1212 /* trans2 RAW_QFS_ALLOCATION interface */
1214 enum smb_fsinfo_level level
;
1218 uint32_t sectors_per_unit
;
1219 uint32_t total_alloc_units
;
1220 uint32_t avail_alloc_units
;
1221 uint16_t bytes_per_sector
;
1225 /* TRANS2 RAW_QFS_VOLUME interface */
1227 enum smb_fsinfo_level level
;
1230 uint32_t serial_number
;
1231 struct smb_wire_string volume_name
;
1235 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1237 enum smb_fsinfo_level level
;
1238 struct smb2_handle handle
; /* only for smb2 */
1242 uint32_t serial_number
;
1243 struct smb_wire_string volume_name
;
1247 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1249 enum smb_fsinfo_level level
;
1250 struct smb2_handle handle
; /* only for smb2 */
1253 uint64_t total_alloc_units
;
1254 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1255 uint32_t sectors_per_unit
;
1256 uint32_t bytes_per_sector
;
1260 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1262 enum smb_fsinfo_level level
;
1263 struct smb2_handle handle
; /* only for smb2 */
1266 uint32_t device_type
;
1267 uint32_t characteristics
;
1272 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1274 enum smb_fsinfo_level level
;
1275 struct smb2_handle handle
; /* only for smb2 */
1279 uint32_t max_file_component_length
;
1280 struct smb_wire_string fs_type
;
1285 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1287 enum smb_fsinfo_level level
;
1290 uint16_t major_version
;
1291 uint16_t minor_version
;
1292 uint64_t capability
;
1296 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1298 enum smb_fsinfo_level level
;
1299 struct smb2_handle handle
; /* only for smb2 */
1302 uint64_t unknown
[3];
1303 uint64_t quota_soft
;
1304 uint64_t quota_hard
;
1305 uint64_t quota_flags
;
1307 } quota_information
;
1309 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1311 enum smb_fsinfo_level level
;
1312 struct smb2_handle handle
; /* only for smb2 */
1315 uint64_t total_alloc_units
;
1316 uint64_t call_avail_alloc_units
;
1317 uint64_t actual_avail_alloc_units
;
1318 uint32_t sectors_per_unit
;
1319 uint32_t bytes_per_sector
;
1321 } full_size_information
;
1323 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1325 enum smb_fsinfo_level level
;
1326 struct smb2_handle handle
; /* only for smb2 */
1330 uint64_t unknown
[6];
1332 } objectid_information
;
1336 enum smb_setfsinfo_level
{
1337 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1339 union smb_setfsinfo
{
1340 /* generic interface */
1342 enum smb_fsinfo_level level
;
1345 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1347 enum smb_fsinfo_level level
;
1350 uint16_t major_version
;
1351 uint16_t minor_version
;
1352 uint64_t capability
;
1357 enum smb_open_level
{
1366 RAW_OPEN_NTTRANS_CREATE
,
1367 RAW_OPEN_OPENX_READX
,
1368 RAW_OPEN_NTCREATEX_READX
,
1372 /* the generic interface is defined to be equal to the NTCREATEX interface */
1373 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1375 /* union for open() backend call */
1378 * because the *.out.file structs are not aligned to the same offset for each level
1379 * we provide a hepler macro that should be used to find the current smb_handle structure
1381 #define SMB_OPEN_OUT_FILE(op, file) do { \
1382 switch (op->generic.level) { \
1383 case RAW_OPEN_OPEN: \
1384 file = &op->openold.out.file; \
1386 case RAW_OPEN_OPENX: \
1387 file = &op->openx.out.file; \
1389 case RAW_OPEN_MKNEW: \
1390 file = &op->mknew.out.file; \
1392 case RAW_OPEN_CREATE: \
1393 file = &op->create.out.file; \
1395 case RAW_OPEN_CTEMP: \
1396 file = &op->ctemp.out.file; \
1398 case RAW_OPEN_SPLOPEN: \
1399 file = &op->splopen.out.file; \
1401 case RAW_OPEN_NTCREATEX: \
1402 file = &op->ntcreatex.out.file; \
1404 case RAW_OPEN_T2OPEN: \
1405 file = &op->t2open.out.file; \
1407 case RAW_OPEN_NTTRANS_CREATE: \
1408 file = &op->nttrans.out.file; \
1410 case RAW_OPEN_OPENX_READX: \
1411 file = &op->openxreadx.out.file; \
1413 case RAW_OPEN_NTCREATEX_READX: \
1414 file = &op->ntcreatexreadx.out.file; \
1416 case RAW_OPEN_SMB2: \
1417 file = &op->smb2.out.file; \
1420 /* this must be a programmer error */ \
1425 /* SMBNTCreateX, nttrans and generic interface */
1427 enum smb_open_level level
;
1430 union smb_handle root_fid
;
1431 uint32_t access_mask
;
1432 uint64_t alloc_size
;
1434 uint32_t share_access
;
1435 uint32_t open_disposition
;
1436 uint32_t create_options
;
1437 uint32_t impersonation
;
1438 uint8_t security_flags
;
1439 /* NOTE: fname can also be a pointer to a
1440 uint64_t file_id if create_options has the
1441 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1444 /* these last 2 elements are only used in the
1445 NTTRANS varient of the call */
1446 struct security_descriptor
*sec_desc
;
1447 struct smb_ea_list
*ea_list
;
1449 /* some optional parameters from the SMB2 varient */
1450 bool query_maximal_access
;
1452 /* private flags for internal use only */
1453 uint8_t private_flags
;
1456 union smb_handle file
;
1457 uint8_t oplock_level
;
1458 uint32_t create_action
;
1464 uint64_t alloc_size
;
1468 uint8_t is_directory
;
1470 /* optional return values matching SMB2 tagged
1471 values in the call */
1472 uint32_t maximal_access
;
1474 } ntcreatex
, nttrans
, generic
;
1476 /* TRANS2_OPEN interface */
1478 enum smb_open_level level
;
1482 uint16_t search_attrs
;
1483 uint16_t file_attrs
;
1489 unsigned int num_eas
;
1490 struct ea_struct
*eas
;
1493 union smb_handle file
;
1505 /* SMBopen interface */
1507 enum smb_open_level level
;
1510 uint16_t search_attrs
;
1514 union smb_handle file
;
1522 /* SMBopenX interface */
1524 enum smb_open_level level
;
1528 uint16_t search_attrs
; /* not honoured by win2003 */
1529 uint16_t file_attrs
;
1530 time_t write_time
; /* not honoured by win2003 */
1532 uint32_t size
; /* note that this sets the
1533 initial file size, not
1534 just allocation size */
1535 uint32_t timeout
; /* not honoured by win2003 */
1539 union smb_handle file
;
1547 uint32_t unique_fid
;
1548 uint32_t access_mask
;
1553 /* SMBmknew interface */
1555 enum smb_open_level level
;
1562 union smb_handle file
;
1566 /* SMBctemp interface */
1568 enum smb_open_level level
;
1572 const char *directory
;
1575 union smb_handle file
;
1576 /* temp name, relative to directory */
1581 /* SMBsplopen interface */
1583 enum smb_open_level level
;
1585 uint16_t setup_length
;
1590 union smb_handle file
;
1595 /* chained OpenX/ReadX interface */
1597 enum smb_open_level level
;
1601 uint16_t search_attrs
; /* not honoured by win2003 */
1602 uint16_t file_attrs
;
1603 time_t write_time
; /* not honoured by win2003 */
1605 uint32_t size
; /* note that this sets the
1606 initial file size, not
1607 just allocation size */
1608 uint32_t timeout
; /* not honoured by win2003 */
1618 union smb_handle file
;
1626 uint32_t unique_fid
;
1627 uint32_t access_mask
;
1633 uint16_t compaction_mode
;
1638 /* chained NTCreateX/ReadX interface */
1640 enum smb_open_level level
;
1643 union smb_handle root_fid
;
1644 uint32_t access_mask
;
1645 uint64_t alloc_size
;
1647 uint32_t share_access
;
1648 uint32_t open_disposition
;
1649 uint32_t create_options
;
1650 uint32_t impersonation
;
1651 uint8_t security_flags
;
1652 /* NOTE: fname can also be a pointer to a
1653 uint64_t file_id if create_options has the
1654 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1664 union smb_handle file
;
1665 uint8_t oplock_level
;
1666 uint32_t create_action
;
1672 uint64_t alloc_size
;
1676 uint8_t is_directory
;
1681 uint16_t compaction_mode
;
1686 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1687 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1688 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1689 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1692 struct smb2_create
{
1693 enum smb_open_level level
;
1695 /* static body buffer 56 (0x38) bytes */
1696 uint8_t security_flags
; /* SMB2_SECURITY_* */
1697 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1698 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1699 uint64_t create_flags
;
1701 uint32_t desired_access
;
1702 uint32_t file_attributes
;
1703 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1704 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1705 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1707 /* uint16_t fname_ofs */
1708 /* uint16_t fname_size */
1709 /* uint32_t blob_ofs; */
1710 /* uint32_t blob_size; */
1715 /* now some optional parameters - encoded as tagged blobs */
1716 struct smb_ea_list eas
;
1717 uint64_t alloc_size
;
1718 struct security_descriptor
*sec_desc
;
1720 struct smb2_handle
*durable_handle
;
1722 /* data for durable handle v2 */
1723 bool durable_open_v2
;
1724 struct GUID create_guid
;
1725 bool persistent_open
;
1727 struct smb2_handle
*durable_handle_v2
;
1729 bool query_maximal_access
;
1731 bool query_on_disk_id
;
1732 struct smb2_lease
*lease_request
;
1733 struct smb2_lease
*lease_request_v2
;
1735 struct GUID
*app_instance_id
;
1737 /* and any additional blobs the caller wants */
1738 struct smb2_create_blobs blobs
;
1741 union smb_handle file
;
1743 /* static body buffer 88 (0x58) bytes */
1744 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1745 uint8_t oplock_level
;
1747 uint32_t create_action
;
1752 uint64_t alloc_size
;
1756 /* struct smb2_handle handle;*/
1757 /* uint32_t blob_ofs; */
1758 /* uint32_t blob_size; */
1760 /* optional return values matching tagged values in the call */
1761 uint32_t maximal_access
;
1762 uint8_t on_disk_id
[32];
1763 struct smb2_lease lease_response
;
1764 struct smb2_lease lease_response_v2
;
1767 /* durable handle v2 */
1768 bool durable_open_v2
;
1769 bool persistent_open
;
1772 /* tagged blobs in the reply */
1773 struct smb2_create_blobs blobs
;
1780 enum smb_read_level
{
1788 #define RAW_READ_GENERIC RAW_READ_READX
1790 /* union for read() backend call
1792 note that .infoX.out.data will be allocated before the backend is
1793 called. It will be big enough to hold the maximum size asked for
1796 /* SMBreadX (and generic) interface */
1798 enum smb_read_level level
;
1800 union smb_handle file
;
1802 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1805 bool read_for_execute
;
1810 uint16_t compaction_mode
;
1813 uint16_t data_offset
;
1817 /* SMBreadbraw interface */
1819 enum smb_read_level level
;
1821 union smb_handle file
;
1834 /* SMBlockandread interface */
1836 enum smb_read_level level
;
1838 union smb_handle file
;
1849 /* SMBread interface */
1851 enum smb_read_level level
;
1853 union smb_handle file
;
1866 enum smb_read_level level
;
1868 union smb_handle file
;
1870 /* static body buffer 48 (0x30) bytes */
1871 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1876 /* struct smb2_handle handle; */
1880 /* the docs give no indication of what
1881 these channel variables are for */
1882 uint16_t channel_offset
;
1883 uint16_t channel_length
;
1886 /* static body buffer 16 (0x10) bytes */
1887 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1888 /* uint8_t data_ofs; */
1889 /* uint8_t reserved; */
1890 /* uint32_t data_size; */
1901 enum smb_write_level
{
1902 RAW_WRITE_WRITEUNLOCK
,
1905 RAW_WRITE_WRITECLOSE
,
1910 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1912 /* union for write() backend call
1915 /* SMBwriteX interface */
1917 enum smb_write_level level
;
1919 union smb_handle file
;
1924 const uint8_t *data
;
1932 /* SMBwriteunlock interface */
1934 enum smb_write_level level
;
1936 union smb_handle file
;
1940 const uint8_t *data
;
1947 /* SMBwrite interface */
1949 enum smb_write_level level
;
1951 union smb_handle file
;
1955 const uint8_t *data
;
1962 /* SMBwriteclose interface */
1964 enum smb_write_level level
;
1966 union smb_handle file
;
1970 const uint8_t *data
;
1977 /* SMBsplwrite interface */
1979 enum smb_write_level level
;
1981 union smb_handle file
;
1983 const uint8_t *data
;
1989 enum smb_write_level level
;
1991 union smb_handle file
;
1993 /* static body buffer 48 (0x30) bytes */
1994 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1995 /* uint16_t data_ofs; */
1996 /* uint32_t data_size; */
1998 /* struct smb2_handle handle; */
1999 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2000 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2006 /* static body buffer 17 (0x11) bytes */
2007 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2010 uint64_t unknown1
; /* 0x0000000000000000 */
2016 enum smb_lock_level
{
2024 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2026 /* union for lock() backend call
2029 /* SMBlockingX and generic interface */
2031 enum smb_lock_level level
;
2033 union smb_handle file
;
2038 struct smb_lock_entry
{
2039 uint32_t pid
; /* 16 bits in SMB1 */
2042 } *locks
; /* unlocks are first in the arrray */
2046 /* SMBlock and SMBunlock interface */
2048 enum smb_lock_level level
;
2050 union smb_handle file
;
2058 enum smb_lock_level level
;
2060 union smb_handle file
;
2062 /* static body buffer 48 (0x30) bytes */
2063 /* uint16_t buffer_code; 0x30 */
2064 uint16_t lock_count
;
2065 uint32_t lock_sequence
;
2066 /* struct smb2_handle handle; */
2067 struct smb2_lock_element
{
2075 /* static body buffer 4 (0x04) bytes */
2076 /* uint16_t buffer_code; 0x04 */
2083 enum smb_lock_level level
;
2085 union smb_handle file
;
2087 /* static body buffer 24 (0x18) bytes */
2088 uint8_t oplock_level
;
2091 /* struct smb2_handle handle; */
2095 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2096 struct smb2_lease_break_ack
{
2099 struct smb2_lease lease
;
2101 } smb2_lease_break_ack
;
2105 enum smb_close_level
{
2113 union for close() backend call
2116 /* generic interface */
2118 enum smb_close_level level
;
2120 union smb_handle file
;
2122 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2130 uint64_t alloc_size
;
2136 /* SMBclose interface */
2138 enum smb_close_level level
;
2140 union smb_handle file
;
2145 /* SMBsplclose interface - empty! */
2147 enum smb_close_level level
;
2149 union smb_handle file
;
2155 enum smb_close_level level
;
2157 union smb_handle file
;
2159 /* static body buffer 24 (0x18) bytes */
2160 /* uint16_t buffer_code; 0x18 */
2161 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2165 /* static body buffer 60 (0x3C) bytes */
2166 /* uint16_t buffer_code; 0x3C */
2173 uint64_t alloc_size
;
2181 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2184 union for lpq() backend
2187 /* generic interface */
2189 enum smb_lpq_level level
;
2194 /* SMBsplretq interface */
2196 enum smb_lpq_level level
;
2204 uint16_t restart_idx
;
2216 enum smb_ioctl_level
{
2220 RAW_IOCTL_SMB2_NO_HANDLE
2224 union for ioctl() backend
2227 /* generic interface */
2229 enum smb_ioctl_level level
;
2231 union smb_handle file
;
2235 /* struct for SMBioctl */
2237 enum smb_ioctl_level level
;
2239 union smb_handle file
;
2248 /* struct for NT ioctl call */
2250 enum smb_ioctl_level level
;
2252 union smb_handle file
;
2266 enum smb_ioctl_level level
;
2268 union smb_handle file
;
2270 /* static body buffer 56 (0x38) bytes */
2271 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2274 /*struct smb2_handle handle;*/
2275 /* uint32_t out_ofs; */
2276 /* uint32_t out_size; */
2278 /* uint32_t in_ofs; */
2279 /* uint32_t in_size; */
2280 uint32_t max_response_size
;
2288 union smb_handle file
;
2290 /* static body buffer 48 (0x30) bytes */
2291 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2294 /* struct smb2_handle handle; */
2295 /* uint32_t in_ofs; */
2296 /* uint32_t in_size; */
2297 /* uint32_t out_ofs; */
2298 /* uint32_t out_size; */
2309 enum smb_flush_level
{
2316 /* struct for SMBflush */
2318 enum smb_flush_level level
;
2320 union smb_handle file
;
2324 /* SMBflush with 0xFFFF wildcard fnum */
2326 enum smb_flush_level level
;
2331 enum smb_flush_level level
;
2333 union smb_handle file
;
2343 /* struct for SMBcopy */
2358 /* struct for transact/transact2 call */
2366 uint8_t setup_count
;
2368 const char *trans_name
; /* SMBtrans only */
2374 uint8_t setup_count
;
2381 /* struct for nttransact2 call */
2382 struct smb_nttrans
{
2387 uint8_t setup_count
;
2395 uint8_t setup_count
; /* in units of 16 bit words */
2402 enum smb_notify_level
{
2408 /* struct for nttrans change notify call */
2410 enum smb_notify_level level
;
2413 union smb_handle file
;
2414 uint32_t buffer_size
;
2415 uint32_t completion_filter
;
2420 uint32_t num_changes
;
2421 struct notify_changes
{
2423 struct smb_wire_string name
;
2428 struct smb2_notify
{
2429 enum smb_notify_level level
;
2432 union smb_handle file
;
2433 /* static body buffer 32 (0x20) bytes */
2434 /* uint16_t buffer_code; 0x32 */
2436 uint32_t buffer_size
;
2437 /*struct smb2_handle file;*/
2438 uint32_t completion_filter
;
2443 /* static body buffer 8 (0x08) bytes */
2444 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2445 /* uint16_t blob_ofs; */
2446 /* uint16_t blob_size; */
2451 /* DATA_BLOB content */
2452 uint32_t num_changes
;
2453 struct notify_changes
*changes
;
2458 enum smb_search_level
{
2459 RAW_SEARCH_SEARCH
, /* SMBsearch */
2460 RAW_SEARCH_FFIRST
, /* SMBffirst */
2461 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2462 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2463 RAW_SEARCH_SMB2
/* SMB2 Find */
2466 enum smb_search_data_level
{
2467 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2468 RAW_SEARCH_DATA_SEARCH
,
2469 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2470 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2471 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2472 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2473 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2474 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2475 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2476 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2477 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2478 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2479 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2482 /* union for file search */
2483 union smb_search_first
{
2485 enum smb_search_level level
;
2486 enum smb_search_data_level data_level
;
2489 /* search (old) findfirst interface.
2490 Also used for ffirst and funique. */
2492 enum smb_search_level level
;
2493 enum smb_search_data_level data_level
;
2497 uint16_t search_attrib
;
2498 const char *pattern
;
2505 /* trans2 findfirst interface */
2507 enum smb_search_level level
;
2508 enum smb_search_data_level data_level
;
2511 uint16_t search_attrib
;
2514 uint32_t storage_type
;
2515 const char *pattern
;
2517 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2518 unsigned int num_names
;
2519 struct ea_name
*ea_names
;
2524 uint16_t end_of_search
;
2530 enum smb_search_level level
;
2531 enum smb_search_data_level data_level
;
2533 union smb_handle file
;
2535 /* static body buffer 32 (0x20) bytes */
2536 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2538 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2539 uint32_t file_index
;
2540 /* struct smb2_handle handle; */
2541 /* uint16_t pattern_ofs; */
2542 /* uint16_t pattern_size; */
2543 uint32_t max_response_size
;
2546 const char *pattern
;
2549 /* static body buffer 8 (0x08) bytes */
2550 /* uint16_t buffer_code; 0x08 */
2551 /* uint16_t blob_ofs; */
2552 /* uint32_t blob_size; */
2560 /* union for file search continue */
2561 union smb_search_next
{
2563 enum smb_search_level level
;
2564 enum smb_search_data_level data_level
;
2567 /* search (old) findnext interface. Also used
2568 for ffirst when continuing */
2570 enum smb_search_level level
;
2571 enum smb_search_data_level data_level
;
2575 uint16_t search_attrib
;
2576 struct smb_search_id
{
2580 uint32_t server_cookie
;
2581 uint32_t client_cookie
;
2589 /* trans2 findnext interface */
2591 enum smb_search_level level
;
2592 enum smb_search_data_level data_level
;
2597 uint32_t resume_key
;
2599 const char *last_name
;
2601 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2602 unsigned int num_names
;
2603 struct ea_name
*ea_names
;
2607 uint16_t end_of_search
;
2612 struct smb2_find smb2
;
2615 /* union for search reply file data */
2616 union smb_search_data
{
2618 * search (old) findfirst
2619 * RAW_SEARCH_DATA_SEARCH
2625 struct smb_search_id id
;
2629 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2631 uint32_t resume_key
;
2636 uint32_t alloc_size
;
2638 struct smb_wire_string name
;
2641 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2643 uint32_t resume_key
;
2648 uint32_t alloc_size
;
2651 struct smb_wire_string name
;
2654 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2656 uint32_t resume_key
;
2661 uint32_t alloc_size
;
2663 struct smb_ea_list eas
;
2664 struct smb_wire_string name
;
2667 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2669 uint32_t file_index
;
2675 uint64_t alloc_size
;
2677 struct smb_wire_string name
;
2680 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2682 uint32_t file_index
;
2688 uint64_t alloc_size
;
2691 struct smb_wire_string name
;
2692 } full_directory_info
;
2694 /* RAW_SEARCH_DATA_NAME_INFO interface */
2696 uint32_t file_index
;
2697 struct smb_wire_string name
;
2700 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2702 uint32_t file_index
;
2708 uint64_t alloc_size
;
2711 struct smb_wire_string short_name
;
2712 struct smb_wire_string name
;
2713 } both_directory_info
;
2715 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2717 uint32_t file_index
;
2723 uint64_t alloc_size
;
2727 struct smb_wire_string name
;
2728 } id_full_directory_info
;
2730 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2732 uint32_t file_index
;
2738 uint64_t alloc_size
;
2742 struct smb_wire_string short_name
;
2743 struct smb_wire_string name
;
2744 } id_both_directory_info
;
2746 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2748 uint32_t file_index
;
2750 uint64_t alloc_size
;
2751 NTTIME status_change_time
;
2760 uint64_t permissions
;
2765 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2767 uint32_t file_index
;
2768 uint64_t end_of_file
;
2770 NTTIME status_change_time
;
2779 uint64_t permissions
;
2782 uint32_t file_flags
;
2783 uint32_t flags_mask
;
2784 struct smb_wire_string name
;
2788 /* Callback function passed to the raw search interface. */
2789 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2791 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2793 /* union for file search close */
2794 union smb_search_close
{
2796 enum smb_search_close_level level
;
2799 /* SMBfclose (old search) interface */
2801 enum smb_search_close_level level
;
2804 /* max_count and search_attrib are not used, but are present */
2806 uint16_t search_attrib
;
2807 struct smb_search_id id
;
2811 /* SMBfindclose interface */
2813 enum smb_search_close_level level
;
2823 struct for SMBecho call
2827 uint16_t repeat_count
;
2833 uint16_t sequence_number
;
2840 struct for shadow copy volumes
2842 struct smb_shadow_copy
{
2844 union smb_handle file
;
2848 uint32_t num_volumes
;
2854 #endif /* __LIBCLI_RAW_INTERFACES_H__ */