2021-06-18 13:31:49 +08:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1 */
|
2011-03-15 10:08:48 +08:00
|
|
|
/*
|
|
|
|
*
|
2013-06-20 06:41:10 +08:00
|
|
|
* Copyright (c) International Business Machines Corp., 2009, 2013
|
2011-03-15 10:08:48 +08:00
|
|
|
* Etersoft, 2012
|
|
|
|
* Author(s): Steve French (sfrench@us.ibm.com)
|
|
|
|
* Pavel Shilovsky (pshilovsky@samba.org) 2012
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SMB2PDU_H
|
|
|
|
#define _SMB2PDU_H
|
|
|
|
|
|
|
|
#include <net/sock.h>
|
2021-07-04 04:49:35 +08:00
|
|
|
#include "cifsacl.h"
|
2011-03-15 10:08:48 +08:00
|
|
|
|
2019-01-29 10:46:16 +08:00
|
|
|
/* 52 transform hdr + 64 hdr + 88 create rsp */
|
2019-01-29 10:46:17 +08:00
|
|
|
#define SMB2_TRANSFORM_HEADER_SIZE 52
|
2019-01-29 10:46:16 +08:00
|
|
|
#define MAX_SMB2_HDR_SIZE 204
|
2011-12-27 02:53:34 +08:00
|
|
|
|
2020-03-27 10:42:24 +08:00
|
|
|
/* The total header size for SMB2 read and write */
|
2021-11-05 07:39:01 +08:00
|
|
|
#define SMB2_READWRITE_PDU_HEADER_SIZE (48 + sizeof(struct smb2_hdr))
|
2020-03-16 07:04:13 +08:00
|
|
|
|
2020-10-05 06:42:27 +08:00
|
|
|
/* See MS-SMB2 2.2.43 */
|
|
|
|
struct smb2_rdma_transform {
|
|
|
|
__le16 RdmaDescriptorOffset;
|
|
|
|
__le16 RdmaDescriptorLength;
|
|
|
|
__le32 Channel; /* for values see channel description in smb2 read above */
|
|
|
|
__le16 TransformCount;
|
|
|
|
__le16 Reserved1;
|
|
|
|
__le32 Reserved2;
|
|
|
|
} __packed;
|
|
|
|
|
2021-04-10 04:20:24 +08:00
|
|
|
/* TransformType */
|
|
|
|
#define SMB2_RDMA_TRANSFORM_TYPE_ENCRYPTION 0x0001
|
|
|
|
#define SMB2_RDMA_TRANSFORM_TYPE_SIGNING 0x0002
|
|
|
|
|
|
|
|
struct smb2_rdma_crypto_transform {
|
2020-10-05 06:42:27 +08:00
|
|
|
__le16 TransformType;
|
|
|
|
__le16 SignatureLength;
|
|
|
|
__le16 NonceLength;
|
|
|
|
__u16 Reserved;
|
|
|
|
__u8 Signature[]; /* variable length */
|
|
|
|
/* u8 Nonce[] */
|
|
|
|
/* followed by padding */
|
|
|
|
} __packed;
|
|
|
|
|
2011-06-08 19:51:07 +08:00
|
|
|
/*
|
|
|
|
* Definitions for SMB2 Protocol Data Units (network frames)
|
|
|
|
*
|
|
|
|
* See MS-SMB2.PDF specification for protocol details.
|
|
|
|
* The Naming convention is the lower case version of the SMB2
|
|
|
|
* command code name for the struct. Note that structures must be packed.
|
|
|
|
*
|
|
|
|
*/
|
2012-07-27 05:20:41 +08:00
|
|
|
|
2018-08-08 13:07:49 +08:00
|
|
|
#define COMPOUND_FID 0xFFFFFFFFFFFFFFFFULL
|
|
|
|
|
2022-10-04 05:43:50 +08:00
|
|
|
#define SMB2_SYMLINK_STRUCT_SIZE \
|
|
|
|
(sizeof(struct smb2_err_rsp) - 1 + sizeof(struct smb2_symlink_err_rsp))
|
|
|
|
|
2019-07-09 16:41:11 +08:00
|
|
|
#define SYMLINK_ERROR_TAG 0x4c4d5953
|
|
|
|
|
2013-08-14 23:25:21 +08:00
|
|
|
struct smb2_symlink_err_rsp {
|
|
|
|
__le32 SymLinkLength;
|
|
|
|
__le32 SymLinkErrorTag;
|
|
|
|
__le32 ReparseTag;
|
|
|
|
__le16 ReparseDataLength;
|
|
|
|
__le16 UnparsedPathLength;
|
|
|
|
__le16 SubstituteNameOffset;
|
|
|
|
__le16 SubstituteNameLength;
|
|
|
|
__le16 PrintNameOffset;
|
|
|
|
__le16 PrintNameLength;
|
|
|
|
__le32 Flags;
|
2020-03-09 23:44:51 +08:00
|
|
|
__u8 PathBuffer[];
|
2013-08-14 23:25:21 +08:00
|
|
|
} __packed;
|
|
|
|
|
2018-02-06 04:46:18 +08:00
|
|
|
/* SMB 3.1.1 and later dialects. See MS-SMB2 section 2.2.2.1 */
|
|
|
|
struct smb2_error_context_rsp {
|
|
|
|
__le32 ErrorDataLength;
|
|
|
|
__le32 ErrorId;
|
|
|
|
__u8 ErrorContextData; /* ErrorDataLength long array */
|
|
|
|
} __packed;
|
|
|
|
|
2020-03-17 14:53:39 +08:00
|
|
|
/* ErrorId values */
|
|
|
|
#define SMB2_ERROR_ID_DEFAULT 0x00000000
|
|
|
|
#define SMB2_ERROR_ID_SHARE_REDIRECT cpu_to_le32(0x72645253) /* "rdRS" */
|
|
|
|
|
2018-02-06 04:46:18 +08:00
|
|
|
/* Defines for Type field below (see MS-SMB2 2.2.2.2.2.1) */
|
|
|
|
#define MOVE_DST_IPADDR_V4 cpu_to_le32(0x00000001)
|
|
|
|
#define MOVE_DST_IPADDR_V6 cpu_to_le32(0x00000002)
|
|
|
|
|
|
|
|
struct move_dst_ipaddr {
|
|
|
|
__le32 Type;
|
|
|
|
__u32 Reserved;
|
|
|
|
__u8 address[16]; /* IPv4 followed by 12 bytes rsvd or IPv6 address */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct share_redirect_error_context_rsp {
|
|
|
|
__le32 StructureSize;
|
|
|
|
__le32 NotificationType;
|
|
|
|
__le32 ResourceNameOffset;
|
|
|
|
__le32 ResourceNameLength;
|
2021-06-23 02:56:20 +08:00
|
|
|
__le16 Reserved;
|
2018-02-06 04:46:18 +08:00
|
|
|
__le16 TargetType;
|
|
|
|
__le32 IPAddrCount;
|
2020-03-09 23:44:51 +08:00
|
|
|
struct move_dst_ipaddr IpAddrMoveList[];
|
2018-02-06 04:46:18 +08:00
|
|
|
/* __u8 ResourceName[] */ /* Name of share as counted Unicode string */
|
|
|
|
} __packed;
|
|
|
|
|
2018-08-21 09:49:21 +08:00
|
|
|
/*
|
|
|
|
* Maximum number of iovs we need for an open/create request.
|
|
|
|
* [0] : struct smb2_create_req
|
|
|
|
* [1] : path
|
|
|
|
* [2] : lease context
|
|
|
|
* [3] : durable context
|
|
|
|
* [4] : posix context
|
|
|
|
* [5] : time warp context
|
2019-07-07 03:41:38 +08:00
|
|
|
* [6] : query id context
|
|
|
|
* [7] : compound padding
|
2018-08-21 09:49:21 +08:00
|
|
|
*/
|
2019-07-07 03:41:38 +08:00
|
|
|
#define SMB2_CREATE_IOV_SIZE 8
|
2018-08-21 09:49:21 +08:00
|
|
|
|
2019-01-29 10:46:17 +08:00
|
|
|
/*
|
|
|
|
* Maximum size of a SMB2_CREATE response is 64 (smb2 header) +
|
2019-07-07 03:41:38 +08:00
|
|
|
* 88 (fixed part of create response) + 520 (path) + 208 (contexts) +
|
2019-01-29 10:46:17 +08:00
|
|
|
* 2 bytes of padding.
|
|
|
|
*/
|
2019-07-07 03:41:38 +08:00
|
|
|
#define MAX_SMB2_CREATE_RESPONSE_SIZE 880
|
2019-01-29 10:46:17 +08:00
|
|
|
|
2013-09-05 20:11:28 +08:00
|
|
|
#define SMB2_LEASE_READ_CACHING_HE 0x01
|
|
|
|
#define SMB2_LEASE_HANDLE_CACHING_HE 0x02
|
|
|
|
#define SMB2_LEASE_WRITE_CACHING_HE 0x04
|
|
|
|
|
2013-07-04 22:41:09 +08:00
|
|
|
struct create_durable {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
2013-07-09 22:40:58 +08:00
|
|
|
union {
|
|
|
|
__u8 Reserved[16];
|
|
|
|
struct {
|
|
|
|
__u64 PersistentFileId;
|
|
|
|
__u64 VolatileFileId;
|
|
|
|
} Fid;
|
|
|
|
} Data;
|
2013-07-04 22:41:09 +08:00
|
|
|
} __packed;
|
|
|
|
|
2015-11-03 23:26:27 +08:00
|
|
|
/* See MS-SMB2 2.2.13.2.11 */
|
|
|
|
/* Flags */
|
|
|
|
#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
|
|
|
|
struct durable_context_v2 {
|
|
|
|
__le32 Timeout;
|
|
|
|
__le32 Flags;
|
|
|
|
__u64 Reserved;
|
|
|
|
__u8 CreateGuid[16];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct create_durable_v2 {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
struct durable_context_v2 dcontext;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* See MS-SMB2 2.2.13.2.12 */
|
|
|
|
struct durable_reconnect_context_v2 {
|
|
|
|
struct {
|
|
|
|
__u64 PersistentFileId;
|
|
|
|
__u64 VolatileFileId;
|
|
|
|
} Fid;
|
|
|
|
__u8 CreateGuid[16];
|
|
|
|
__le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
|
|
|
|
} __packed;
|
|
|
|
|
2019-06-28 15:35:10 +08:00
|
|
|
/* See MS-SMB2 2.2.14.2.9 */
|
2019-07-19 06:22:18 +08:00
|
|
|
struct create_on_disk_id {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
2019-06-28 15:35:10 +08:00
|
|
|
__le64 DiskFileId;
|
|
|
|
__le64 VolumeId;
|
2019-07-07 03:41:38 +08:00
|
|
|
__u32 Reserved[4];
|
2019-06-28 15:35:10 +08:00
|
|
|
} __packed;
|
|
|
|
|
2015-11-03 23:26:27 +08:00
|
|
|
/* See MS-SMB2 2.2.14.2.12 */
|
|
|
|
struct durable_reconnect_context_v2_rsp {
|
|
|
|
__le32 Timeout;
|
|
|
|
__le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct create_durable_handle_reconnect_v2 {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
struct durable_reconnect_context_v2 dcontext;
|
2019-11-07 05:58:15 +08:00
|
|
|
__u8 Pad[4];
|
2015-11-03 23:26:27 +08:00
|
|
|
} __packed;
|
|
|
|
|
smb3: allow previous versions to be mounted with snapshot= mount parm
mounting with the "snapshots=" mount parm allows a read-only
view of a previous version of a file system (see MS-SMB2
and "timewarp" tokens, section 2.2.13.2.6) based on the timestamp
passed in on the snapshots mount parm.
Add processing to optionally send this create context.
Example output:
/mnt1 is mounted with "snapshots=..." and will see an earlier
version of the directory, with three fewer files than /mnt2
the current version of the directory.
root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# cat /proc/mounts | grep cifs
//172.22.149.186/public /mnt1 cifs
ro,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,snapshot=131748608570000000,actimeo=1
//172.22.149.186/public /mnt2 cifs
rw,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1
root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1
EmptyDir newerdir
root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1/newerdir
root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2
EmptyDir file newerdir newestdir timestamp-trace.cap
root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2/newerdir
new-file-not-in-snapshot
Snapshots are extremely useful for comparing previous versions of files or directories,
and recovering from data corruptions or mistakes.
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
2018-08-10 15:25:06 +08:00
|
|
|
/* See MS-SMB2 2.2.13.2.5 */
|
|
|
|
struct crt_twarp_ctxt {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
__le64 Timestamp;
|
|
|
|
|
|
|
|
} __packed;
|
|
|
|
|
2019-07-07 03:41:38 +08:00
|
|
|
/* See MS-SMB2 2.2.13.2.9 */
|
|
|
|
struct crt_query_id_ctxt {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
} __packed;
|
|
|
|
|
2019-12-06 16:02:38 +08:00
|
|
|
struct crt_sd_ctxt {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
struct smb3_sd sd;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
|
2013-11-14 14:05:36 +08:00
|
|
|
#define COPY_CHUNK_RES_KEY_SIZE 24
|
|
|
|
struct resume_key_req {
|
|
|
|
char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
|
|
|
|
__le32 ContextLength; /* MBZ */
|
2020-03-09 23:44:51 +08:00
|
|
|
char Context[]; /* ignored, Windows sets to 4 bytes of zero */
|
2013-11-14 14:05:36 +08:00
|
|
|
} __packed;
|
|
|
|
|
2013-06-20 06:41:10 +08:00
|
|
|
/* this goes in the ioctl buffer when doing a copychunk request */
|
|
|
|
struct copychunk_ioctl {
|
2013-11-14 14:05:36 +08:00
|
|
|
char SourceKey[COPY_CHUNK_RES_KEY_SIZE];
|
2013-06-20 06:41:10 +08:00
|
|
|
__le32 ChunkCount; /* we are only sending 1 */
|
|
|
|
__le32 Reserved;
|
|
|
|
/* array will only be one chunk long for us */
|
|
|
|
__le64 SourceOffset;
|
|
|
|
__le64 TargetOffset;
|
2013-06-22 04:35:45 +08:00
|
|
|
__le32 Length; /* how many bytes to copy */
|
2013-06-20 06:41:10 +08:00
|
|
|
__u32 Reserved2;
|
|
|
|
} __packed;
|
|
|
|
|
2013-11-14 14:05:36 +08:00
|
|
|
struct copychunk_ioctl_rsp {
|
|
|
|
__le32 ChunksWritten;
|
|
|
|
__le32 ChunkBytesWritten;
|
|
|
|
__le32 TotalBytesWritten;
|
|
|
|
} __packed;
|
|
|
|
|
2020-10-24 04:21:38 +08:00
|
|
|
/* See MS-FSCC 2.3.29 and 2.3.30 */
|
|
|
|
struct get_retrieval_pointer_count_req {
|
|
|
|
__le64 StartingVcn; /* virtual cluster number (signed) */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct get_retrieval_pointer_count_rsp {
|
|
|
|
__le32 ExtentCount;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* See MS-FSCC 2.3.33 and 2.3.34
|
|
|
|
* request is the same as get_retrieval_point_count_req struct above
|
|
|
|
*/
|
|
|
|
struct smb3_extents {
|
|
|
|
__le64 NextVcn;
|
|
|
|
__le64 Lcn; /* logical cluster number */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct get_retrieval_pointers_refcount_rsp {
|
|
|
|
__le32 ExtentCount;
|
|
|
|
__u32 Reserved;
|
|
|
|
__le64 StartingVcn;
|
|
|
|
struct smb3_extents extents[];
|
|
|
|
} __packed;
|
|
|
|
|
2017-02-13 23:16:49 +08:00
|
|
|
/* See MS-DFSC 2.2.2 */
|
|
|
|
struct fsctl_get_dfs_referral_req {
|
|
|
|
__le16 MaxReferralLevel;
|
|
|
|
__u8 RequestFileName[];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* DFS response is struct get_dfs_refer_rsp */
|
|
|
|
|
2015-11-03 23:26:27 +08:00
|
|
|
/* See MS-SMB2 2.2.31.3 */
|
|
|
|
struct network_resiliency_req {
|
|
|
|
__le32 Timeout;
|
|
|
|
__le32 Reserved;
|
|
|
|
} __packed;
|
|
|
|
/* There is no buffer for the response ie no struct network_resiliency_rsp */
|
|
|
|
|
2018-06-14 21:43:17 +08:00
|
|
|
#define RSS_CAPABLE cpu_to_le32(0x00000001)
|
|
|
|
#define RDMA_CAPABLE cpu_to_le32(0x00000002)
|
|
|
|
|
|
|
|
#define INTERNETWORK cpu_to_le16(0x0002)
|
|
|
|
#define INTERNETWORKV6 cpu_to_le16(0x0017)
|
2013-06-25 13:20:49 +08:00
|
|
|
|
|
|
|
struct network_interface_info_ioctl_rsp {
|
|
|
|
__le32 Next; /* next interface. zero if this is last one */
|
|
|
|
__le32 IfIndex;
|
|
|
|
__le32 Capability; /* RSS or RDMA Capable */
|
|
|
|
__le32 Reserved;
|
|
|
|
__le64 LinkSpeed;
|
2018-06-14 21:43:17 +08:00
|
|
|
__le16 Family;
|
|
|
|
__u8 Buffer[126];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct iface_info_ipv4 {
|
|
|
|
__be16 Port;
|
|
|
|
__be32 IPv4Address;
|
|
|
|
__be64 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct iface_info_ipv6 {
|
|
|
|
__be16 Port;
|
|
|
|
__be32 FlowInfo;
|
|
|
|
__u8 IPv6Address[16];
|
|
|
|
__be32 ScopeId;
|
2013-06-25 13:20:49 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
#define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */
|
|
|
|
|
2013-10-15 04:31:32 +08:00
|
|
|
struct compress_ioctl {
|
2013-10-15 04:27:32 +08:00
|
|
|
__le16 CompressionState; /* See cifspdu.h for possible flag values */
|
2013-10-15 04:31:32 +08:00
|
|
|
} __packed;
|
|
|
|
|
2019-03-13 12:37:49 +08:00
|
|
|
/*
|
|
|
|
* Maximum number of iovs we need for an ioctl request.
|
|
|
|
* [0] : struct smb2_ioctl_req
|
|
|
|
* [1] : in_data
|
|
|
|
*/
|
|
|
|
#define SMB2_IOCTL_IOV_SIZE 2
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
/*
|
2022-03-27 05:17:03 +08:00
|
|
|
* PDU query infolevel structure definitions
|
2011-12-29 21:06:33 +08:00
|
|
|
* BB consider moving to a different header
|
|
|
|
*/
|
|
|
|
|
2017-08-24 09:24:55 +08:00
|
|
|
struct smb2_file_full_ea_info { /* encoding of response for level 15 */
|
|
|
|
__le32 next_entry_offset;
|
|
|
|
__u8 flags;
|
|
|
|
__u8 ea_name_length;
|
|
|
|
__le16 ea_value_length;
|
2020-03-09 23:44:51 +08:00
|
|
|
char ea_data[]; /* \0 terminated name plus value */
|
2017-08-24 09:24:55 +08:00
|
|
|
} __packed; /* level 15 Set */
|
|
|
|
|
2020-10-23 11:03:14 +08:00
|
|
|
struct smb2_file_reparse_point_info {
|
|
|
|
__le64 IndexNumber;
|
|
|
|
__le32 Tag;
|
|
|
|
} __packed;
|
|
|
|
|
2019-12-03 11:46:54 +08:00
|
|
|
struct smb2_file_network_open_info {
|
|
|
|
__le64 CreationTime;
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le64 AllocationSize;
|
|
|
|
__le64 EndOfFile;
|
|
|
|
__le32 Attributes;
|
|
|
|
__le32 Reserved;
|
|
|
|
} __packed; /* level 34 Query also similar returned in close rsp and open rsp */
|
|
|
|
|
2021-06-23 02:56:20 +08:00
|
|
|
/* See MS-FSCC 2.4.21 */
|
2020-02-07 02:32:03 +08:00
|
|
|
struct smb2_file_id_information {
|
|
|
|
__le64 VolumeSerialNumber;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
} __packed; /* level 59 */
|
|
|
|
|
2021-06-23 02:56:20 +08:00
|
|
|
/* See MS-FSCC 2.4.18 */
|
|
|
|
struct smb2_file_id_extd_directory_info {
|
|
|
|
__le32 NextEntryOffset;
|
|
|
|
__u32 FileIndex;
|
|
|
|
__le64 CreationTime;
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le64 EndOfFile;
|
|
|
|
__le64 AllocationSize;
|
|
|
|
__le32 FileAttributes;
|
|
|
|
__le32 FileNameLength;
|
|
|
|
__le32 EaSize; /* EA size */
|
|
|
|
__le32 ReparsePointTag; /* valid if FILE_ATTR_REPARSE_POINT set in FileAttributes */
|
|
|
|
__le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit */
|
|
|
|
char FileName[1];
|
|
|
|
} __packed; /* level 60 */
|
|
|
|
|
2018-08-08 13:07:49 +08:00
|
|
|
extern char smb2_padding[7];
|
|
|
|
|
2020-02-07 07:31:56 +08:00
|
|
|
/* equivalent of the contents of SMB3.1.1 POSIX open context response */
|
2020-02-08 22:50:56 +08:00
|
|
|
struct create_posix_rsp {
|
2020-03-03 00:53:22 +08:00
|
|
|
u32 nlink;
|
|
|
|
u32 reparse_tag;
|
|
|
|
u32 mode;
|
|
|
|
struct cifs_sid owner; /* var-sized on the wire */
|
|
|
|
struct cifs_sid group; /* var-sized on the wire */
|
2020-02-08 22:50:56 +08:00
|
|
|
} __packed;
|
2020-02-08 22:50:57 +08:00
|
|
|
|
2022-03-27 05:17:03 +08:00
|
|
|
#define SMB2_QUERY_DIRECTORY_IOV_SIZE 2
|
|
|
|
|
2020-02-08 22:50:57 +08:00
|
|
|
/*
|
2020-06-12 08:25:47 +08:00
|
|
|
* SMB2-only POSIX info level for query dir
|
2020-02-08 22:50:57 +08:00
|
|
|
*
|
|
|
|
* See posix_info_sid_size(), posix_info_extra_size() and
|
|
|
|
* posix_info_parse() to help with the handling of this struct.
|
|
|
|
*/
|
|
|
|
struct smb2_posix_info {
|
|
|
|
__le32 NextEntryOffset;
|
|
|
|
__u32 Ignored;
|
|
|
|
__le64 CreationTime;
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le64 EndOfFile;
|
|
|
|
__le64 AllocationSize;
|
|
|
|
__le32 DosAttributes;
|
|
|
|
__le64 Inode;
|
|
|
|
__le32 DeviceId;
|
|
|
|
__le32 Zero;
|
|
|
|
/* beginning of POSIX Create Context Response */
|
|
|
|
__le32 HardLinks;
|
|
|
|
__le32 ReparseTag;
|
|
|
|
__le32 Mode;
|
|
|
|
/*
|
|
|
|
* var sized owner SID
|
|
|
|
* var sized group SID
|
|
|
|
* le32 filenamelength
|
|
|
|
* u8 filename[]
|
|
|
|
*/
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parsed version of the above struct. Allows direct access to the
|
|
|
|
* variable length fields
|
|
|
|
*/
|
|
|
|
struct smb2_posix_info_parsed {
|
|
|
|
const struct smb2_posix_info *base;
|
|
|
|
size_t size;
|
|
|
|
struct cifs_sid owner;
|
|
|
|
struct cifs_sid group;
|
|
|
|
int name_len;
|
|
|
|
const u8 *name;
|
2020-02-07 07:31:56 +08:00
|
|
|
};
|
2020-02-08 22:50:57 +08:00
|
|
|
|
2011-03-15 10:08:48 +08:00
|
|
|
#endif /* _SMB2PDU_H */
|