2011-03-15 10:08:48 +08:00
|
|
|
/*
|
|
|
|
* fs/cifs/smb2pdu.h
|
|
|
|
*
|
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
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published
|
|
|
|
* by the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
* the GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SMB2PDU_H
|
|
|
|
#define _SMB2PDU_H
|
|
|
|
|
|
|
|
#include <net/sock.h>
|
|
|
|
|
2011-12-27 02:53:34 +08:00
|
|
|
/*
|
|
|
|
* Note that, due to trying to use names similar to the protocol specifications,
|
|
|
|
* there are many mixed case field names in the structures below. Although
|
|
|
|
* this does not match typical Linux kernel style, it is necessary to be
|
|
|
|
* be able to match against the protocol specfication.
|
|
|
|
*
|
|
|
|
* SMB2 commands
|
|
|
|
* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
|
|
|
|
* (ie no useful data other than the SMB error code itself) and are marked such.
|
|
|
|
* Knowing this helps avoid response buffer allocations and copy in some cases.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* List of commands in host endian */
|
|
|
|
#define SMB2_NEGOTIATE_HE 0x0000
|
|
|
|
#define SMB2_SESSION_SETUP_HE 0x0001
|
|
|
|
#define SMB2_LOGOFF_HE 0x0002 /* trivial request/resp */
|
|
|
|
#define SMB2_TREE_CONNECT_HE 0x0003
|
|
|
|
#define SMB2_TREE_DISCONNECT_HE 0x0004 /* trivial req/resp */
|
|
|
|
#define SMB2_CREATE_HE 0x0005
|
|
|
|
#define SMB2_CLOSE_HE 0x0006
|
|
|
|
#define SMB2_FLUSH_HE 0x0007 /* trivial resp */
|
|
|
|
#define SMB2_READ_HE 0x0008
|
|
|
|
#define SMB2_WRITE_HE 0x0009
|
|
|
|
#define SMB2_LOCK_HE 0x000A
|
|
|
|
#define SMB2_IOCTL_HE 0x000B
|
|
|
|
#define SMB2_CANCEL_HE 0x000C
|
|
|
|
#define SMB2_ECHO_HE 0x000D
|
|
|
|
#define SMB2_QUERY_DIRECTORY_HE 0x000E
|
|
|
|
#define SMB2_CHANGE_NOTIFY_HE 0x000F
|
|
|
|
#define SMB2_QUERY_INFO_HE 0x0010
|
|
|
|
#define SMB2_SET_INFO_HE 0x0011
|
|
|
|
#define SMB2_OPLOCK_BREAK_HE 0x0012
|
|
|
|
|
|
|
|
/* The same list in little endian */
|
|
|
|
#define SMB2_NEGOTIATE cpu_to_le16(SMB2_NEGOTIATE_HE)
|
|
|
|
#define SMB2_SESSION_SETUP cpu_to_le16(SMB2_SESSION_SETUP_HE)
|
|
|
|
#define SMB2_LOGOFF cpu_to_le16(SMB2_LOGOFF_HE)
|
|
|
|
#define SMB2_TREE_CONNECT cpu_to_le16(SMB2_TREE_CONNECT_HE)
|
|
|
|
#define SMB2_TREE_DISCONNECT cpu_to_le16(SMB2_TREE_DISCONNECT_HE)
|
|
|
|
#define SMB2_CREATE cpu_to_le16(SMB2_CREATE_HE)
|
|
|
|
#define SMB2_CLOSE cpu_to_le16(SMB2_CLOSE_HE)
|
|
|
|
#define SMB2_FLUSH cpu_to_le16(SMB2_FLUSH_HE)
|
|
|
|
#define SMB2_READ cpu_to_le16(SMB2_READ_HE)
|
|
|
|
#define SMB2_WRITE cpu_to_le16(SMB2_WRITE_HE)
|
|
|
|
#define SMB2_LOCK cpu_to_le16(SMB2_LOCK_HE)
|
|
|
|
#define SMB2_IOCTL cpu_to_le16(SMB2_IOCTL_HE)
|
|
|
|
#define SMB2_CANCEL cpu_to_le16(SMB2_CANCEL_HE)
|
|
|
|
#define SMB2_ECHO cpu_to_le16(SMB2_ECHO_HE)
|
|
|
|
#define SMB2_QUERY_DIRECTORY cpu_to_le16(SMB2_QUERY_DIRECTORY_HE)
|
|
|
|
#define SMB2_CHANGE_NOTIFY cpu_to_le16(SMB2_CHANGE_NOTIFY_HE)
|
|
|
|
#define SMB2_QUERY_INFO cpu_to_le16(SMB2_QUERY_INFO_HE)
|
|
|
|
#define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE)
|
|
|
|
#define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE)
|
|
|
|
|
2016-11-30 03:31:23 +08:00
|
|
|
#define SMB2_INTERNAL_CMD cpu_to_le16(0xFFFF)
|
|
|
|
|
2011-12-27 02:53:34 +08:00
|
|
|
#define NUMBER_OF_SMB2_COMMANDS 0x0013
|
|
|
|
|
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
|
|
|
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
|
2015-12-19 03:05:30 +08:00
|
|
|
#define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
|
2011-06-08 19:51:07 +08:00
|
|
|
|
2011-03-15 10:08:48 +08:00
|
|
|
/*
|
|
|
|
* SMB2 Header Definition
|
|
|
|
*
|
|
|
|
* "MBZ" : Must be Zero
|
|
|
|
* "BB" : BugBug, Something to check/review/analyze later
|
|
|
|
* "PDU" : "Protocol Data Unit" (ie a network "frame")
|
|
|
|
*
|
|
|
|
*/
|
2012-07-27 05:20:41 +08:00
|
|
|
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_HEADER_STRUCTURE_SIZE cpu_to_le16(64)
|
2012-07-27 05:20:41 +08:00
|
|
|
|
2016-10-25 06:33:04 +08:00
|
|
|
struct smb2_sync_hdr {
|
2015-12-19 03:05:30 +08:00
|
|
|
__le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */
|
2011-03-15 10:08:48 +08:00
|
|
|
__le16 StructureSize; /* 64 */
|
|
|
|
__le16 CreditCharge; /* MBZ */
|
|
|
|
__le32 Status; /* Error from server */
|
|
|
|
__le16 Command;
|
|
|
|
__le16 CreditRequest; /* CreditResponse */
|
|
|
|
__le32 Flags;
|
|
|
|
__le32 NextCommand;
|
2014-12-10 01:37:00 +08:00
|
|
|
__le64 MessageId;
|
2011-03-15 10:08:48 +08:00
|
|
|
__le32 ProcessId;
|
|
|
|
__u32 TreeId; /* opaque - so do not make little endian */
|
|
|
|
__u64 SessionId; /* opaque - so do not make little endian */
|
|
|
|
__u8 Signature[16];
|
|
|
|
} __packed;
|
|
|
|
|
2016-10-25 07:59:57 +08:00
|
|
|
struct smb2_sync_pdu {
|
|
|
|
struct smb2_sync_hdr sync_hdr;
|
|
|
|
__le16 StructureSize2; /* size of wct area (varies, request specific) */
|
|
|
|
} __packed;
|
|
|
|
|
2016-11-04 07:47:37 +08:00
|
|
|
#define SMB3_AES128CMM_NONCE 11
|
|
|
|
#define SMB3_AES128GCM_NONCE 12
|
|
|
|
|
2013-11-16 13:50:24 +08:00
|
|
|
struct smb2_transform_hdr {
|
2016-11-04 07:47:37 +08:00
|
|
|
__le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */
|
2013-11-16 13:50:24 +08:00
|
|
|
__u8 Signature[16];
|
2015-12-19 03:05:30 +08:00
|
|
|
__u8 Nonce[16];
|
2013-11-16 13:50:24 +08:00
|
|
|
__le32 OriginalMessageSize;
|
|
|
|
__u16 Reserved1;
|
2015-12-19 03:05:30 +08:00
|
|
|
__le16 Flags; /* EncryptionAlgorithm */
|
2013-11-16 13:50:24 +08:00
|
|
|
__u64 SessionId;
|
|
|
|
} __packed;
|
|
|
|
|
2011-06-08 19:51:07 +08:00
|
|
|
/*
|
|
|
|
* SMB2 flag definitions
|
|
|
|
*/
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_FLAGS_SERVER_TO_REDIR cpu_to_le32(0x00000001)
|
|
|
|
#define SMB2_FLAGS_ASYNC_COMMAND cpu_to_le32(0x00000002)
|
|
|
|
#define SMB2_FLAGS_RELATED_OPERATIONS cpu_to_le32(0x00000004)
|
|
|
|
#define SMB2_FLAGS_SIGNED cpu_to_le32(0x00000008)
|
|
|
|
#define SMB2_FLAGS_DFS_OPERATIONS cpu_to_le32(0x10000000)
|
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
|
|
|
|
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_ERROR_STRUCTURE_SIZE2 cpu_to_le16(9)
|
2012-07-27 05:20:41 +08:00
|
|
|
|
2011-06-08 19:51:07 +08:00
|
|
|
struct smb2_err_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-06-08 19:51:07 +08:00
|
|
|
__le16 StructureSize;
|
|
|
|
__le16 Reserved; /* MBZ */
|
|
|
|
__le32 ByteCount; /* even if zero, at least one byte follows */
|
|
|
|
__u8 ErrorData[1]; /* variable length */
|
|
|
|
} __packed;
|
|
|
|
|
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;
|
|
|
|
__u8 PathBuffer[0];
|
|
|
|
} __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;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
__le16 Flags;
|
|
|
|
__le16 TargetType;
|
|
|
|
__le32 IPAddrCount;
|
|
|
|
struct move_dst_ipaddr IpAddrMoveList[0];
|
|
|
|
/* __u8 ResourceName[] */ /* Name of share as counted Unicode string */
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 21:22:44 +08:00
|
|
|
#define SMB2_CLIENT_GUID_SIZE 16
|
|
|
|
|
2011-12-27 20:12:43 +08:00
|
|
|
struct smb2_negotiate_req {
|
2017-11-20 08:24:30 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:12:43 +08:00
|
|
|
__le16 StructureSize; /* Must be 36 */
|
|
|
|
__le16 DialectCount;
|
|
|
|
__le16 SecurityMode;
|
|
|
|
__le16 Reserved; /* MBZ */
|
|
|
|
__le32 Capabilities;
|
2012-09-19 21:22:44 +08:00
|
|
|
__u8 ClientGUID[SMB2_CLIENT_GUID_SIZE];
|
2014-12-18 12:52:58 +08:00
|
|
|
/* In SMB3.02 and earlier next three were MBZ le64 ClientStartTime */
|
|
|
|
__le32 NegotiateContextOffset; /* SMB3.1.1 only. MBZ earlier */
|
|
|
|
__le16 NegotiateContextCount; /* SMB3.1.1 only. MBZ earlier */
|
|
|
|
__le16 Reserved2;
|
2012-10-02 01:26:22 +08:00
|
|
|
__le16 Dialects[1]; /* One dialect (vers=) at a time for now */
|
2011-12-27 20:12:43 +08:00
|
|
|
} __packed;
|
|
|
|
|
2012-10-02 01:26:22 +08:00
|
|
|
/* Dialects */
|
|
|
|
#define SMB20_PROT_ID 0x0202
|
|
|
|
#define SMB21_PROT_ID 0x0210
|
|
|
|
#define SMB30_PROT_ID 0x0300
|
2013-06-13 11:48:41 +08:00
|
|
|
#define SMB302_PROT_ID 0x0302
|
2014-12-18 12:52:58 +08:00
|
|
|
#define SMB311_PROT_ID 0x0311
|
2012-10-02 01:26:22 +08:00
|
|
|
#define BAD_PROT_ID 0xFFFF
|
|
|
|
|
2011-12-27 20:12:43 +08:00
|
|
|
/* SecurityMode flags */
|
|
|
|
#define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001
|
|
|
|
#define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
|
2018-04-02 09:15:55 +08:00
|
|
|
#define SMB2_SEC_MODE_FLAGS_ALL 0x0003
|
|
|
|
|
2011-12-27 20:12:43 +08:00
|
|
|
/* Capabilities flags */
|
|
|
|
#define SMB2_GLOBAL_CAP_DFS 0x00000001
|
|
|
|
#define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
|
|
|
|
#define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
|
2012-10-02 01:26:22 +08:00
|
|
|
#define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */
|
|
|
|
#define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */
|
|
|
|
#define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
|
|
|
|
#define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */
|
2012-07-13 17:58:14 +08:00
|
|
|
/* Internal types */
|
|
|
|
#define SMB2_NT_FIND 0x00100000
|
|
|
|
#define SMB2_LARGE_FILES 0x00200000
|
2011-12-27 20:12:43 +08:00
|
|
|
|
2018-04-09 05:14:31 +08:00
|
|
|
struct smb2_neg_context {
|
|
|
|
__le16 ContextType;
|
|
|
|
__le16 DataLength;
|
|
|
|
__le32 Reserved;
|
|
|
|
/* Followed by array of data */
|
|
|
|
} __packed;
|
|
|
|
|
2015-02-06 14:03:52 +08:00
|
|
|
#define SMB311_SALT_SIZE 32
|
|
|
|
/* Hash Algorithm Types */
|
2015-06-18 17:49:47 +08:00
|
|
|
#define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001)
|
2018-02-17 02:19:29 +08:00
|
|
|
#define SMB2_PREAUTH_HASH_SIZE 64
|
2015-02-06 14:03:52 +08:00
|
|
|
|
2018-04-09 23:47:14 +08:00
|
|
|
#define MIN_PREAUTH_CTXT_DATA_LEN (SMB311_SALT_SIZE + 6)
|
2015-02-06 14:03:52 +08:00
|
|
|
struct smb2_preauth_neg_context {
|
|
|
|
__le16 ContextType; /* 1 */
|
|
|
|
__le16 DataLength;
|
|
|
|
__le32 Reserved;
|
|
|
|
__le16 HashAlgorithmCount; /* 1 */
|
|
|
|
__le16 SaltLength;
|
|
|
|
__le16 HashAlgorithms; /* HashAlgorithms[0] since only one defined */
|
|
|
|
__u8 Salt[SMB311_SALT_SIZE];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Encryption Algorithms Ciphers */
|
|
|
|
#define SMB2_ENCRYPTION_AES128_CCM cpu_to_le16(0x0001)
|
|
|
|
#define SMB2_ENCRYPTION_AES128_GCM cpu_to_le16(0x0002)
|
|
|
|
|
2018-04-09 23:47:14 +08:00
|
|
|
/* Min encrypt context data is one cipher so 2 bytes + 2 byte count field */
|
|
|
|
#define MIN_ENCRYPT_CTXT_DATA_LEN 4
|
2015-02-06 14:03:52 +08:00
|
|
|
struct smb2_encryption_neg_context {
|
|
|
|
__le16 ContextType; /* 2 */
|
|
|
|
__le16 DataLength;
|
|
|
|
__le32 Reserved;
|
2015-06-18 17:49:47 +08:00
|
|
|
__le16 CipherCount; /* AES-128-GCM and AES-128-CCM */
|
2018-04-23 04:14:58 +08:00
|
|
|
__le16 Ciphers[1]; /* Ciphers[0] since only one used now */
|
2015-02-06 14:03:52 +08:00
|
|
|
} __packed;
|
|
|
|
|
2019-02-25 07:56:33 +08:00
|
|
|
#define POSIX_CTXT_DATA_LEN 16
|
2018-05-20 09:45:27 +08:00
|
|
|
struct smb2_posix_neg_context {
|
|
|
|
__le16 ContextType; /* 0x100 */
|
|
|
|
__le16 DataLength;
|
|
|
|
__le32 Reserved;
|
2019-02-25 07:56:33 +08:00
|
|
|
__u8 Name[16]; /* POSIX ctxt GUID 93AD25509CB411E7B42383DE968BCD7C */
|
2018-05-20 09:45:27 +08:00
|
|
|
} __packed;
|
|
|
|
|
2011-12-27 20:12:43 +08:00
|
|
|
struct smb2_negotiate_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:12:43 +08:00
|
|
|
__le16 StructureSize; /* Must be 65 */
|
|
|
|
__le16 SecurityMode;
|
|
|
|
__le16 DialectRevision;
|
2014-12-18 12:52:58 +08:00
|
|
|
__le16 NegotiateContextCount; /* Prior to SMB3.1.1 was Reserved & MBZ */
|
2011-12-27 20:12:43 +08:00
|
|
|
__u8 ServerGUID[16];
|
|
|
|
__le32 Capabilities;
|
|
|
|
__le32 MaxTransactSize;
|
|
|
|
__le32 MaxReadSize;
|
|
|
|
__le32 MaxWriteSize;
|
|
|
|
__le64 SystemTime; /* MBZ */
|
|
|
|
__le64 ServerStartTime;
|
|
|
|
__le16 SecurityBufferOffset;
|
|
|
|
__le16 SecurityBufferLength;
|
2014-12-18 12:52:58 +08:00
|
|
|
__le32 NegotiateContextOffset; /* Pre:SMB3.1.1 was reserved/ignored */
|
2011-12-27 20:12:43 +08:00
|
|
|
__u8 Buffer[1]; /* variable length GSS security buffer */
|
|
|
|
} __packed;
|
|
|
|
|
2015-02-06 14:03:52 +08:00
|
|
|
/* Flags */
|
|
|
|
#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
|
|
|
|
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
|
|
|
|
|
2011-12-27 20:22:00 +08:00
|
|
|
struct smb2_sess_setup_req {
|
2017-11-20 08:24:36 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:22:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 25 */
|
2015-02-06 14:03:52 +08:00
|
|
|
__u8 Flags;
|
2011-12-27 20:22:00 +08:00
|
|
|
__u8 SecurityMode;
|
|
|
|
__le32 Capabilities;
|
|
|
|
__le32 Channel;
|
|
|
|
__le16 SecurityBufferOffset;
|
|
|
|
__le16 SecurityBufferLength;
|
2016-09-21 11:56:13 +08:00
|
|
|
__u64 PreviousSessionId;
|
2011-12-27 20:22:00 +08:00
|
|
|
__u8 Buffer[1]; /* variable length GSS security buffer */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Currently defined SessionFlags */
|
|
|
|
#define SMB2_SESSION_FLAG_IS_GUEST 0x0001
|
|
|
|
#define SMB2_SESSION_FLAG_IS_NULL 0x0002
|
2013-11-16 13:50:24 +08:00
|
|
|
#define SMB2_SESSION_FLAG_ENCRYPT_DATA 0x0004
|
2011-12-27 20:22:00 +08:00
|
|
|
struct smb2_sess_setup_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:22:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 9 */
|
|
|
|
__le16 SessionFlags;
|
|
|
|
__le16 SecurityBufferOffset;
|
|
|
|
__le16 SecurityBufferLength;
|
|
|
|
__u8 Buffer[1]; /* variable length GSS security buffer */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_logoff_req {
|
2017-11-09 09:14:17 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:22:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_logoff_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:22:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2015-02-06 14:03:52 +08:00
|
|
|
/* Flags/Reserved for SMB3.1.1 */
|
2018-02-06 04:46:18 +08:00
|
|
|
#define SMB2_TREE_CONNECT_FLAG_CLUSTER_RECONNECT cpu_to_le16(0x0001)
|
|
|
|
#define SMB2_TREE_CONNECT_FLAG_REDIRECT_TO_OWNER cpu_to_le16(0x0002)
|
|
|
|
#define SMB2_TREE_CONNECT_FLAG_EXTENSION_PRESENT cpu_to_le16(0x0004)
|
2015-02-06 14:03:52 +08:00
|
|
|
|
2011-12-27 20:04:00 +08:00
|
|
|
struct smb2_tree_connect_req {
|
2017-11-09 09:14:23 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:04:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 9 */
|
2015-02-06 14:03:52 +08:00
|
|
|
__le16 Reserved; /* Flags in SMB3.1.1 */
|
2011-12-27 20:04:00 +08:00
|
|
|
__le16 PathOffset;
|
|
|
|
__le16 PathLength;
|
|
|
|
__u8 Buffer[1]; /* variable length */
|
|
|
|
} __packed;
|
|
|
|
|
2018-02-06 04:46:18 +08:00
|
|
|
/* See MS-SMB2 section 2.2.9.2 */
|
|
|
|
/* Context Types */
|
|
|
|
#define SMB2_RESERVED_TREE_CONNECT_CONTEXT_ID 0x0000
|
|
|
|
#define SMB2_REMOTED_IDENTITY_TREE_CONNECT_CONTEXT_ID cpu_to_le16(0x0001)
|
|
|
|
|
|
|
|
struct tree_connect_contexts {
|
|
|
|
__le16 ContextType;
|
|
|
|
__le16 DataLength;
|
|
|
|
__le32 Reserved;
|
|
|
|
__u8 Data[0];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Remoted identity tree connect context structures - see MS-SMB2 2.2.9.2.1 */
|
|
|
|
struct smb3_blob_data {
|
|
|
|
__le16 BlobSize;
|
|
|
|
__u8 BlobData[0];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Valid values for Attr */
|
|
|
|
#define SE_GROUP_MANDATORY 0x00000001
|
|
|
|
#define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
|
|
|
|
#define SE_GROUP_ENABLED 0x00000004
|
|
|
|
#define SE_GROUP_OWNER 0x00000008
|
|
|
|
#define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
|
|
|
|
#define SE_GROUP_INTEGRITY 0x00000020
|
|
|
|
#define SE_GROUP_INTEGRITY_ENABLED 0x00000040
|
|
|
|
#define SE_GROUP_RESOURCE 0x20000000
|
|
|
|
#define SE_GROUP_LOGON_ID 0xC0000000
|
|
|
|
|
|
|
|
/* struct sid_attr_data is SidData array in BlobData format then le32 Attr */
|
|
|
|
|
|
|
|
struct sid_array_data {
|
|
|
|
__le16 SidAttrCount;
|
|
|
|
/* SidAttrList - array of sid_attr_data structs */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct luid_attr_data {
|
|
|
|
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct privilege_data is the same as BLOB_DATA - see MS-SMB2 2.2.9.2.1.5
|
|
|
|
* but with size of LUID_ATTR_DATA struct and BlobData set to LUID_ATTR DATA
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct privilege_array_data {
|
|
|
|
__le16 PrivilegeCount;
|
|
|
|
/* array of privilege_data structs */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct remoted_identity_tcon_context {
|
|
|
|
__le16 TicketType; /* must be 0x0001 */
|
|
|
|
__le16 TicketSize; /* total size of this struct */
|
|
|
|
__le16 User; /* offset to SID_ATTR_DATA struct with user info */
|
|
|
|
__le16 UserName; /* offset to null terminated Unicode username string */
|
|
|
|
__le16 Domain; /* offset to null terminated Unicode domain name */
|
|
|
|
__le16 Groups; /* offset to SID_ARRAY_DATA struct with group info */
|
|
|
|
__le16 RestrictedGroups; /* similar to above */
|
|
|
|
__le16 Privileges; /* offset to PRIVILEGE_ARRAY_DATA struct */
|
|
|
|
__le16 PrimaryGroup; /* offset to SID_ARRAY_DATA struct */
|
|
|
|
__le16 Owner; /* offset to BLOB_DATA struct */
|
|
|
|
__le16 DefaultDacl; /* offset to BLOB_DATA struct */
|
|
|
|
__le16 DeviceGroups; /* offset to SID_ARRAY_DATA struct */
|
|
|
|
__le16 UserClaims; /* offset to BLOB_DATA struct */
|
|
|
|
__le16 DeviceClaims; /* offset to BLOB_DATA struct */
|
|
|
|
__u8 TicketInfo[0]; /* variable length buf - remoted identity data */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_tree_connect_req_extension {
|
|
|
|
__le32 TreeConnectContextOffset;
|
|
|
|
__le16 TreeConnectContextCount;
|
|
|
|
__u8 Reserved[10];
|
|
|
|
__u8 PathName[0]; /* variable sized array */
|
|
|
|
/* followed by array of TreeConnectContexts */
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-27 20:04:00 +08:00
|
|
|
struct smb2_tree_connect_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:04:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 16 */
|
|
|
|
__u8 ShareType; /* see below */
|
|
|
|
__u8 Reserved;
|
|
|
|
__le32 ShareFlags; /* see below */
|
|
|
|
__le32 Capabilities; /* see below */
|
|
|
|
__le32 MaximalAccess;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Possible ShareType values */
|
|
|
|
#define SMB2_SHARE_TYPE_DISK 0x01
|
|
|
|
#define SMB2_SHARE_TYPE_PIPE 0x02
|
|
|
|
#define SMB2_SHARE_TYPE_PRINT 0x03
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Possible ShareFlags - exactly one and only one of the first 4 caching flags
|
|
|
|
* must be set (any of the remaining, SHI1005, flags may be set individually
|
|
|
|
* or in combination.
|
|
|
|
*/
|
|
|
|
#define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000
|
|
|
|
#define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010
|
|
|
|
#define SMB2_SHAREFLAG_VDO_CACHING 0x00000020
|
|
|
|
#define SMB2_SHAREFLAG_NO_CACHING 0x00000030
|
|
|
|
#define SHI1005_FLAGS_DFS 0x00000001
|
|
|
|
#define SHI1005_FLAGS_DFS_ROOT 0x00000002
|
|
|
|
#define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100
|
|
|
|
#define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200
|
|
|
|
#define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400
|
|
|
|
#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800
|
|
|
|
#define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000
|
2013-06-22 04:35:45 +08:00
|
|
|
#define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000
|
|
|
|
#define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000
|
|
|
|
#define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000
|
2018-02-06 04:46:18 +08:00
|
|
|
#define SMB2_SHAREFLAG_IDENTITY_REMOTING 0x00040000 /* 3.1.1 */
|
|
|
|
#define SHI1005_FLAGS_ALL 0x0004FF33
|
2011-12-27 20:04:00 +08:00
|
|
|
|
|
|
|
/* Possible share capabilities */
|
2013-06-13 23:51:10 +08:00
|
|
|
#define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */
|
|
|
|
#define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */
|
|
|
|
#define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */
|
|
|
|
#define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */
|
|
|
|
#define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */
|
2018-02-06 04:46:18 +08:00
|
|
|
#define SMB2_SHARE_CAP_REDIRECT_TO_OWNER cpu_to_le32(0x00000100) /* 3.1.1 */
|
2011-12-27 20:04:00 +08:00
|
|
|
|
|
|
|
struct smb2_tree_disconnect_req {
|
2017-11-09 09:14:18 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:04:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_tree_disconnect_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 20:04:00 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-27 02:58:46 +08:00
|
|
|
/* File Attrubutes */
|
|
|
|
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
|
|
|
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
|
|
|
|
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
|
|
|
|
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
|
|
|
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
|
|
|
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
|
|
|
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
|
|
|
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
|
|
|
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
|
|
|
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
|
|
|
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
|
|
|
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
|
|
|
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
2014-09-24 08:25:42 +08:00
|
|
|
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
|
|
|
|
#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
|
2011-12-27 02:58:46 +08:00
|
|
|
|
|
|
|
/* Oplock levels */
|
|
|
|
#define SMB2_OPLOCK_LEVEL_NONE 0x00
|
|
|
|
#define SMB2_OPLOCK_LEVEL_II 0x01
|
|
|
|
#define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
|
|
|
|
#define SMB2_OPLOCK_LEVEL_BATCH 0x09
|
|
|
|
#define SMB2_OPLOCK_LEVEL_LEASE 0xFF
|
2012-09-19 21:22:44 +08:00
|
|
|
/* Non-spec internal type */
|
|
|
|
#define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99
|
2011-12-27 02:58:46 +08:00
|
|
|
|
|
|
|
/* Desired Access Flags */
|
|
|
|
#define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
|
|
|
|
#define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002)
|
|
|
|
#define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004)
|
|
|
|
#define FILE_READ_EA_LE cpu_to_le32(0x00000008)
|
|
|
|
#define FILE_WRITE_EA_LE cpu_to_le32(0x00000010)
|
|
|
|
#define FILE_EXECUTE_LE cpu_to_le32(0x00000020)
|
|
|
|
#define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080)
|
|
|
|
#define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100)
|
|
|
|
#define FILE_DELETE_LE cpu_to_le32(0x00010000)
|
|
|
|
#define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000)
|
|
|
|
#define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000)
|
|
|
|
#define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000)
|
|
|
|
#define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000)
|
|
|
|
#define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000)
|
|
|
|
#define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000)
|
|
|
|
#define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000)
|
|
|
|
#define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000)
|
|
|
|
#define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000)
|
|
|
|
#define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000)
|
|
|
|
|
|
|
|
/* ShareAccess Flags */
|
|
|
|
#define FILE_SHARE_READ_LE cpu_to_le32(0x00000001)
|
|
|
|
#define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002)
|
|
|
|
#define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004)
|
|
|
|
#define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007)
|
|
|
|
|
|
|
|
/* CreateDisposition Flags */
|
|
|
|
#define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000)
|
|
|
|
#define FILE_OPEN_LE cpu_to_le32(0x00000001)
|
|
|
|
#define FILE_CREATE_LE cpu_to_le32(0x00000002)
|
|
|
|
#define FILE_OPEN_IF_LE cpu_to_le32(0x00000003)
|
|
|
|
#define FILE_OVERWRITE_LE cpu_to_le32(0x00000004)
|
|
|
|
#define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
|
|
|
|
|
|
|
|
/* CreateOptions Flags */
|
|
|
|
#define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
|
|
|
|
/* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */
|
|
|
|
#define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002)
|
|
|
|
#define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004)
|
|
|
|
#define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008)
|
|
|
|
#define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010)
|
|
|
|
#define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020)
|
|
|
|
#define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040)
|
|
|
|
#define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100)
|
|
|
|
#define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200)
|
|
|
|
#define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800)
|
|
|
|
#define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000)
|
|
|
|
#define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000)
|
|
|
|
#define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000)
|
|
|
|
#define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000)
|
|
|
|
#define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000)
|
|
|
|
#define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000)
|
|
|
|
#define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000)
|
|
|
|
#define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000)
|
|
|
|
|
|
|
|
#define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \
|
|
|
|
| FILE_READ_ATTRIBUTES_LE)
|
|
|
|
#define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \
|
|
|
|
| FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE)
|
|
|
|
#define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE)
|
|
|
|
|
|
|
|
/* Impersonation Levels */
|
|
|
|
#define IL_ANONYMOUS cpu_to_le32(0x00000000)
|
|
|
|
#define IL_IDENTIFICATION cpu_to_le32(0x00000001)
|
|
|
|
#define IL_IMPERSONATION cpu_to_le32(0x00000002)
|
|
|
|
#define IL_DELEGATE cpu_to_le32(0x00000003)
|
|
|
|
|
|
|
|
/* Create Context Values */
|
|
|
|
#define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */
|
|
|
|
#define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */
|
|
|
|
#define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ"
|
|
|
|
#define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC"
|
2014-05-14 20:29:40 +08:00
|
|
|
#define SMB2_CREATE_ALLOCATION_SIZE "AISi"
|
2011-12-27 02:58:46 +08:00
|
|
|
#define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc"
|
|
|
|
#define SMB2_CREATE_TIMEWARP_REQUEST "TWrp"
|
|
|
|
#define SMB2_CREATE_QUERY_ON_DISK_ID "QFid"
|
|
|
|
#define SMB2_CREATE_REQUEST_LEASE "RqLs"
|
2014-05-14 20:29:40 +08:00
|
|
|
#define SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 "DH2Q"
|
|
|
|
#define SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 "DH2C"
|
|
|
|
#define SMB2_CREATE_APP_INSTANCE_ID 0x45BCA66AEFA7F74A9008FA462E144D74
|
2018-05-31 06:10:25 +08:00
|
|
|
#define SVHDX_OPEN_DEVICE_CONTEX 0x9CCBCF9E04C1E643980E158DA1F6EC83
|
|
|
|
#define SMB2_CREATE_TAG_POSIX 0x93AD25509CB411E7B42383DE968BCD7C
|
|
|
|
|
2018-09-19 15:02:58 +08:00
|
|
|
/* Flag (SMB3 open response) values */
|
|
|
|
#define SMB2_CREATE_FLAG_REPARSEPOINT 0x01
|
2011-12-27 02:58:46 +08:00
|
|
|
|
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
|
|
|
|
* [6] : compound padding
|
|
|
|
*/
|
|
|
|
#define SMB2_CREATE_IOV_SIZE 7
|
|
|
|
|
2011-12-27 02:58:46 +08:00
|
|
|
struct smb2_create_req {
|
2017-11-20 08:24:38 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 02:58:46 +08:00
|
|
|
__le16 StructureSize; /* Must be 57 */
|
|
|
|
__u8 SecurityFlags;
|
|
|
|
__u8 RequestedOplockLevel;
|
|
|
|
__le32 ImpersonationLevel;
|
|
|
|
__le64 SmbCreateFlags;
|
|
|
|
__le64 Reserved;
|
|
|
|
__le32 DesiredAccess;
|
|
|
|
__le32 FileAttributes;
|
|
|
|
__le32 ShareAccess;
|
|
|
|
__le32 CreateDisposition;
|
|
|
|
__le32 CreateOptions;
|
|
|
|
__le16 NameOffset;
|
|
|
|
__le16 NameLength;
|
|
|
|
__le32 CreateContextsOffset;
|
|
|
|
__le32 CreateContextsLength;
|
2013-07-04 23:41:24 +08:00
|
|
|
__u8 Buffer[0];
|
2011-12-27 02:58:46 +08:00
|
|
|
} __packed;
|
|
|
|
|
2019-01-29 10:46:17 +08:00
|
|
|
/*
|
|
|
|
* Maximum size of a SMB2_CREATE response is 64 (smb2 header) +
|
|
|
|
* 88 (fixed part of create response) + 520 (path) + 150 (contexts) +
|
|
|
|
* 2 bytes of padding.
|
|
|
|
*/
|
|
|
|
#define MAX_SMB2_CREATE_RESPONSE_SIZE 824
|
|
|
|
|
2011-12-27 02:58:46 +08:00
|
|
|
struct smb2_create_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 02:58:46 +08:00
|
|
|
__le16 StructureSize; /* Must be 89 */
|
|
|
|
__u8 OplockLevel;
|
2018-09-19 15:02:58 +08:00
|
|
|
__u8 Flag; /* 0x01 if reparse point */
|
2011-12-27 02:58:46 +08:00
|
|
|
__le32 CreateAction;
|
|
|
|
__le64 CreationTime;
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le64 AllocationSize;
|
|
|
|
__le64 EndofFile;
|
|
|
|
__le32 FileAttributes;
|
|
|
|
__le32 Reserved2;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le32 CreateContextsOffset;
|
|
|
|
__le32 CreateContextsLength;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 21:22:44 +08:00
|
|
|
struct create_context {
|
|
|
|
__le32 Next;
|
|
|
|
__le16 NameOffset;
|
|
|
|
__le16 NameLength;
|
|
|
|
__le16 Reserved;
|
|
|
|
__le16 DataOffset;
|
|
|
|
__le32 DataLength;
|
|
|
|
__u8 Buffer[0];
|
|
|
|
} __packed;
|
|
|
|
|
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
|
|
|
|
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_LEASE_NONE cpu_to_le32(0x00)
|
|
|
|
#define SMB2_LEASE_READ_CACHING cpu_to_le32(0x01)
|
|
|
|
#define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02)
|
|
|
|
#define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04)
|
2012-09-19 21:22:44 +08:00
|
|
|
|
2014-12-11 07:41:15 +08:00
|
|
|
#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x02)
|
2018-02-06 04:46:18 +08:00
|
|
|
#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004)
|
2012-09-19 21:22:44 +08:00
|
|
|
|
|
|
|
#define SMB2_LEASE_KEY_SIZE 16
|
|
|
|
|
|
|
|
struct lease_context {
|
2018-07-05 21:10:02 +08:00
|
|
|
u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
|
2012-09-19 21:22:44 +08:00
|
|
|
__le32 LeaseState;
|
|
|
|
__le32 LeaseFlags;
|
|
|
|
__le64 LeaseDuration;
|
|
|
|
} __packed;
|
|
|
|
|
2013-09-04 17:44:05 +08:00
|
|
|
struct lease_context_v2 {
|
2018-07-05 21:10:02 +08:00
|
|
|
u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
|
2013-09-04 17:44:05 +08:00
|
|
|
__le32 LeaseState;
|
|
|
|
__le32 LeaseFlags;
|
|
|
|
__le64 LeaseDuration;
|
|
|
|
__le64 ParentLeaseKeyLow;
|
|
|
|
__le64 ParentLeaseKeyHigh;
|
|
|
|
__le16 Epoch;
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 21:22:44 +08:00
|
|
|
struct create_lease {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
struct lease_context lcontext;
|
|
|
|
} __packed;
|
|
|
|
|
2013-09-04 17:44:05 +08:00
|
|
|
struct create_lease_v2 {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[8];
|
|
|
|
struct lease_context_v2 lcontext;
|
|
|
|
__u8 Pad[4];
|
|
|
|
} __packed;
|
|
|
|
|
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;
|
|
|
|
|
2018-05-31 06:10:25 +08:00
|
|
|
struct create_posix {
|
|
|
|
struct create_context ccontext;
|
|
|
|
__u8 Name[16];
|
|
|
|
__le32 Mode;
|
|
|
|
__u32 Reserved;
|
|
|
|
} __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;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
} __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;
|
|
|
|
|
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 */
|
|
|
|
char Context[0]; /* ignored, Windows sets to 4 bytes of zero */
|
|
|
|
} __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;
|
|
|
|
|
2014-08-17 21:38:47 +08:00
|
|
|
/* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */
|
|
|
|
struct file_zero_data_information {
|
|
|
|
__le64 FileOffset;
|
|
|
|
__le64 BeyondFinalZero;
|
|
|
|
} __packed;
|
|
|
|
|
2013-11-14 14:05:36 +08:00
|
|
|
struct copychunk_ioctl_rsp {
|
|
|
|
__le32 ChunksWritten;
|
|
|
|
__le32 ChunkBytesWritten;
|
|
|
|
__le32 TotalBytesWritten;
|
|
|
|
} __packed;
|
|
|
|
|
2015-06-24 15:12:19 +08:00
|
|
|
struct fsctl_set_integrity_information_req {
|
|
|
|
__le16 ChecksumAlgorithm;
|
|
|
|
__le16 Reserved;
|
|
|
|
__le32 Flags;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct fsctl_get_integrity_information_rsp {
|
|
|
|
__le16 ChecksumAlgorithm;
|
|
|
|
__le16 Reserved;
|
|
|
|
__le32 Flags;
|
|
|
|
__le32 ChecksumChunkSizeInBytes;
|
|
|
|
__le32 ClusterSizeInBytes;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* Integrity ChecksumAlgorithm choices for above */
|
|
|
|
#define CHECKSUM_TYPE_NONE 0x0000
|
|
|
|
#define CHECKSUM_TYPE_CRC64 0x0002
|
2015-06-24 16:17:02 +08:00
|
|
|
#define CHECKSUM_TYPE_UNCHANGED 0xFFFF /* set only */
|
2015-06-24 15:12:19 +08:00
|
|
|
|
|
|
|
/* Integrity flags for above */
|
|
|
|
#define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF 0x00000001
|
|
|
|
|
2018-11-01 00:24:33 +08:00
|
|
|
/* Reparse structures - see MS-FSCC 2.1.2 */
|
|
|
|
|
|
|
|
/* struct fsctl_reparse_info_req is empty, only response structs (see below) */
|
|
|
|
|
|
|
|
struct reparse_data_buffer {
|
|
|
|
__le32 ReparseTag;
|
|
|
|
__le16 ReparseDataLength;
|
|
|
|
__u16 Reserved;
|
|
|
|
__u8 DataBuffer[0]; /* Variable Length */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct reparse_guid_data_buffer {
|
|
|
|
__le32 ReparseTag;
|
|
|
|
__le16 ReparseDataLength;
|
|
|
|
__u16 Reserved;
|
|
|
|
__u8 ReparseGuid[16];
|
|
|
|
__u8 DataBuffer[0]; /* Variable Length */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct reparse_mount_point_data_buffer {
|
|
|
|
__le32 ReparseTag;
|
|
|
|
__le16 ReparseDataLength;
|
|
|
|
__u16 Reserved;
|
|
|
|
__le16 SubstituteNameOffset;
|
|
|
|
__le16 SubstituteNameLength;
|
|
|
|
__le16 PrintNameOffset;
|
|
|
|
__le16 PrintNameLength;
|
|
|
|
__u8 PathBuffer[0]; /* Variable Length */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
/* See MS-FSCC 2.1.2.4 and cifspdu.h for struct reparse_symlink_data */
|
|
|
|
|
|
|
|
/* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */
|
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
2015-06-24 15:12:19 +08:00
|
|
|
|
2013-11-20 13:44:46 +08:00
|
|
|
struct validate_negotiate_info_req {
|
2013-06-25 13:20:49 +08:00
|
|
|
__le32 Capabilities;
|
|
|
|
__u8 Guid[SMB2_CLIENT_GUID_SIZE];
|
|
|
|
__le16 SecurityMode;
|
|
|
|
__le16 DialectCount;
|
2019-01-03 16:37:21 +08:00
|
|
|
__le16 Dialects[4]; /* BB expand this if autonegotiate > 4 dialects */
|
2013-11-20 13:44:46 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct validate_negotiate_info_rsp {
|
|
|
|
__le32 Capabilities;
|
|
|
|
__u8 Guid[SMB2_CLIENT_GUID_SIZE];
|
|
|
|
__le16 SecurityMode;
|
|
|
|
__le16 Dialect; /* Dialect in use for the connection */
|
2013-06-25 13:20:49 +08:00
|
|
|
} __packed;
|
|
|
|
|
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;
|
|
|
|
|
2015-06-28 12:18:36 +08:00
|
|
|
struct duplicate_extents_to_file {
|
|
|
|
__u64 PersistentFileHandle; /* source file handle, opaque endianness */
|
|
|
|
__u64 VolatileFileHandle;
|
|
|
|
__le64 SourceFileOffset;
|
|
|
|
__le64 TargetFileOffset;
|
|
|
|
__le64 ByteCount; /* Bytes to be copied */
|
|
|
|
} __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
|
|
|
|
|
2013-06-20 06:41:10 +08:00
|
|
|
struct smb2_ioctl_req {
|
2017-11-09 09:14:20 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2013-06-20 06:41:10 +08:00
|
|
|
__le16 StructureSize; /* Must be 57 */
|
|
|
|
__u16 Reserved;
|
|
|
|
__le32 CtlCode;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le32 InputOffset;
|
|
|
|
__le32 InputCount;
|
|
|
|
__le32 MaxInputResponse;
|
|
|
|
__le32 OutputOffset;
|
|
|
|
__le32 OutputCount;
|
|
|
|
__le32 MaxOutputResponse;
|
|
|
|
__le32 Flags;
|
|
|
|
__u32 Reserved2;
|
2013-10-15 04:31:32 +08:00
|
|
|
__u8 Buffer[0];
|
2013-06-20 06:41:10 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_ioctl_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2013-06-20 06:41:10 +08:00
|
|
|
__le16 StructureSize; /* Must be 57 */
|
|
|
|
__u16 Reserved;
|
|
|
|
__le32 CtlCode;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le32 InputOffset;
|
|
|
|
__le32 InputCount;
|
|
|
|
__le32 OutputOffset;
|
|
|
|
__le32 OutputCount;
|
|
|
|
__le32 Flags;
|
|
|
|
__u32 Reserved2;
|
|
|
|
/* char * buffer[] */
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-27 02:58:46 +08:00
|
|
|
/* Currently defined values for close flags */
|
|
|
|
#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
|
|
|
|
struct smb2_close_req {
|
2017-11-09 09:14:19 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 02:58:46 +08:00
|
|
|
__le16 StructureSize; /* Must be 24 */
|
|
|
|
__le16 Flags;
|
|
|
|
__le32 Reserved;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
} __packed;
|
|
|
|
|
2019-01-29 10:46:17 +08:00
|
|
|
/*
|
|
|
|
* Maximum size of a SMB2_CLOSE response is 64 (smb2 header) + 60 (data)
|
|
|
|
*/
|
|
|
|
#define MAX_SMB2_CLOSE_RESPONSE_SIZE 124
|
|
|
|
|
2011-12-27 02:58:46 +08:00
|
|
|
struct smb2_close_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-27 02:58:46 +08:00
|
|
|
__le16 StructureSize; /* 60 */
|
|
|
|
__le16 Flags;
|
|
|
|
__le32 Reserved;
|
|
|
|
__le64 CreationTime;
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
|
|
|
|
__le64 EndOfFile;
|
|
|
|
__le32 Attributes;
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 07:20:28 +08:00
|
|
|
struct smb2_flush_req {
|
2017-11-20 08:24:39 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:28 +08:00
|
|
|
__le16 StructureSize; /* Must be 24 */
|
|
|
|
__le16 Reserved1;
|
|
|
|
__le32 Reserved2;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_flush_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:28 +08:00
|
|
|
__le16 StructureSize;
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2013-06-13 23:51:10 +08:00
|
|
|
/* For read request Flags field below, following flag is defined for SMB3.02 */
|
|
|
|
#define SMB2_READFLAG_READ_UNBUFFERED 0x01
|
|
|
|
|
|
|
|
/* Channel field for read and write: exactly one of following flags can be set*/
|
2018-01-25 13:07:41 +08:00
|
|
|
#define SMB2_CHANNEL_NONE cpu_to_le32(0x00000000)
|
|
|
|
#define SMB2_CHANNEL_RDMA_V1 cpu_to_le32(0x00000001) /* SMB3 or later */
|
|
|
|
#define SMB2_CHANNEL_RDMA_V1_INVALIDATE cpu_to_le32(0x00000002) /* >= SMB3.02 */
|
2013-06-13 23:51:10 +08:00
|
|
|
|
2016-11-24 07:31:54 +08:00
|
|
|
/* SMB2 read request without RFC1001 length at the beginning */
|
|
|
|
struct smb2_read_plain_req {
|
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:29 +08:00
|
|
|
__le16 StructureSize; /* Must be 49 */
|
|
|
|
__u8 Padding; /* offset from start of SMB2 header to place read */
|
2013-06-13 23:51:10 +08:00
|
|
|
__u8 Flags; /* MBZ unless SMB3.02 or later */
|
2012-09-19 07:20:29 +08:00
|
|
|
__le32 Length;
|
|
|
|
__le64 Offset;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le32 MinimumCount;
|
2013-06-13 23:51:10 +08:00
|
|
|
__le32 Channel; /* MBZ except for SMB3 or later */
|
2012-09-19 07:20:29 +08:00
|
|
|
__le32 RemainingBytes;
|
2018-01-25 13:07:41 +08:00
|
|
|
__le16 ReadChannelInfoOffset;
|
|
|
|
__le16 ReadChannelInfoLength;
|
2012-09-19 07:20:29 +08:00
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_read_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:29 +08:00
|
|
|
__le16 StructureSize; /* Must be 17 */
|
|
|
|
__u8 DataOffset;
|
2012-09-19 07:20:29 +08:00
|
|
|
__u8 Reserved;
|
|
|
|
__le32 DataLength;
|
|
|
|
__le32 DataRemaining;
|
|
|
|
__u32 Reserved2;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
2013-06-13 23:51:10 +08:00
|
|
|
/* For write request Flags field below the following flags are defined: */
|
|
|
|
#define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */
|
|
|
|
#define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */
|
2012-09-19 07:20:29 +08:00
|
|
|
|
|
|
|
struct smb2_write_req {
|
2017-11-20 08:24:41 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:29 +08:00
|
|
|
__le16 StructureSize; /* Must be 49 */
|
|
|
|
__le16 DataOffset; /* offset from start of SMB2 header to write data */
|
|
|
|
__le32 Length;
|
|
|
|
__le64 Offset;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le32 Channel; /* Reserved MBZ */
|
|
|
|
__le32 RemainingBytes;
|
2018-01-25 13:07:41 +08:00
|
|
|
__le16 WriteChannelInfoOffset;
|
|
|
|
__le16 WriteChannelInfoLength;
|
2012-09-19 07:20:29 +08:00
|
|
|
__le32 Flags;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_write_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:29 +08:00
|
|
|
__le16 StructureSize; /* Must be 17 */
|
|
|
|
__u8 DataOffset;
|
2012-09-19 07:20:29 +08:00
|
|
|
__u8 Reserved;
|
|
|
|
__le32 DataLength;
|
|
|
|
__le32 DataRemaining;
|
|
|
|
__u32 Reserved2;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 21:22:43 +08:00
|
|
|
#define SMB2_LOCKFLAG_SHARED_LOCK 0x0001
|
|
|
|
#define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002
|
|
|
|
#define SMB2_LOCKFLAG_UNLOCK 0x0004
|
|
|
|
#define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010
|
|
|
|
|
2012-09-19 21:22:43 +08:00
|
|
|
struct smb2_lock_element {
|
|
|
|
__le64 Offset;
|
|
|
|
__le64 Length;
|
|
|
|
__le32 Flags;
|
|
|
|
__le32 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_lock_req {
|
2017-11-21 07:07:27 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 21:22:43 +08:00
|
|
|
__le16 StructureSize; /* Must be 48 */
|
|
|
|
__le16 LockCount;
|
|
|
|
__le32 Reserved;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
/* Followed by at least one */
|
|
|
|
struct smb2_lock_element locks[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_lock_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 21:22:43 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__le16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2012-07-12 22:30:44 +08:00
|
|
|
struct smb2_echo_req {
|
2017-11-09 09:14:21 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-07-12 22:30:44 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__u16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_echo_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-07-12 22:30:44 +08:00
|
|
|
__le16 StructureSize; /* Must be 4 */
|
|
|
|
__u16 Reserved;
|
|
|
|
} __packed;
|
|
|
|
|
2012-09-19 07:20:33 +08:00
|
|
|
/* search (query_directory) Flags field */
|
|
|
|
#define SMB2_RESTART_SCANS 0x01
|
|
|
|
#define SMB2_RETURN_SINGLE_ENTRY 0x02
|
|
|
|
#define SMB2_INDEX_SPECIFIED 0x04
|
|
|
|
#define SMB2_REOPEN 0x10
|
|
|
|
|
|
|
|
struct smb2_query_directory_req {
|
2017-11-20 08:24:45 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:33 +08:00
|
|
|
__le16 StructureSize; /* Must be 33 */
|
|
|
|
__u8 FileInformationClass;
|
|
|
|
__u8 Flags;
|
|
|
|
__le32 FileIndex;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__le16 FileNameOffset;
|
|
|
|
__le16 FileNameLength;
|
|
|
|
__le32 OutputBufferLength;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_query_directory_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:33 +08:00
|
|
|
__le16 StructureSize; /* Must be 9 */
|
|
|
|
__le16 OutputBufferOffset;
|
|
|
|
__le32 OutputBufferLength;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
/* Possible InfoType values */
|
|
|
|
#define SMB2_O_INFO_FILE 0x01
|
|
|
|
#define SMB2_O_INFO_FILESYSTEM 0x02
|
|
|
|
#define SMB2_O_INFO_SECURITY 0x03
|
|
|
|
#define SMB2_O_INFO_QUOTA 0x04
|
|
|
|
|
2014-10-20 08:18:05 +08:00
|
|
|
/* Security info type additionalinfo flags. See MS-SMB2 (2.2.37) or MS-DTYP */
|
|
|
|
#define OWNER_SECINFO 0x00000001
|
|
|
|
#define GROUP_SECINFO 0x00000002
|
|
|
|
#define DACL_SECINFO 0x00000004
|
|
|
|
#define SACL_SECINFO 0x00000008
|
|
|
|
#define LABEL_SECINFO 0x00000010
|
|
|
|
#define ATTRIBUTE_SECINFO 0x00000020
|
|
|
|
#define SCOPE_SECINFO 0x00000040
|
|
|
|
#define BACKUP_SECINFO 0x00010000
|
|
|
|
#define UNPROTECTED_SACL_SECINFO 0x10000000
|
|
|
|
#define UNPROTECTED_DACL_SECINFO 0x20000000
|
|
|
|
#define PROTECTED_SACL_SECINFO 0x40000000
|
|
|
|
#define PROTECTED_DACL_SECINFO 0x80000000
|
|
|
|
|
|
|
|
/* Flags used for FileFullEAinfo */
|
|
|
|
#define SL_RESTART_SCAN 0x00000001
|
|
|
|
#define SL_RETURN_SINGLE_ENTRY 0x00000002
|
|
|
|
#define SL_INDEX_SPECIFIED 0x00000004
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
struct smb2_query_info_req {
|
2017-11-20 08:24:46 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-29 21:06:33 +08:00
|
|
|
__le16 StructureSize; /* Must be 41 */
|
|
|
|
__u8 InfoType;
|
|
|
|
__u8 FileInfoClass;
|
|
|
|
__le32 OutputBufferLength;
|
|
|
|
__le16 InputBufferOffset;
|
|
|
|
__u16 Reserved;
|
|
|
|
__le32 InputBufferLength;
|
|
|
|
__le32 AdditionalInformation;
|
|
|
|
__le32 Flags;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_query_info_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2011-12-29 21:06:33 +08:00
|
|
|
__le16 StructureSize; /* Must be 9 */
|
|
|
|
__le16 OutputBufferOffset;
|
|
|
|
__le32 OutputBufferLength;
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
2018-09-03 11:33:50 +08:00
|
|
|
/*
|
|
|
|
* Maximum number of iovs we need for a set-info request.
|
|
|
|
* The largest one is rename/hardlink
|
|
|
|
* [0] : struct smb2_set_info_req + smb2_file_[rename|link]_info
|
|
|
|
* [1] : path
|
|
|
|
* [2] : compound padding
|
|
|
|
*/
|
|
|
|
#define SMB2_SET_INFO_IOV_SIZE 3
|
|
|
|
|
2012-09-19 07:20:31 +08:00
|
|
|
struct smb2_set_info_req {
|
2017-11-20 08:24:44 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:31 +08:00
|
|
|
__le16 StructureSize; /* Must be 33 */
|
|
|
|
__u8 InfoType;
|
|
|
|
__u8 FileInfoClass;
|
|
|
|
__le32 BufferLength;
|
|
|
|
__le16 BufferOffset;
|
|
|
|
__u16 Reserved;
|
|
|
|
__le32 AdditionalInformation;
|
|
|
|
__u64 PersistentFileId; /* opaque endianness */
|
|
|
|
__u64 VolatileFileId; /* opaque endianness */
|
|
|
|
__u8 Buffer[1];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_set_info_rsp {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 07:20:31 +08:00
|
|
|
__le16 StructureSize; /* Must be 2 */
|
|
|
|
} __packed;
|
|
|
|
|
2018-06-01 08:53:03 +08:00
|
|
|
struct smb2_oplock_break {
|
2017-11-20 08:24:43 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
|
|
|
__le16 StructureSize; /* Must be 24 */
|
|
|
|
__u8 OplockLevel;
|
|
|
|
__u8 Reserved;
|
|
|
|
__le32 Reserved2;
|
|
|
|
__u64 PersistentFid;
|
|
|
|
__u64 VolatileFid;
|
|
|
|
} __packed;
|
2012-09-19 07:20:33 +08:00
|
|
|
|
2012-09-19 21:22:45 +08:00
|
|
|
#define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01)
|
|
|
|
|
|
|
|
struct smb2_lease_break {
|
2018-06-01 08:53:06 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 21:22:45 +08:00
|
|
|
__le16 StructureSize; /* Must be 44 */
|
|
|
|
__le16 Reserved;
|
|
|
|
__le32 Flags;
|
|
|
|
__u8 LeaseKey[16];
|
|
|
|
__le32 CurrentLeaseState;
|
|
|
|
__le32 NewLeaseState;
|
|
|
|
__le32 BreakReason;
|
|
|
|
__le32 AccessMaskHint;
|
|
|
|
__le32 ShareMaskHint;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct smb2_lease_ack {
|
2017-11-21 08:04:37 +08:00
|
|
|
struct smb2_sync_hdr sync_hdr;
|
2012-09-19 21:22:45 +08:00
|
|
|
__le16 StructureSize; /* Must be 36 */
|
|
|
|
__le16 Reserved;
|
|
|
|
__le32 Flags;
|
|
|
|
__u8 LeaseKey[16];
|
|
|
|
__le32 LeaseState;
|
|
|
|
__le64 LeaseDuration;
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
/*
|
|
|
|
* PDU infolevel structure definitions
|
|
|
|
* BB consider moving to a different header
|
|
|
|
*/
|
|
|
|
|
2012-09-19 07:20:34 +08:00
|
|
|
/* File System Information Classes */
|
|
|
|
#define FS_VOLUME_INFORMATION 1 /* Query */
|
2013-10-10 09:55:53 +08:00
|
|
|
#define FS_LABEL_INFORMATION 2 /* Local only */
|
2012-09-19 07:20:34 +08:00
|
|
|
#define FS_SIZE_INFORMATION 3 /* Query */
|
|
|
|
#define FS_DEVICE_INFORMATION 4 /* Query */
|
|
|
|
#define FS_ATTRIBUTE_INFORMATION 5 /* Query */
|
|
|
|
#define FS_CONTROL_INFORMATION 6 /* Query, Set */
|
|
|
|
#define FS_FULL_SIZE_INFORMATION 7 /* Query */
|
|
|
|
#define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */
|
2013-10-10 09:55:53 +08:00
|
|
|
#define FS_DRIVER_PATH_INFORMATION 9 /* Local only */
|
|
|
|
#define FS_VOLUME_FLAGS_INFORMATION 10 /* Local only */
|
|
|
|
#define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */
|
2018-06-25 12:28:12 +08:00
|
|
|
#define FS_POSIX_INFORMATION 100 /* SMB3.1.1 POSIX. Query */
|
2012-09-19 07:20:34 +08:00
|
|
|
|
|
|
|
struct smb2_fs_full_size_info {
|
|
|
|
__le64 TotalAllocationUnits;
|
|
|
|
__le64 CallerAvailableAllocationUnits;
|
|
|
|
__le64 ActualAvailableAllocationUnits;
|
|
|
|
__le32 SectorsPerAllocationUnit;
|
|
|
|
__le32 BytesPerSector;
|
|
|
|
} __packed;
|
|
|
|
|
2013-10-10 09:55:53 +08:00
|
|
|
#define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001
|
|
|
|
#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
|
|
|
|
#define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004
|
|
|
|
#define SSINFO_FLAGS_TRIM_ENABLED 0x00000008
|
|
|
|
|
|
|
|
/* sector size info struct */
|
|
|
|
struct smb3_fs_ss_info {
|
|
|
|
__le32 LogicalBytesPerSector;
|
|
|
|
__le32 PhysicalBytesPerSectorForAtomicity;
|
|
|
|
__le32 PhysicalBytesPerSectorForPerf;
|
|
|
|
__le32 FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
|
|
|
|
__le32 Flags;
|
|
|
|
__le32 ByteOffsetForSectorAlignment;
|
|
|
|
__le32 ByteOffsetForPartitionAlignment;
|
|
|
|
} __packed;
|
|
|
|
|
2018-06-25 12:18:52 +08:00
|
|
|
/* volume info struct - see MS-FSCC 2.5.9 */
|
|
|
|
#define MAX_VOL_LABEL_LEN 32
|
|
|
|
struct smb3_fs_vol_info {
|
|
|
|
__le64 VolumeCreationTime;
|
|
|
|
__u32 VolumeSerialNumber;
|
|
|
|
__le32 VolumeLabelLength; /* includes trailing null */
|
|
|
|
__u8 SupportsObjects; /* True if eg like NTFS, supports objects */
|
|
|
|
__u8 Reserved;
|
|
|
|
__u8 VolumeLabel[0]; /* variable len */
|
|
|
|
} __packed;
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
/* partial list of QUERY INFO levels */
|
|
|
|
#define FILE_DIRECTORY_INFORMATION 1
|
|
|
|
#define FILE_FULL_DIRECTORY_INFORMATION 2
|
|
|
|
#define FILE_BOTH_DIRECTORY_INFORMATION 3
|
|
|
|
#define FILE_BASIC_INFORMATION 4
|
|
|
|
#define FILE_STANDARD_INFORMATION 5
|
|
|
|
#define FILE_INTERNAL_INFORMATION 6
|
|
|
|
#define FILE_EA_INFORMATION 7
|
|
|
|
#define FILE_ACCESS_INFORMATION 8
|
|
|
|
#define FILE_NAME_INFORMATION 9
|
|
|
|
#define FILE_RENAME_INFORMATION 10
|
|
|
|
#define FILE_LINK_INFORMATION 11
|
|
|
|
#define FILE_NAMES_INFORMATION 12
|
|
|
|
#define FILE_DISPOSITION_INFORMATION 13
|
|
|
|
#define FILE_POSITION_INFORMATION 14
|
|
|
|
#define FILE_FULL_EA_INFORMATION 15
|
|
|
|
#define FILE_MODE_INFORMATION 16
|
|
|
|
#define FILE_ALIGNMENT_INFORMATION 17
|
|
|
|
#define FILE_ALL_INFORMATION 18
|
|
|
|
#define FILE_ALLOCATION_INFORMATION 19
|
|
|
|
#define FILE_END_OF_FILE_INFORMATION 20
|
|
|
|
#define FILE_ALTERNATE_NAME_INFORMATION 21
|
|
|
|
#define FILE_STREAM_INFORMATION 22
|
|
|
|
#define FILE_PIPE_INFORMATION 23
|
|
|
|
#define FILE_PIPE_LOCAL_INFORMATION 24
|
|
|
|
#define FILE_PIPE_REMOTE_INFORMATION 25
|
|
|
|
#define FILE_MAILSLOT_QUERY_INFORMATION 26
|
|
|
|
#define FILE_MAILSLOT_SET_INFORMATION 27
|
|
|
|
#define FILE_COMPRESSION_INFORMATION 28
|
|
|
|
#define FILE_OBJECT_ID_INFORMATION 29
|
|
|
|
/* Number 30 not defined in documents */
|
|
|
|
#define FILE_MOVE_CLUSTER_INFORMATION 31
|
|
|
|
#define FILE_QUOTA_INFORMATION 32
|
|
|
|
#define FILE_REPARSE_POINT_INFORMATION 33
|
|
|
|
#define FILE_NETWORK_OPEN_INFORMATION 34
|
|
|
|
#define FILE_ATTRIBUTE_TAG_INFORMATION 35
|
|
|
|
#define FILE_TRACKING_INFORMATION 36
|
|
|
|
#define FILEID_BOTH_DIRECTORY_INFORMATION 37
|
|
|
|
#define FILEID_FULL_DIRECTORY_INFORMATION 38
|
|
|
|
#define FILE_VALID_DATA_LENGTH_INFORMATION 39
|
|
|
|
#define FILE_SHORT_NAME_INFORMATION 40
|
|
|
|
#define FILE_SFIO_RESERVE_INFORMATION 44
|
|
|
|
#define FILE_SFIO_VOLUME_INFORMATION 45
|
|
|
|
#define FILE_HARD_LINK_INFORMATION 46
|
|
|
|
#define FILE_NORMALIZED_NAME_INFORMATION 48
|
|
|
|
#define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
|
|
|
|
#define FILE_STANDARD_LINK_INFORMATION 54
|
|
|
|
|
2012-09-19 07:20:26 +08:00
|
|
|
struct smb2_file_internal_info {
|
|
|
|
__le64 IndexNumber;
|
|
|
|
} __packed; /* level 6 Query */
|
|
|
|
|
2012-09-19 07:20:31 +08:00
|
|
|
struct smb2_file_rename_info { /* encoding of request for level 10 */
|
|
|
|
__u8 ReplaceIfExists; /* 1 = replace existing target with new */
|
|
|
|
/* 0 = fail if target already exists */
|
|
|
|
__u8 Reserved[7];
|
|
|
|
__u64 RootDirectory; /* MBZ for network operations (why says spec?) */
|
|
|
|
__le32 FileNameLength;
|
|
|
|
char FileName[0]; /* New name to be assigned */
|
|
|
|
} __packed; /* level 10 Set */
|
|
|
|
|
2012-09-19 07:20:31 +08:00
|
|
|
struct smb2_file_link_info { /* encoding of request for level 11 */
|
|
|
|
__u8 ReplaceIfExists; /* 1 = replace existing link with new */
|
|
|
|
/* 0 = fail if link already exists */
|
|
|
|
__u8 Reserved[7];
|
|
|
|
__u64 RootDirectory; /* MBZ for network operations (why says spec?) */
|
|
|
|
__le32 FileNameLength;
|
|
|
|
char FileName[0]; /* Name to be assigned to new link */
|
|
|
|
} __packed; /* level 11 Set */
|
|
|
|
|
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;
|
|
|
|
char ea_data[0]; /* \0 terminated name plus value */
|
|
|
|
} __packed; /* level 15 Set */
|
|
|
|
|
2011-12-29 21:06:33 +08:00
|
|
|
/*
|
|
|
|
* This level 18, although with struct with same name is different from cifs
|
|
|
|
* level 0x107. Level 0x107 has an extra u64 between AccessFlags and
|
|
|
|
* CurrentByteOffset.
|
|
|
|
*/
|
|
|
|
struct smb2_file_all_info { /* data block encoding of response to level 18 */
|
|
|
|
__le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
|
|
|
|
__le64 LastAccessTime;
|
|
|
|
__le64 LastWriteTime;
|
|
|
|
__le64 ChangeTime;
|
|
|
|
__le32 Attributes;
|
|
|
|
__u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
|
|
|
|
__le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
|
|
|
|
__le64 EndOfFile; /* size ie offset to first free byte in file */
|
|
|
|
__le32 NumberOfLinks; /* hard links */
|
|
|
|
__u8 DeletePending;
|
|
|
|
__u8 Directory;
|
|
|
|
__u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
|
|
|
|
__le64 IndexNumber;
|
|
|
|
__le32 EASize;
|
|
|
|
__le32 AccessFlags;
|
|
|
|
__le64 CurrentByteOffset;
|
|
|
|
__le32 Mode;
|
|
|
|
__le32 AlignmentRequirement;
|
|
|
|
__le32 FileNameLength;
|
|
|
|
char FileName[1];
|
|
|
|
} __packed; /* level 18 Query */
|
|
|
|
|
2012-09-19 07:20:32 +08:00
|
|
|
struct smb2_file_eof_info { /* encoding of request for level 10 */
|
|
|
|
__le64 EndOfFile; /* new end of file value */
|
|
|
|
} __packed; /* level 20 Set */
|
|
|
|
|
2018-08-08 13:07:49 +08:00
|
|
|
extern char smb2_padding[7];
|
|
|
|
|
2011-03-15 10:08:48 +08:00
|
|
|
#endif /* _SMB2PDU_H */
|