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 struct GUID
*app_instance_id
;
1749 /* and any additional blobs the caller wants */
1750 struct smb2_create_blobs blobs
;
1753 union smb_handle file
;
1755 /* static body buffer 88 (0x58) bytes */
1756 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1757 uint8_t oplock_level
;
1759 uint32_t create_action
;
1764 uint64_t alloc_size
;
1768 /* struct smb2_handle handle;*/
1769 /* uint32_t blob_ofs; */
1770 /* uint32_t blob_size; */
1772 /* optional return values matching tagged values in the call */
1773 uint32_t maximal_access
;
1774 uint8_t on_disk_id
[32];
1775 struct smb2_lease lease_response
;
1778 /* durable handle v2 */
1779 bool durable_open_v2
;
1780 bool persistent_open
;
1783 /* tagged blobs in the reply */
1784 struct smb2_create_blobs blobs
;
1791 enum smb_read_level
{
1799 #define RAW_READ_GENERIC RAW_READ_READX
1801 /* union for read() backend call
1803 note that .infoX.out.data will be allocated before the backend is
1804 called. It will be big enough to hold the maximum size asked for
1807 /* SMBreadX (and generic) interface */
1809 enum smb_read_level level
;
1811 union smb_handle file
;
1813 uint32_t mincnt
; /* enforced on SMB2, 16 bit on SMB */
1816 bool read_for_execute
;
1821 uint16_t compaction_mode
;
1826 /* SMBreadbraw interface */
1828 enum smb_read_level level
;
1830 union smb_handle file
;
1843 /* SMBlockandread interface */
1845 enum smb_read_level level
;
1847 union smb_handle file
;
1858 /* SMBread interface */
1860 enum smb_read_level level
;
1862 union smb_handle file
;
1875 enum smb_read_level level
;
1877 union smb_handle file
;
1879 /* static body buffer 48 (0x30) bytes */
1880 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1885 /* struct smb2_handle handle; */
1889 /* the docs give no indication of what
1890 these channel variables are for */
1891 uint16_t channel_offset
;
1892 uint16_t channel_length
;
1895 /* static body buffer 16 (0x10) bytes */
1896 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1897 /* uint8_t data_ofs; */
1898 /* uint8_t reserved; */
1899 /* uint32_t data_size; */
1910 enum smb_write_level
{
1911 RAW_WRITE_WRITEUNLOCK
,
1914 RAW_WRITE_WRITECLOSE
,
1919 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1921 /* union for write() backend call
1924 /* SMBwriteX interface */
1926 enum smb_write_level level
;
1928 union smb_handle file
;
1933 const uint8_t *data
;
1941 /* SMBwriteunlock interface */
1943 enum smb_write_level level
;
1945 union smb_handle file
;
1949 const uint8_t *data
;
1956 /* SMBwrite interface */
1958 enum smb_write_level level
;
1960 union smb_handle file
;
1964 const uint8_t *data
;
1971 /* SMBwriteclose interface */
1973 enum smb_write_level level
;
1975 union smb_handle file
;
1979 const uint8_t *data
;
1986 /* SMBsplwrite interface */
1988 enum smb_write_level level
;
1990 union smb_handle file
;
1992 const uint8_t *data
;
1998 enum smb_write_level level
;
2000 union smb_handle file
;
2002 /* static body buffer 48 (0x30) bytes */
2003 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2004 /* uint16_t data_ofs; */
2005 /* uint32_t data_size; */
2007 /* struct smb2_handle handle; */
2008 uint64_t unknown1
; /* 0xFFFFFFFFFFFFFFFF */
2009 uint64_t unknown2
; /* 0xFFFFFFFFFFFFFFFF */
2015 /* static body buffer 17 (0x11) bytes */
2016 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
2019 uint64_t unknown1
; /* 0x0000000000000000 */
2025 enum smb_lock_level
{
2033 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
2035 /* union for lock() backend call
2038 /* SMBlockingX and generic interface */
2040 enum smb_lock_level level
;
2042 union smb_handle file
;
2047 struct smb_lock_entry
{
2048 uint32_t pid
; /* 16 bits in SMB1 */
2051 } *locks
; /* unlocks are first in the arrray */
2055 /* SMBlock and SMBunlock interface */
2057 enum smb_lock_level level
;
2059 union smb_handle file
;
2067 enum smb_lock_level level
;
2069 union smb_handle file
;
2071 /* static body buffer 48 (0x30) bytes */
2072 /* uint16_t buffer_code; 0x30 */
2073 uint16_t lock_count
;
2074 uint32_t lock_sequence
;
2075 /* struct smb2_handle handle; */
2076 struct smb2_lock_element
{
2084 /* static body buffer 4 (0x04) bytes */
2085 /* uint16_t buffer_code; 0x04 */
2092 enum smb_lock_level level
;
2094 union smb_handle file
;
2096 /* static body buffer 24 (0x18) bytes */
2097 uint8_t oplock_level
;
2100 /* struct smb2_handle handle; */
2104 /* SMB2 Lease Break Ack (same opcode as smb2_break) */
2105 struct smb2_lease_break_ack
{
2108 struct smb2_lease lease
;
2110 } smb2_lease_break_ack
;
2114 enum smb_close_level
{
2122 union for close() backend call
2125 /* generic interface */
2127 enum smb_close_level level
;
2129 union smb_handle file
;
2131 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2139 uint64_t alloc_size
;
2145 /* SMBclose interface */
2147 enum smb_close_level level
;
2149 union smb_handle file
;
2154 /* SMBsplclose interface - empty! */
2156 enum smb_close_level level
;
2158 union smb_handle file
;
2164 enum smb_close_level level
;
2166 union smb_handle file
;
2168 /* static body buffer 24 (0x18) bytes */
2169 /* uint16_t buffer_code; 0x18 */
2170 uint16_t flags
; /* SMB2_CLOSE_FLAGS_* */
2174 /* static body buffer 60 (0x3C) bytes */
2175 /* uint16_t buffer_code; 0x3C */
2182 uint64_t alloc_size
;
2190 enum smb_lpq_level
{RAW_LPQ_GENERIC
, RAW_LPQ_RETQ
};
2193 union for lpq() backend
2196 /* generic interface */
2198 enum smb_lpq_level level
;
2203 /* SMBsplretq interface */
2205 enum smb_lpq_level level
;
2213 uint16_t restart_idx
;
2225 enum smb_ioctl_level
{
2229 RAW_IOCTL_SMB2_NO_HANDLE
2233 union for ioctl() backend
2236 /* generic interface */
2238 enum smb_ioctl_level level
;
2240 union smb_handle file
;
2244 /* struct for SMBioctl */
2246 enum smb_ioctl_level level
;
2248 union smb_handle file
;
2257 /* struct for NT ioctl call */
2259 enum smb_ioctl_level level
;
2261 union smb_handle file
;
2275 enum smb_ioctl_level level
;
2277 union smb_handle file
;
2279 /* static body buffer 56 (0x38) bytes */
2280 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2283 /*struct smb2_handle handle;*/
2284 /* uint32_t out_ofs; */
2285 /* uint32_t out_size; */
2287 /* uint32_t in_ofs; */
2288 /* uint32_t in_size; */
2289 uint32_t max_response_size
;
2297 union smb_handle file
;
2299 /* static body buffer 48 (0x30) bytes */
2300 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2303 /* struct smb2_handle handle; */
2304 /* uint32_t in_ofs; */
2305 /* uint32_t in_size; */
2306 /* uint32_t out_ofs; */
2307 /* uint32_t out_size; */
2318 enum smb_flush_level
{
2325 /* struct for SMBflush */
2327 enum smb_flush_level level
;
2329 union smb_handle file
;
2333 /* SMBflush with 0xFFFF wildcard fnum */
2335 enum smb_flush_level level
;
2340 enum smb_flush_level level
;
2342 union smb_handle file
;
2352 /* struct for SMBcopy */
2367 /* struct for transact/transact2 call */
2375 uint8_t setup_count
;
2377 const char *trans_name
; /* SMBtrans only */
2383 uint8_t setup_count
;
2390 /* struct for nttransact2 call */
2391 struct smb_nttrans
{
2396 uint8_t setup_count
;
2404 uint8_t setup_count
; /* in units of 16 bit words */
2411 enum smb_notify_level
{
2417 /* struct for nttrans change notify call */
2419 enum smb_notify_level level
;
2422 union smb_handle file
;
2423 uint32_t buffer_size
;
2424 uint32_t completion_filter
;
2429 uint32_t num_changes
;
2430 struct notify_changes
{
2432 struct smb_wire_string name
;
2437 struct smb2_notify
{
2438 enum smb_notify_level level
;
2441 union smb_handle file
;
2442 /* static body buffer 32 (0x20) bytes */
2443 /* uint16_t buffer_code; 0x32 */
2445 uint32_t buffer_size
;
2446 /*struct smb2_handle file;*/
2447 uint32_t completion_filter
;
2452 /* static body buffer 8 (0x08) bytes */
2453 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2454 /* uint16_t blob_ofs; */
2455 /* uint16_t blob_size; */
2460 /* DATA_BLOB content */
2461 uint32_t num_changes
;
2462 struct notify_changes
*changes
;
2467 enum smb_search_level
{
2468 RAW_SEARCH_SEARCH
, /* SMBsearch */
2469 RAW_SEARCH_FFIRST
, /* SMBffirst */
2470 RAW_SEARCH_FUNIQUE
, /* SMBfunique */
2471 RAW_SEARCH_TRANS2
, /* SMBtrans2 */
2472 RAW_SEARCH_SMB2
/* SMB2 Find */
2475 enum smb_search_data_level
{
2476 RAW_SEARCH_DATA_GENERIC
= 0x10000, /* only used in the smbcli_ code */
2477 RAW_SEARCH_DATA_SEARCH
,
2478 RAW_SEARCH_DATA_STANDARD
= SMB_FIND_STANDARD
,
2479 RAW_SEARCH_DATA_EA_SIZE
= SMB_FIND_EA_SIZE
,
2480 RAW_SEARCH_DATA_EA_LIST
= SMB_FIND_EA_LIST
,
2481 RAW_SEARCH_DATA_DIRECTORY_INFO
= SMB_FIND_DIRECTORY_INFO
,
2482 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO
= SMB_FIND_FULL_DIRECTORY_INFO
,
2483 RAW_SEARCH_DATA_NAME_INFO
= SMB_FIND_NAME_INFO
,
2484 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO
= SMB_FIND_BOTH_DIRECTORY_INFO
,
2485 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO
= SMB_FIND_ID_FULL_DIRECTORY_INFO
,
2486 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO
= SMB_FIND_ID_BOTH_DIRECTORY_INFO
,
2487 RAW_SEARCH_DATA_UNIX_INFO
= SMB_FIND_UNIX_INFO
,
2488 RAW_SEARCH_DATA_UNIX_INFO2
= SMB_FIND_UNIX_INFO2
2491 /* union for file search */
2492 union smb_search_first
{
2494 enum smb_search_level level
;
2495 enum smb_search_data_level data_level
;
2498 /* search (old) findfirst interface.
2499 Also used for ffirst and funique. */
2501 enum smb_search_level level
;
2502 enum smb_search_data_level data_level
;
2506 uint16_t search_attrib
;
2507 const char *pattern
;
2514 /* trans2 findfirst interface */
2516 enum smb_search_level level
;
2517 enum smb_search_data_level data_level
;
2520 uint16_t search_attrib
;
2523 uint32_t storage_type
;
2524 const char *pattern
;
2526 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2527 unsigned int num_names
;
2528 struct ea_name
*ea_names
;
2533 uint16_t end_of_search
;
2539 enum smb_search_level level
;
2540 enum smb_search_data_level data_level
;
2542 union smb_handle file
;
2544 /* static body buffer 32 (0x20) bytes */
2545 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2547 uint8_t continue_flags
; /* SMB2_CONTINUE_FLAG_* */
2548 uint32_t file_index
;
2549 /* struct smb2_handle handle; */
2550 /* uint16_t pattern_ofs; */
2551 /* uint16_t pattern_size; */
2552 uint32_t max_response_size
;
2555 const char *pattern
;
2558 /* static body buffer 8 (0x08) bytes */
2559 /* uint16_t buffer_code; 0x08 */
2560 /* uint16_t blob_ofs; */
2561 /* uint32_t blob_size; */
2569 /* union for file search continue */
2570 union smb_search_next
{
2572 enum smb_search_level level
;
2573 enum smb_search_data_level data_level
;
2576 /* search (old) findnext interface. Also used
2577 for ffirst when continuing */
2579 enum smb_search_level level
;
2580 enum smb_search_data_level data_level
;
2584 uint16_t search_attrib
;
2585 struct smb_search_id
{
2589 uint32_t server_cookie
;
2590 uint32_t client_cookie
;
2598 /* trans2 findnext interface */
2600 enum smb_search_level level
;
2601 enum smb_search_data_level data_level
;
2606 uint32_t resume_key
;
2608 const char *last_name
;
2610 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2611 unsigned int num_names
;
2612 struct ea_name
*ea_names
;
2616 uint16_t end_of_search
;
2621 struct smb2_find smb2
;
2624 /* union for search reply file data */
2625 union smb_search_data
{
2627 * search (old) findfirst
2628 * RAW_SEARCH_DATA_SEARCH
2634 struct smb_search_id id
;
2638 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2640 uint32_t resume_key
;
2645 uint32_t alloc_size
;
2647 struct smb_wire_string name
;
2650 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2652 uint32_t resume_key
;
2657 uint32_t alloc_size
;
2660 struct smb_wire_string name
;
2663 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2665 uint32_t resume_key
;
2670 uint32_t alloc_size
;
2672 struct smb_ea_list eas
;
2673 struct smb_wire_string name
;
2676 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2678 uint32_t file_index
;
2684 uint64_t alloc_size
;
2686 struct smb_wire_string name
;
2689 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2691 uint32_t file_index
;
2697 uint64_t alloc_size
;
2700 struct smb_wire_string name
;
2701 } full_directory_info
;
2703 /* RAW_SEARCH_DATA_NAME_INFO interface */
2705 uint32_t file_index
;
2706 struct smb_wire_string name
;
2709 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2711 uint32_t file_index
;
2717 uint64_t alloc_size
;
2720 struct smb_wire_string short_name
;
2721 struct smb_wire_string name
;
2722 } both_directory_info
;
2724 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2726 uint32_t file_index
;
2732 uint64_t alloc_size
;
2736 struct smb_wire_string name
;
2737 } id_full_directory_info
;
2739 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2741 uint32_t file_index
;
2747 uint64_t alloc_size
;
2751 struct smb_wire_string short_name
;
2752 struct smb_wire_string name
;
2753 } id_both_directory_info
;
2755 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2757 uint32_t file_index
;
2759 uint64_t alloc_size
;
2760 NTTIME status_change_time
;
2769 uint64_t permissions
;
2774 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2776 uint32_t file_index
;
2777 uint64_t end_of_file
;
2779 NTTIME status_change_time
;
2788 uint64_t permissions
;
2791 uint32_t file_flags
;
2792 uint32_t flags_mask
;
2793 struct smb_wire_string name
;
2797 /* Callback function passed to the raw search interface. */
2798 typedef bool (*smbcli_search_callback
)(void *private_data
, const union smb_search_data
*file
);
2800 enum smb_search_close_level
{RAW_FINDCLOSE_GENERIC
, RAW_FINDCLOSE_FCLOSE
, RAW_FINDCLOSE_FINDCLOSE
};
2802 /* union for file search close */
2803 union smb_search_close
{
2805 enum smb_search_close_level level
;
2808 /* SMBfclose (old search) interface */
2810 enum smb_search_close_level level
;
2813 /* max_count and search_attrib are not used, but are present */
2815 uint16_t search_attrib
;
2816 struct smb_search_id id
;
2820 /* SMBfindclose interface */
2822 enum smb_search_close_level level
;
2832 struct for SMBecho call
2836 uint16_t repeat_count
;
2842 uint16_t sequence_number
;
2849 struct for shadow copy volumes
2851 struct smb_shadow_copy
{
2853 union smb_handle file
;
2857 uint32_t num_volumes
;
2863 #endif /* __LIBCLI_RAW_INTERFACES_H__ */