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
;
68 uint64_t lease_duration
; /* should be 0 */
70 struct smb2_lease_key parent_lease_key
;
74 struct smb2_lease_break
{
75 struct smb2_lease current_lease
;
77 uint32_t new_lease_state
;
78 uint32_t break_reason
; /* should be 0 */
79 uint32_t access_mask_hint
; /* should be 0 */
80 uint32_t share_mask_hint
; /* should be 0 */
86 * a generic container for file handles or file pathes
87 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
89 union smb_handle_or_path
{
92 * the qpathinfo and setpathinfo
97 * this is used as file handle in SMB
102 * this is used as file handle in SMB2
104 struct smb2_handle handle
;
107 * this is used as generic file handle for the NTVFS layer
109 struct ntvfs_handle
*ntvfs
;
113 a generic container for file handles
117 * this is used as file handle in SMB
122 * this is used as file handle in SMB2
124 struct smb2_handle handle
;
127 * this is used as generic file handle for the NTVFS layer
129 struct ntvfs_handle
*ntvfs
;
133 this header defines the structures and unions used between the SMB
134 parser and the backends.
137 /* struct used for SMBlseek call */
141 union smb_handle file
;
143 int32_t offset
; /* signed */
151 /* struct used in unlink() call */
162 /* struct used in chkpath() call */
171 enum smb_mkdir_level
{RAW_MKDIR_GENERIC
, RAW_MKDIR_MKDIR
, RAW_MKDIR_T2MKDIR
};
173 /* union used in mkdir() call */
177 enum smb_mkdir_level level
;
181 enum smb_mkdir_level level
;
188 enum smb_mkdir_level level
;
191 unsigned int num_eas
;
192 struct ea_struct
*eas
;
197 /* struct used in rmdir() call */
204 /* struct used in rename() call */
205 enum smb_rename_level
{RAW_RENAME_RENAME
, RAW_RENAME_NTRENAME
, RAW_RENAME_NTTRANS
};
209 enum smb_rename_level level
;
212 /* SMBrename interface */
214 enum smb_rename_level level
;
217 const char *pattern1
;
218 const char *pattern2
;
224 /* SMBntrename interface */
226 enum smb_rename_level level
;
230 uint16_t flags
; /* see RENAME_FLAG_* */
231 uint32_t cluster_size
;
232 const char *old_name
;
233 const char *new_name
;
237 /* NT TRANS rename interface */
239 enum smb_rename_level level
;
242 union smb_handle file
;
243 uint16_t flags
;/* see RENAME_REPLACE_IF_EXISTS */
244 const char *new_name
;
249 enum smb_tcon_level
{
255 /* union used in tree connect call */
257 /* generic interface */
259 enum smb_tcon_level level
;
262 /* SMBtcon interface */
264 enum smb_tcon_level level
;
268 const char *password
;
277 /* SMBtconX interface */
279 enum smb_tcon_level level
;
290 uint32_t guest_max_access
;
297 /* SMB2 TreeConnect */
298 struct smb2_tree_connect
{
299 enum smb_tcon_level level
;
302 /* static body buffer 8 (0x08) bytes */
304 /* uint16_t path_ofs */
305 /* uint16_t path_size */
307 const char *path
; /* as non-terminated UTF-16 on the wire */
310 /* static body buffer 16 (0x10) bytes */
311 /* uint16_t buffer_code; 0x10 */
315 uint32_t capabilities
;
316 uint32_t access_mask
;
318 /* extracted from the SMB2 header */
325 enum smb_sesssetup_level
{
328 RAW_SESSSETUP_SPNEGO
,
332 /* union used in session_setup call */
333 union smb_sesssetup
{
334 /* the pre-NT1 interface */
336 enum smb_sesssetup_level level
;
358 /* the NT1 interface */
360 enum smb_sesssetup_level level
;
367 uint32_t capabilities
;
385 /* the SPNEGO interface */
387 enum smb_sesssetup_level level
;
394 uint32_t capabilities
;
398 const char *workgroup
;
410 /* SMB2 SessionSetup */
411 struct smb2_session_setup
{
412 enum smb_sesssetup_level level
;
415 /* static body 24 (0x18) bytes */
417 uint8_t security_mode
;
418 uint32_t capabilities
;
420 /* uint16_t secblob_ofs */
421 /* uint16_t secblob_size */
422 uint64_t previous_sessionid
;
427 /* body buffer 8 (0x08) bytes */
428 uint16_t session_flags
;
429 /* uint16_t secblob_ofs */
430 /* uint16_t secblob_size */
434 /* extracted from the SMB2 header */
440 /* Note that the specified enum values are identical to the actual info-levels used
443 enum smb_fileinfo_level
{
444 RAW_FILEINFO_GENERIC
= 0xF000,
445 RAW_FILEINFO_GETATTR
, /* SMBgetatr */
446 RAW_FILEINFO_GETATTRE
, /* SMBgetattrE */
447 RAW_FILEINFO_SEC_DESC
, /* NT_TRANSACT_QUERY_SECURITY_DESC */
448 RAW_FILEINFO_STANDARD
= SMB_QFILEINFO_STANDARD
,
449 RAW_FILEINFO_EA_SIZE
= SMB_QFILEINFO_EA_SIZE
,
450 RAW_FILEINFO_EA_LIST
= SMB_QFILEINFO_EA_LIST
,
451 RAW_FILEINFO_ALL_EAS
= SMB_QFILEINFO_ALL_EAS
,
452 RAW_FILEINFO_IS_NAME_VALID
= SMB_QFILEINFO_IS_NAME_VALID
,
453 RAW_FILEINFO_BASIC_INFO
= SMB_QFILEINFO_BASIC_INFO
,
454 RAW_FILEINFO_STANDARD_INFO
= SMB_QFILEINFO_STANDARD_INFO
,
455 RAW_FILEINFO_EA_INFO
= SMB_QFILEINFO_EA_INFO
,
456 RAW_FILEINFO_NAME_INFO
= SMB_QFILEINFO_NAME_INFO
,
457 RAW_FILEINFO_ALL_INFO
= SMB_QFILEINFO_ALL_INFO
,
458 RAW_FILEINFO_ALT_NAME_INFO
= SMB_QFILEINFO_ALT_NAME_INFO
,
459 RAW_FILEINFO_STREAM_INFO
= SMB_QFILEINFO_STREAM_INFO
,
460 RAW_FILEINFO_COMPRESSION_INFO
= SMB_QFILEINFO_COMPRESSION_INFO
,
461 RAW_FILEINFO_UNIX_BASIC
= SMB_QFILEINFO_UNIX_BASIC
,
462 RAW_FILEINFO_UNIX_INFO2
= SMB_QFILEINFO_UNIX_INFO2
,
463 RAW_FILEINFO_UNIX_LINK
= SMB_QFILEINFO_UNIX_LINK
,
464 RAW_FILEINFO_BASIC_INFORMATION
= SMB_QFILEINFO_BASIC_INFORMATION
,
465 RAW_FILEINFO_STANDARD_INFORMATION
= SMB_QFILEINFO_STANDARD_INFORMATION
,
466 RAW_FILEINFO_INTERNAL_INFORMATION
= SMB_QFILEINFO_INTERNAL_INFORMATION
,
467 RAW_FILEINFO_EA_INFORMATION
= SMB_QFILEINFO_EA_INFORMATION
,
468 RAW_FILEINFO_ACCESS_INFORMATION
= SMB_QFILEINFO_ACCESS_INFORMATION
,
469 RAW_FILEINFO_NAME_INFORMATION
= SMB_QFILEINFO_NAME_INFORMATION
,
470 RAW_FILEINFO_POSITION_INFORMATION
= SMB_QFILEINFO_POSITION_INFORMATION
,
471 RAW_FILEINFO_MODE_INFORMATION
= SMB_QFILEINFO_MODE_INFORMATION
,
472 RAW_FILEINFO_ALIGNMENT_INFORMATION
= SMB_QFILEINFO_ALIGNMENT_INFORMATION
,
473 RAW_FILEINFO_ALL_INFORMATION
= SMB_QFILEINFO_ALL_INFORMATION
,
474 RAW_FILEINFO_ALT_NAME_INFORMATION
= SMB_QFILEINFO_ALT_NAME_INFORMATION
,
475 RAW_FILEINFO_STREAM_INFORMATION
= SMB_QFILEINFO_STREAM_INFORMATION
,
476 RAW_FILEINFO_COMPRESSION_INFORMATION
= SMB_QFILEINFO_COMPRESSION_INFORMATION
,
477 RAW_FILEINFO_NETWORK_OPEN_INFORMATION
= SMB_QFILEINFO_NETWORK_OPEN_INFORMATION
,
478 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION
= SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
,
479 /* SMB2 specific levels */
480 RAW_FILEINFO_SMB2_ALL_EAS
= 0x0f01,
481 RAW_FILEINFO_SMB2_ALL_INFORMATION
= 0x1201
484 /* union used in qfileinfo() and qpathinfo() backend calls */
486 /* generic interface:
487 * matches RAW_FILEINFO_GENERIC */
489 enum smb_fileinfo_level level
;
491 union smb_handle_or_path file
;
496 unsigned int num_eas
;
499 struct smb_wire_string name
;
509 struct smb_wire_string fname
;
510 struct smb_wire_string alt_fname
;
511 uint8_t delete_pending
;
513 uint64_t compressed_size
;
517 uint8_t cluster_shift
;
519 uint32_t access_flags
; /* seen 0x001f01ff from w2k3 */
522 uint32_t alignment_requirement
;
523 uint32_t reparse_tag
;
524 unsigned int num_streams
;
525 struct stream_struct
{
528 struct smb_wire_string stream_name
;
534 /* SMBgetatr interface:
535 * matches RAW_FILEINFO_GETATTR */
537 enum smb_fileinfo_level level
;
539 union smb_handle_or_path file
;
548 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
550 enum smb_fileinfo_level level
;
552 union smb_handle_or_path file
;
562 } getattre
, standard
;
564 /* trans2 RAW_FILEINFO_EA_SIZE interface */
566 enum smb_fileinfo_level level
;
568 union smb_handle_or_path file
;
581 /* trans2 RAW_FILEINFO_EA_LIST interface */
583 enum smb_fileinfo_level level
;
585 union smb_handle_or_path file
;
586 unsigned int num_names
;
588 struct smb_wire_string name
;
593 unsigned int num_eas
;
594 struct ea_struct
*eas
;
598 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
600 enum smb_fileinfo_level level
;
602 union smb_handle_or_path file
;
603 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
604 uint8_t continue_flags
;
606 struct smb_ea_list out
;
609 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
610 only valid for a QPATHNAME call - no returned data */
612 enum smb_fileinfo_level level
;
614 union smb_handle_or_path file
;
618 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
620 enum smb_fileinfo_level level
;
622 union smb_handle_or_path file
;
634 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
636 enum smb_fileinfo_level level
;
638 union smb_handle_or_path file
;
649 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
651 enum smb_fileinfo_level level
;
653 union smb_handle_or_path file
;
660 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
662 enum smb_fileinfo_level level
;
664 union smb_handle_or_path file
;
667 struct smb_wire_string fname
;
671 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
673 enum smb_fileinfo_level level
;
675 union smb_handle_or_path file
;
686 uint8_t delete_pending
;
689 struct smb_wire_string fname
;
693 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
695 enum smb_fileinfo_level level
;
697 union smb_handle_or_path file
;
709 uint8_t delete_pending
;
714 uint32_t access_mask
;
717 uint32_t alignment_requirement
;
718 struct smb_wire_string fname
;
722 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
724 enum smb_fileinfo_level level
;
726 union smb_handle_or_path file
;
729 struct smb_wire_string fname
;
733 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
735 enum smb_fileinfo_level level
;
737 union smb_handle_or_path file
;
739 struct stream_information
{
740 unsigned int num_streams
;
741 struct stream_struct
*streams
;
745 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
747 enum smb_fileinfo_level level
;
749 union smb_handle_or_path file
;
752 uint64_t compressed_size
;
756 uint8_t cluster_shift
;
760 /* RAW_FILEINFO_UNIX_BASIC interface */
762 enum smb_fileinfo_level level
;
764 union smb_handle_or_path file
;
767 uint64_t end_of_file
;
769 NTTIME status_change_time
;
778 uint64_t permissions
;
783 /* RAW_FILEINFO_UNIX_INFO2 interface */
785 enum smb_fileinfo_level level
;
787 union smb_handle_or_path file
;
790 uint64_t end_of_file
;
792 NTTIME status_change_time
;
801 uint64_t permissions
;
809 /* RAW_FILEINFO_UNIX_LINK interface */
811 enum smb_fileinfo_level level
;
813 union smb_handle_or_path file
;
816 struct smb_wire_string link_dest
;
820 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
822 enum smb_fileinfo_level level
;
824 union smb_handle_or_path file
;
829 } internal_information
;
831 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
833 enum smb_fileinfo_level level
;
835 union smb_handle_or_path file
;
838 uint32_t access_flags
;
840 } access_information
;
842 /* RAW_FILEINFO_POSITION_INFORMATION interface */
844 enum smb_fileinfo_level level
;
846 union smb_handle_or_path file
;
851 } position_information
;
853 /* RAW_FILEINFO_MODE_INFORMATION interface */
855 enum smb_fileinfo_level level
;
857 union smb_handle_or_path file
;
864 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
866 enum smb_fileinfo_level level
;
868 union smb_handle_or_path file
;
871 uint32_t alignment_requirement
;
873 } alignment_information
;
875 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
877 enum smb_fileinfo_level level
;
879 union smb_handle_or_path file
;
890 } network_open_information
;
893 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
895 enum smb_fileinfo_level level
;
897 union smb_handle_or_path file
;
901 uint32_t reparse_tag
;
903 } attribute_tag_information
;
905 /* RAW_FILEINFO_SEC_DESC */
907 enum smb_fileinfo_level level
;
909 union smb_handle_or_path file
;
910 uint32_t secinfo_flags
;
913 struct security_descriptor
*sd
;
919 enum smb_setfileinfo_level
{
920 RAW_SFILEINFO_GENERIC
= 0xF000,
921 RAW_SFILEINFO_SETATTR
, /* SMBsetatr */
922 RAW_SFILEINFO_SETATTRE
, /* SMBsetattrE */
923 RAW_SFILEINFO_SEC_DESC
, /* NT_TRANSACT_SET_SECURITY_DESC */
924 RAW_SFILEINFO_STANDARD
= SMB_SFILEINFO_STANDARD
,
925 RAW_SFILEINFO_EA_SET
= SMB_SFILEINFO_EA_SET
,
926 RAW_SFILEINFO_BASIC_INFO
= SMB_SFILEINFO_BASIC_INFO
,
927 RAW_SFILEINFO_DISPOSITION_INFO
= SMB_SFILEINFO_DISPOSITION_INFO
,
928 RAW_SFILEINFO_ALLOCATION_INFO
= SMB_SFILEINFO_ALLOCATION_INFO
,
929 RAW_SFILEINFO_END_OF_FILE_INFO
= SMB_SFILEINFO_END_OF_FILE_INFO
,
930 RAW_SFILEINFO_UNIX_BASIC
= SMB_SFILEINFO_UNIX_BASIC
,
931 RAW_SFILEINFO_UNIX_INFO2
= SMB_SFILEINFO_UNIX_INFO2
,
932 RAW_SFILEINFO_UNIX_LINK
= SMB_SET_FILE_UNIX_LINK
,
933 RAW_SFILEINFO_UNIX_HLINK
= SMB_SET_FILE_UNIX_HLINK
,
934 RAW_SFILEINFO_BASIC_INFORMATION
= SMB_SFILEINFO_BASIC_INFORMATION
,
935 RAW_SFILEINFO_RENAME_INFORMATION
= SMB_SFILEINFO_RENAME_INFORMATION
,
936 RAW_SFILEINFO_LINK_INFORMATION
= SMB_SFILEINFO_LINK_INFORMATION
,
937 RAW_SFILEINFO_DISPOSITION_INFORMATION
= SMB_SFILEINFO_DISPOSITION_INFORMATION
,
938 RAW_SFILEINFO_POSITION_INFORMATION
= SMB_SFILEINFO_POSITION_INFORMATION
,
939 RAW_SFILEINFO_FULL_EA_INFORMATION
= SMB_SFILEINFO_FULL_EA_INFORMATION
,
940 RAW_SFILEINFO_MODE_INFORMATION
= SMB_SFILEINFO_MODE_INFORMATION
,
941 RAW_SFILEINFO_ALLOCATION_INFORMATION
= SMB_SFILEINFO_ALLOCATION_INFORMATION
,
942 RAW_SFILEINFO_END_OF_FILE_INFORMATION
= SMB_SFILEINFO_END_OF_FILE_INFORMATION
,
943 RAW_SFILEINFO_PIPE_INFORMATION
= SMB_SFILEINFO_PIPE_INFORMATION
,
944 RAW_SFILEINFO_VALID_DATA_INFORMATION
= SMB_SFILEINFO_VALID_DATA_INFORMATION
,
945 RAW_SFILEINFO_SHORT_NAME_INFORMATION
= SMB_SFILEINFO_SHORT_NAME_INFORMATION
,
946 RAW_SFILEINFO_1025
= SMB_SFILEINFO_1025
,
947 RAW_SFILEINFO_1027
= SMB_SFILEINFO_1027
,
948 RAW_SFILEINFO_1029
= SMB_SFILEINFO_1029
,
949 RAW_SFILEINFO_1030
= SMB_SFILEINFO_1030
,
950 RAW_SFILEINFO_1031
= SMB_SFILEINFO_1031
,
951 RAW_SFILEINFO_1032
= SMB_SFILEINFO_1032
,
952 RAW_SFILEINFO_1036
= SMB_SFILEINFO_1036
,
953 RAW_SFILEINFO_1041
= SMB_SFILEINFO_1041
,
954 RAW_SFILEINFO_1042
= SMB_SFILEINFO_1042
,
955 RAW_SFILEINFO_1043
= SMB_SFILEINFO_1043
,
956 RAW_SFILEINFO_1044
= SMB_SFILEINFO_1044
,
958 /* cope with breakage in SMB2 */
959 RAW_SFILEINFO_RENAME_INFORMATION_SMB2
= SMB_SFILEINFO_RENAME_INFORMATION
|0x80000000,
962 /* union used in setfileinfo() and setpathinfo() calls */
963 union smb_setfileinfo
{
964 /* generic interface */
966 enum smb_setfileinfo_level level
;
968 union smb_handle_or_path file
;
972 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
974 enum smb_setfileinfo_level level
;
976 union smb_handle_or_path file
;
982 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
983 also RAW_SFILEINFO_STANDARD */
985 enum smb_setfileinfo_level level
;
987 union smb_handle_or_path file
;
991 /* notice that size, alloc_size and attrib are not settable,
992 unlike the corresponding qfileinfo level */
994 } setattre
, standard
;
996 /* RAW_SFILEINFO_EA_SET interface */
998 enum smb_setfileinfo_level level
;
1000 union smb_handle_or_path file
;
1001 unsigned int num_eas
;
1002 struct ea_struct
*eas
;
1006 /* RAW_SFILEINFO_BASIC_INFO and
1007 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
1009 enum smb_setfileinfo_level level
;
1011 union smb_handle_or_path file
;
1021 /* RAW_SFILEINFO_DISPOSITION_INFO and
1022 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
1024 enum smb_setfileinfo_level level
;
1026 union smb_handle_or_path file
;
1027 bool delete_on_close
;
1031 /* RAW_SFILEINFO_ALLOCATION_INFO and
1032 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
1034 enum smb_setfileinfo_level level
;
1036 union smb_handle_or_path file
;
1037 /* w2k3 rounds this up to nearest 4096 */
1038 uint64_t alloc_size
;
1042 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1043 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1045 enum smb_setfileinfo_level level
;
1047 union smb_handle_or_path file
;
1052 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1054 enum smb_setfileinfo_level level
;
1056 union smb_handle_or_path file
;
1059 const char *new_name
;
1061 } rename_information
;
1063 /* RAW_SFILEINFO_LINK_INFORMATION interface */
1065 enum smb_setfileinfo_level level
;
1067 union smb_handle_or_path file
;
1070 const char *new_name
;
1074 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1076 enum smb_setfileinfo_level level
;
1078 union smb_handle_or_path file
;
1081 } position_information
;
1083 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1085 enum smb_setfileinfo_level level
;
1087 union smb_handle_or_path file
;
1088 /* valid values seem to be 0, 2, 4 and 6 */
1093 /* RAW_SFILEINFO_UNIX_BASIC interface */
1095 enum smb_setfileinfo_level level
;
1097 union smb_handle_or_path file
;
1098 uint32_t mode
; /* yuck - this field remains to fix compile of libcli/clifile.c */
1099 uint64_t end_of_file
;
1101 NTTIME status_change_time
;
1110 uint64_t permissions
;
1115 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1117 enum smb_setfileinfo_level level
;
1119 union smb_handle_or_path file
;
1120 uint64_t end_of_file
;
1122 NTTIME status_change_time
;
1131 uint64_t permissions
;
1134 uint32_t file_flags
;
1135 uint32_t flags_mask
;
1139 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1141 enum smb_setfileinfo_level level
;
1143 union smb_handle_or_path file
;
1144 const char *link_dest
;
1146 } unix_link
, unix_hlink
;
1148 /* RAW_SFILEINFO_SEC_DESC */
1150 enum smb_setfileinfo_level level
;
1152 union smb_handle_or_path file
;
1153 uint32_t secinfo_flags
;
1154 struct security_descriptor
*sd
;
1158 /* RAW_SFILEINFO_FULL_EA_INFORMATION */
1160 enum smb_setfileinfo_level level
;
1162 union smb_handle_or_path file
;
1163 struct smb_ea_list eas
;
1165 } full_ea_information
;
1169 enum smb_fsinfo_level
{
1170 RAW_QFS_GENERIC
= 0xF000,
1171 RAW_QFS_DSKATTR
, /* SMBdskattr */
1172 RAW_QFS_ALLOCATION
= SMB_QFS_ALLOCATION
,
1173 RAW_QFS_VOLUME
= SMB_QFS_VOLUME
,
1174 RAW_QFS_VOLUME_INFO
= SMB_QFS_VOLUME_INFO
,
1175 RAW_QFS_SIZE_INFO
= SMB_QFS_SIZE_INFO
,
1176 RAW_QFS_DEVICE_INFO
= SMB_QFS_DEVICE_INFO
,
1177 RAW_QFS_ATTRIBUTE_INFO
= SMB_QFS_ATTRIBUTE_INFO
,
1178 RAW_QFS_UNIX_INFO
= SMB_QFS_UNIX_INFO
,
1179 RAW_QFS_VOLUME_INFORMATION
= SMB_QFS_VOLUME_INFORMATION
,
1180 RAW_QFS_SIZE_INFORMATION
= SMB_QFS_SIZE_INFORMATION
,
1181 RAW_QFS_DEVICE_INFORMATION
= SMB_QFS_DEVICE_INFORMATION
,
1182 RAW_QFS_ATTRIBUTE_INFORMATION
= SMB_QFS_ATTRIBUTE_INFORMATION
,
1183 RAW_QFS_QUOTA_INFORMATION
= SMB_QFS_QUOTA_INFORMATION
,
1184 RAW_QFS_FULL_SIZE_INFORMATION
= SMB_QFS_FULL_SIZE_INFORMATION
,
1185 RAW_QFS_OBJECTID_INFORMATION
= SMB_QFS_OBJECTID_INFORMATION
};
1188 /* union for fsinfo() backend call. Note that there are no in
1189 structures, as this call only contains out parameters */
1191 /* generic interface */
1193 enum smb_fsinfo_level level
;
1194 struct smb2_handle handle
; /* only for smb2 */
1197 uint32_t block_size
;
1198 uint64_t blocks_total
;
1199 uint64_t blocks_free
;
1202 uint32_t serial_number
;
1204 uint32_t max_file_component_length
;
1205 uint32_t device_type
;
1206 uint32_t device_characteristics
;
1207 uint64_t quota_soft
;
1208 uint64_t quota_hard
;
1209 uint64_t quota_flags
;
1216 /* SMBdskattr interface */
1218 enum smb_fsinfo_level level
;
1221 uint16_t units_total
;
1222 uint16_t blocks_per_unit
;
1223 uint16_t block_size
;
1224 uint16_t units_free
;
1228 /* trans2 RAW_QFS_ALLOCATION interface */
1230 enum smb_fsinfo_level level
;
1234 uint32_t sectors_per_unit
;
1235 uint32_t total_alloc_units
;
1236 uint32_t avail_alloc_units
;
1237 uint16_t bytes_per_sector
;
1241 /* TRANS2 RAW_QFS_VOLUME interface */
1243 enum smb_fsinfo_level level
;
1246 uint32_t serial_number
;
1247 struct smb_wire_string volume_name
;
1251 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1253 enum smb_fsinfo_level level
;
1254 struct smb2_handle handle
; /* only for smb2 */
1258 uint32_t serial_number
;
1259 struct smb_wire_string volume_name
;
1263 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1265 enum smb_fsinfo_level level
;
1266 struct smb2_handle handle
; /* only for smb2 */
1269 uint64_t total_alloc_units
;
1270 uint64_t avail_alloc_units
; /* maps to call_avail_alloc_units */
1271 uint32_t sectors_per_unit
;
1272 uint32_t bytes_per_sector
;
1276 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1278 enum smb_fsinfo_level level
;
1279 struct smb2_handle handle
; /* only for smb2 */
1282 uint32_t device_type
;
1283 uint32_t characteristics
;
1288 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1290 enum smb_fsinfo_level level
;
1291 struct smb2_handle handle
; /* only for smb2 */
1295 uint32_t max_file_component_length
;
1296 struct smb_wire_string fs_type
;
1301 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1303 enum smb_fsinfo_level level
;
1306 uint16_t major_version
;
1307 uint16_t minor_version
;
1308 uint64_t capability
;
1312 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1314 enum smb_fsinfo_level level
;
1315 struct smb2_handle handle
; /* only for smb2 */
1318 uint64_t unknown
[3];
1319 uint64_t quota_soft
;
1320 uint64_t quota_hard
;
1321 uint64_t quota_flags
;
1323 } quota_information
;
1325 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1327 enum smb_fsinfo_level level
;
1328 struct smb2_handle handle
; /* only for smb2 */
1331 uint64_t total_alloc_units
;
1332 uint64_t call_avail_alloc_units
;
1333 uint64_t actual_avail_alloc_units
;
1334 uint32_t sectors_per_unit
;
1335 uint32_t bytes_per_sector
;
1337 } full_size_information
;
1339 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1341 enum smb_fsinfo_level level
;
1342 struct smb2_handle handle
; /* only for smb2 */
1346 uint64_t unknown
[6];
1348 } objectid_information
;
1352 enum smb_setfsinfo_level
{
1353 RAW_SETFS_UNIX_INFO
= SMB_SET_CIFS_UNIX_INFO
};
1355 union smb_setfsinfo
{
1356 /* generic interface */
1358 enum smb_fsinfo_level level
;
1361 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1363 enum smb_fsinfo_level level
;
1366 uint16_t major_version
;
1367 uint16_t minor_version
;
1368 uint64_t capability
;
1373 enum smb_open_level
{
1382 RAW_OPEN_NTTRANS_CREATE
,
1383 RAW_OPEN_OPENX_READX
,
1384 RAW_OPEN_NTCREATEX_READX
,
1388 /* the generic interface is defined to be equal to the NTCREATEX interface */
1389 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1391 /* union for open() backend call */
1394 * because the *.out.file structs are not aligned to the same offset for each level
1395 * we provide a hepler macro that should be used to find the current smb_handle structure
1397 #define SMB_OPEN_OUT_FILE(op, file) do { \
1398 switch (op->generic.level) { \
1399 case RAW_OPEN_OPEN: \
1400 file = &op->openold.out.file; \
1402 case RAW_OPEN_OPENX: \
1403 file = &op->openx.out.file; \
1405 case RAW_OPEN_MKNEW: \
1406 file = &op->mknew.out.file; \
1408 case RAW_OPEN_CREATE: \
1409 file = &op->create.out.file; \
1411 case RAW_OPEN_CTEMP: \
1412 file = &op->ctemp.out.file; \
1414 case RAW_OPEN_SPLOPEN: \
1415 file = &op->splopen.out.file; \
1417 case RAW_OPEN_NTCREATEX: \
1418 file = &op->ntcreatex.out.file; \
1420 case RAW_OPEN_T2OPEN: \
1421 file = &op->t2open.out.file; \
1423 case RAW_OPEN_NTTRANS_CREATE: \
1424 file = &op->nttrans.out.file; \
1426 case RAW_OPEN_OPENX_READX: \
1427 file = &op->openxreadx.out.file; \
1429 case RAW_OPEN_NTCREATEX_READX: \
1430 file = &op->ntcreatexreadx.out.file; \
1432 case RAW_OPEN_SMB2: \
1433 file = &op->smb2.out.file; \
1436 /* this must be a programmer error */ \
1441 /* SMBNTCreateX, nttrans and generic interface */
1443 enum smb_open_level level
;
1446 union smb_handle root_fid
;
1447 uint32_t access_mask
;
1448 uint64_t alloc_size
;
1450 uint32_t share_access
;
1451 uint32_t open_disposition
;
1452 uint32_t create_options
;
1453 uint32_t impersonation
;
1454 uint8_t security_flags
;
1455 /* NOTE: fname can also be a pointer to a
1456 uint64_t file_id if create_options has the
1457 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1460 /* these last 2 elements are only used in the
1461 NTTRANS varient of the call */
1462 struct security_descriptor
*sec_desc
;
1463 struct smb_ea_list
*ea_list
;
1465 /* some optional parameters from the SMB2 varient */
1466 bool query_maximal_access
;
1468 /* private flags for internal use only */
1469 uint8_t private_flags
;
1472 union smb_handle file
;
1473 uint8_t oplock_level
;
1474 uint32_t create_action
;
1480 uint64_t alloc_size
;
1484 uint8_t is_directory
;
1486 /* optional return values matching SMB2 tagged
1487 values in the call */
1488 uint32_t maximal_access
;
1490 } ntcreatex
, nttrans
, generic
;
1492 /* TRANS2_OPEN interface */
1494 enum smb_open_level level
;
1498 uint16_t search_attrs
;
1499 uint16_t file_attrs
;
1505 unsigned int num_eas
;
1506 struct ea_struct
*eas
;
1509 union smb_handle file
;
1521 /* SMBopen interface */
1523 enum smb_open_level level
;
1526 uint16_t search_attrs
;
1530 union smb_handle file
;
1538 /* SMBopenX interface */
1540 enum smb_open_level level
;
1544 uint16_t search_attrs
; /* not honoured by win2003 */
1545 uint16_t file_attrs
;
1546 time_t write_time
; /* not honoured by win2003 */
1548 uint32_t size
; /* note that this sets the
1549 initial file size, not
1550 just allocation size */
1551 uint32_t timeout
; /* not honoured by win2003 */
1555 union smb_handle file
;
1563 uint32_t unique_fid
;
1564 uint32_t access_mask
;
1569 /* SMBmknew interface */
1571 enum smb_open_level level
;
1578 union smb_handle file
;
1582 /* SMBctemp interface */
1584 enum smb_open_level level
;
1588 const char *directory
;
1591 union smb_handle file
;
1592 /* temp name, relative to directory */
1597 /* SMBsplopen interface */
1599 enum smb_open_level level
;
1601 uint16_t setup_length
;
1606 union smb_handle file
;
1611 /* chained OpenX/ReadX interface */
1613 enum smb_open_level level
;
1617 uint16_t search_attrs
; /* not honoured by win2003 */
1618 uint16_t file_attrs
;
1619 time_t write_time
; /* not honoured by win2003 */
1621 uint32_t size
; /* note that this sets the
1622 initial file size, not
1623 just allocation size */
1624 uint32_t timeout
; /* not honoured by win2003 */
1634 union smb_handle file
;
1642 uint32_t unique_fid
;
1643 uint32_t access_mask
;
1649 uint16_t compaction_mode
;
1654 /* chained NTCreateX/ReadX interface */
1656 enum smb_open_level level
;
1659 union smb_handle root_fid
;
1660 uint32_t access_mask
;
1661 uint64_t alloc_size
;
1663 uint32_t share_access
;
1664 uint32_t open_disposition
;
1665 uint32_t create_options
;
1666 uint32_t impersonation
;
1667 uint8_t security_flags
;
1668 /* NOTE: fname can also be a pointer to a
1669 uint64_t file_id if create_options has the
1670 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1680 union smb_handle file
;
1681 uint8_t oplock_level
;
1682 uint32_t create_action
;
1688 uint64_t alloc_size
;
1692 uint8_t is_directory
;
1697 uint16_t compaction_mode
;
1702 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1703 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1704 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1705 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1708 struct smb2_create
{
1709 enum smb_open_level level
;
1711 /* static body buffer 56 (0x38) bytes */
1712 uint8_t security_flags
; /* SMB2_SECURITY_* */
1713 uint8_t oplock_level
; /* SMB2_OPLOCK_LEVEL_* */
1714 uint32_t impersonation_level
; /* SMB2_IMPERSONATION_* */
1715 uint64_t create_flags
;
1717 uint32_t desired_access
;
1718 uint32_t file_attributes
;
1719 uint32_t share_access
; /* NTCREATEX_SHARE_ACCESS_* */
1720 uint32_t create_disposition
; /* NTCREATEX_DISP_* */
1721 uint32_t create_options
; /* NTCREATEX_OPTIONS_* */
1723 /* uint16_t fname_ofs */
1724 /* uint16_t fname_size */
1725 /* uint32_t blob_ofs; */
1726 /* uint32_t blob_size; */
1731 /* now some optional parameters - encoded as tagged blobs */
1732 struct smb_ea_list eas
;
1733 uint64_t alloc_size
;
1734 struct security_descriptor
*sec_desc
;
1736 struct smb2_handle
*durable_handle
;
1738 /* data for durable handle v2 */
1739 bool durable_open_v2
;
1740 struct GUID create_guid
;
1741 bool persistent_open
;
1743 struct smb2_handle
*durable_handle_v2
;
1745 bool query_maximal_access
;
1747 bool query_on_disk_id
;
1748 struct smb2_lease
*lease_request
;
1749 struct smb2_lease
*lease_request_v2
;
1751 struct GUID
*app_instance_id
;
1753 /* and any additional blobs the caller wants */
1754 struct smb2_create_blobs blobs
;
1757 union smb_handle file
;
1759 /* static body buffer 88 (0x58) bytes */
1760 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1761 uint8_t oplock_level
;
1763 uint32_t create_action
;
1768 uint64_t alloc_size
;
1772 /* struct smb2_handle handle;*/
1773 /* uint32_t blob_ofs; */
1774 /* uint32_t blob_size; */
1776 /* optional return values matching tagged values in the call */
1777 uint32_t maximal_access
;
1778 uint8_t on_disk_id
[32];
1779 struct smb2_lease lease_response
;
1780 struct smb2_lease lease_response_v2
;
1783 /* durable handle v2 */
1784 bool durable_open_v2
;
1785 bool persistent_open
;
1788 /* tagged blobs in the reply */
1789 struct smb2_create_blobs blobs
;
1796 enum smb_read_level
{
1804 #define RAW_READ_GENERIC RAW_READ_READX
1806 /* union for read() backend call
1808 note that .infoX.out.data will be allocated before the backend is
1809 called. It will be big enough to hold the maximum size asked for
1812 /* SMBreadX (and generic) interface */
1814 enum smb_read_level level
;
1816 union smb_handle file
;
1818 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1821 bool read_for_execute
;
1826 uint16_t compaction_mode
;
1831 /* SMBreadbraw interface */
1833 enum smb_read_level level
;
1835 union smb_handle file
;
1848 /* SMBlockandread interface */
1850 enum smb_read_level level
;
1852 union smb_handle file
;
1863 /* SMBread interface */
1865 enum smb_read_level level
;
1867 union smb_handle file
;
1880 enum smb_read_level level
;
1882 union smb_handle file
;
1884 /* static body buffer 48 (0x30) bytes */
1885 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1890 /* struct smb2_handle handle; */
1894 /* the docs give no indication of what
1895 these channel variables are for */
1896 uint16_t channel_offset
;
1897 uint16_t channel_length
;
1900 /* static body buffer 16 (0x10) bytes */
1901 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1902 /* uint8_t data_ofs; */
1903 /* uint8_t reserved; */
1904 /* uint32_t data_size; */
1915 enum smb_write_level
{
1916 RAW_WRITE_WRITEUNLOCK
,
1919 RAW_WRITE_WRITECLOSE
,
1924 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1926 /* union for write() backend call
1929 /* SMBwriteX interface */
1931 enum smb_write_level level
;
1933 union smb_handle file
;
1938 const uint8_t *data
;
1946 /* SMBwriteunlock interface */
1948 enum smb_write_level level
;
1950 union smb_handle file
;
1954 const uint8_t *data
;
1961 /* SMBwrite interface */
1963 enum smb_write_level level
;
1965 union smb_handle file
;
1969 const uint8_t *data
;
1976 /* SMBwriteclose interface */
1978 enum smb_write_level level
;
1980 union smb_handle file
;
1984 const uint8_t *data
;
1991 /* SMBsplwrite interface */
1993 enum smb_write_level level
;
1995 union smb_handle file
;
1997 const uint8_t *data
;
2003 enum smb_write_level level
;
2005 union smb_handle file
;
2007 /* static body buffer 48 (0x30) bytes */
2008 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2009 /* uint16_t data_ofs; */
2010 /* uint32_t data_size; */
2012 /* struct smb2_handle handle; */
2013 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2014 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2020 /* static body buffer 17 (0x11) bytes */
2021 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2024 uint64_t unknown1
; /* 0x0000000000000000 */
2030 enum smb_lock_level
{
2038 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2040 /* union for lock() backend call
2043 /* SMBlockingX and generic interface */
2045 enum smb_lock_level level
;
2047 union smb_handle file
;
2052 struct smb_lock_entry
{
2053 uint32_t pid
; /* 16 bits in SMB1 */
2056 } *locks
; /* unlocks are first in the arrray */
2060 /* SMBlock and SMBunlock interface */
2062 enum smb_lock_level level
;
2064 union smb_handle file
;
2072 enum smb_lock_level level
;
2074 union smb_handle file
;
2076 /* static body buffer 48 (0x30) bytes */
2077 /* uint16_t buffer_code; 0x30 */
2078 uint16_t lock_count
;
2079 uint32_t lock_sequence
;
2080 /* struct smb2_handle handle; */
2081 struct smb2_lock_element
{
2089 /* static body buffer 4 (0x04) bytes */
2090 /* uint16_t buffer_code; 0x04 */
2097 enum smb_lock_level level
;
2099 union smb_handle file
;
2101 /* static body buffer 24 (0x18) bytes */
2102 uint8_t oplock_level
;
2105 /* struct smb2_handle handle; */
2109 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2110 struct smb2_lease_break_ack
{
2113 struct smb2_lease lease
;
2115 } smb2_lease_break_ack
;
2119 enum smb_close_level
{
2127 union for close() backend call
2130 /* generic interface */
2132 enum smb_close_level level
;
2134 union smb_handle file
;
2136 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2144 uint64_t alloc_size
;
2150 /* SMBclose interface */
2152 enum smb_close_level level
;
2154 union smb_handle file
;
2159 /* SMBsplclose interface - empty! */
2161 enum smb_close_level level
;
2163 union smb_handle file
;
2169 enum smb_close_level level
;
2171 union smb_handle file
;
2173 /* static body buffer 24 (0x18) bytes */
2174 /* uint16_t buffer_code; 0x18 */
2175 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2179 /* static body buffer 60 (0x3C) bytes */
2180 /* uint16_t buffer_code; 0x3C */
2187 uint64_t alloc_size
;
2195 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2198 union for lpq() backend
2201 /* generic interface */
2203 enum smb_lpq_level level
;
2208 /* SMBsplretq interface */
2210 enum smb_lpq_level level
;
2218 uint16_t restart_idx
;
2230 enum smb_ioctl_level
{
2234 RAW_IOCTL_SMB2_NO_HANDLE
2238 union for ioctl() backend
2241 /* generic interface */
2243 enum smb_ioctl_level level
;
2245 union smb_handle file
;
2249 /* struct for SMBioctl */
2251 enum smb_ioctl_level level
;
2253 union smb_handle file
;
2262 /* struct for NT ioctl call */
2264 enum smb_ioctl_level level
;
2266 union smb_handle file
;
2280 enum smb_ioctl_level level
;
2282 union smb_handle file
;
2284 /* static body buffer 56 (0x38) bytes */
2285 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2288 /*struct smb2_handle handle;*/
2289 /* uint32_t out_ofs; */
2290 /* uint32_t out_size; */
2292 /* uint32_t in_ofs; */
2293 /* uint32_t in_size; */
2294 uint32_t max_response_size
;
2302 union smb_handle file
;
2304 /* static body buffer 48 (0x30) bytes */
2305 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2308 /* struct smb2_handle handle; */
2309 /* uint32_t in_ofs; */
2310 /* uint32_t in_size; */
2311 /* uint32_t out_ofs; */
2312 /* uint32_t out_size; */
2323 enum smb_flush_level
{
2330 /* struct for SMBflush */
2332 enum smb_flush_level level
;
2334 union smb_handle file
;
2338 /* SMBflush with 0xFFFF wildcard fnum */
2340 enum smb_flush_level level
;
2345 enum smb_flush_level level
;
2347 union smb_handle file
;
2357 /* struct for SMBcopy */
2372 /* struct for transact/transact2 call */
2380 uint8_t setup_count
;
2382 const char *trans_name
; /* SMBtrans only */
2388 uint8_t setup_count
;
2395 /* struct for nttransact2 call */
2396 struct smb_nttrans
{
2401 uint8_t setup_count
;
2409 uint8_t setup_count
; /* in units of 16 bit words */
2416 enum smb_notify_level
{
2422 /* struct for nttrans change notify call */
2424 enum smb_notify_level level
;
2427 union smb_handle file
;
2428 uint32_t buffer_size
;
2429 uint32_t completion_filter
;
2434 uint32_t num_changes
;
2435 struct notify_changes
{
2437 struct smb_wire_string name
;
2442 struct smb2_notify
{
2443 enum smb_notify_level level
;
2446 union smb_handle file
;
2447 /* static body buffer 32 (0x20) bytes */
2448 /* uint16_t buffer_code; 0x32 */
2450 uint32_t buffer_size
;
2451 /*struct smb2_handle file;*/
2452 uint32_t completion_filter
;
2457 /* static body buffer 8 (0x08) bytes */
2458 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2459 /* uint16_t blob_ofs; */
2460 /* uint16_t blob_size; */
2465 /* DATA_BLOB content */
2466 uint32_t num_changes
;
2467 struct notify_changes
*changes
;
2472 enum smb_search_level
{
2473 RAW_SEARCH_SEARCH
, /* SMBsearch */
2474 RAW_SEARCH_FFIRST
, /* SMBffirst */
2475 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2476 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2477 RAW_SEARCH_SMB2
/* SMB2 Find */
2480 enum smb_search_data_level
{
2481 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2482 RAW_SEARCH_DATA_SEARCH
,
2483 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2484 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2485 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2486 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2487 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2488 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2489 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2490 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2491 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2492 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2493 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2496 /* union for file search */
2497 union smb_search_first
{
2499 enum smb_search_level level
;
2500 enum smb_search_data_level data_level
;
2503 /* search (old) findfirst interface.
2504 Also used for ffirst and funique. */
2506 enum smb_search_level level
;
2507 enum smb_search_data_level data_level
;
2511 uint16_t search_attrib
;
2512 const char *pattern
;
2519 /* trans2 findfirst interface */
2521 enum smb_search_level level
;
2522 enum smb_search_data_level data_level
;
2525 uint16_t search_attrib
;
2528 uint32_t storage_type
;
2529 const char *pattern
;
2531 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2532 unsigned int num_names
;
2533 struct ea_name
*ea_names
;
2538 uint16_t end_of_search
;
2544 enum smb_search_level level
;
2545 enum smb_search_data_level data_level
;
2547 union smb_handle file
;
2549 /* static body buffer 32 (0x20) bytes */
2550 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2552 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2553 uint32_t file_index
;
2554 /* struct smb2_handle handle; */
2555 /* uint16_t pattern_ofs; */
2556 /* uint16_t pattern_size; */
2557 uint32_t max_response_size
;
2560 const char *pattern
;
2563 /* static body buffer 8 (0x08) bytes */
2564 /* uint16_t buffer_code; 0x08 */
2565 /* uint16_t blob_ofs; */
2566 /* uint32_t blob_size; */
2574 /* union for file search continue */
2575 union smb_search_next
{
2577 enum smb_search_level level
;
2578 enum smb_search_data_level data_level
;
2581 /* search (old) findnext interface. Also used
2582 for ffirst when continuing */
2584 enum smb_search_level level
;
2585 enum smb_search_data_level data_level
;
2589 uint16_t search_attrib
;
2590 struct smb_search_id
{
2594 uint32_t server_cookie
;
2595 uint32_t client_cookie
;
2603 /* trans2 findnext interface */
2605 enum smb_search_level level
;
2606 enum smb_search_data_level data_level
;
2611 uint32_t resume_key
;
2613 const char *last_name
;
2615 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2616 unsigned int num_names
;
2617 struct ea_name
*ea_names
;
2621 uint16_t end_of_search
;
2626 struct smb2_find smb2
;
2629 /* union for search reply file data */
2630 union smb_search_data
{
2632 * search (old) findfirst
2633 * RAW_SEARCH_DATA_SEARCH
2639 struct smb_search_id id
;
2643 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2645 uint32_t resume_key
;
2650 uint32_t alloc_size
;
2652 struct smb_wire_string name
;
2655 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2657 uint32_t resume_key
;
2662 uint32_t alloc_size
;
2665 struct smb_wire_string name
;
2668 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2670 uint32_t resume_key
;
2675 uint32_t alloc_size
;
2677 struct smb_ea_list eas
;
2678 struct smb_wire_string name
;
2681 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2683 uint32_t file_index
;
2689 uint64_t alloc_size
;
2691 struct smb_wire_string name
;
2694 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2696 uint32_t file_index
;
2702 uint64_t alloc_size
;
2705 struct smb_wire_string name
;
2706 } full_directory_info
;
2708 /* RAW_SEARCH_DATA_NAME_INFO interface */
2710 uint32_t file_index
;
2711 struct smb_wire_string name
;
2714 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2716 uint32_t file_index
;
2722 uint64_t alloc_size
;
2725 struct smb_wire_string short_name
;
2726 struct smb_wire_string name
;
2727 } both_directory_info
;
2729 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2731 uint32_t file_index
;
2737 uint64_t alloc_size
;
2741 struct smb_wire_string name
;
2742 } id_full_directory_info
;
2744 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2746 uint32_t file_index
;
2752 uint64_t alloc_size
;
2756 struct smb_wire_string short_name
;
2757 struct smb_wire_string name
;
2758 } id_both_directory_info
;
2760 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2762 uint32_t file_index
;
2764 uint64_t alloc_size
;
2765 NTTIME status_change_time
;
2774 uint64_t permissions
;
2779 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2781 uint32_t file_index
;
2782 uint64_t end_of_file
;
2784 NTTIME status_change_time
;
2793 uint64_t permissions
;
2796 uint32_t file_flags
;
2797 uint32_t flags_mask
;
2798 struct smb_wire_string name
;
2802 /* Callback function passed to the raw search interface. */
2803 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2805 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2807 /* union for file search close */
2808 union smb_search_close
{
2810 enum smb_search_close_level level
;
2813 /* SMBfclose (old search) interface */
2815 enum smb_search_close_level level
;
2818 /* max_count and search_attrib are not used, but are present */
2820 uint16_t search_attrib
;
2821 struct smb_search_id id
;
2825 /* SMBfindclose interface */
2827 enum smb_search_close_level level
;
2837 struct for SMBecho call
2841 uint16_t repeat_count
;
2847 uint16_t sequence_number
;
2854 struct for shadow copy volumes
2856 struct smb_shadow_copy
{
2858 union smb_handle file
;
2862 uint32_t num_volumes
;
2868 #endif /* __LIBCLI_RAW_INTERFACES_H__ */