@@ -1149,12 +1149,6 @@ struct smb2_server_client_notification {
11491149#define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
11501150#define FILE_CREATE_MASK_LE cpu_to_le32(0x00000007)
11511151
1152- #define FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA \
1153- | FILE_READ_ATTRIBUTES)
1154- #define FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
1155- | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
1156- #define FILE_EXEC_RIGHTS (FILE_EXECUTE)
1157-
11581152/* CreateOptions Flags */
11591153#define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
11601154/* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */
@@ -1290,6 +1284,14 @@ struct create_mxac_req {
12901284 __le64 Timestamp ;
12911285} __packed ;
12921286
1287+ /*
1288+ * Flags
1289+ * See MS-SMB2 2.2.13.2.11
1290+ * MS-SMB2 2.2.13.2.12
1291+ * MS-SMB2 2.2.14.2.12
1292+ */
1293+ #define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
1294+
12931295/* See MS-SMB2 2.2.13.2.11 */
12941296struct durable_context_v2_req {
12951297 __le32 Timeout ;
@@ -1500,6 +1502,26 @@ struct smb_sockaddr_in6 {
15001502 __be32 ScopeId ;
15011503} __packed ;
15021504
1505+ /* See MS-SMB2 2.2.32.5 and MS-SMB2 2.2.32.5.1 */
1506+ #define RSS_CAPABLE cpu_to_le32(0x00000001)
1507+ #define RDMA_CAPABLE cpu_to_le32(0x00000002)
1508+ #define INTERNETWORK cpu_to_le16(0x0002)
1509+ #define INTERNETWORKV6 cpu_to_le16(0x0017)
1510+ struct network_interface_info_ioctl_rsp {
1511+ __le32 Next ; /* next interface. zero if this is last one */
1512+ __le32 IfIndex ;
1513+ __le32 Capability ; /* RSS or RDMA Capable */
1514+ __le32 Reserved ;
1515+ __le64 LinkSpeed ;
1516+ union {
1517+ char SockAddr_Storage [128 ];
1518+ struct {
1519+ __le16 Family ;
1520+ __u8 Buffer [126 ];
1521+ };
1522+ };
1523+ } __packed ;
1524+
15031525/* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */
15041526struct file_zero_data_information {
15051527 __le64 FileOffset ;
@@ -1989,6 +2011,144 @@ struct smb2_lease_ack {
19892011 __le64 LeaseDuration ;
19902012} __packed ;
19912013
2014+ /*
2015+ * See MS-CIFS 2.2.3.1
2016+ * MS-SMB 2.2.3.1
2017+ */
2018+ struct smb_hdr {
2019+ __be32 smb_buf_length ; /* BB length is only two (rarely three) bytes,
2020+ with one or two byte "type" preceding it that will be
2021+ zero - we could mask the type byte off */
2022+ __u8 Protocol [4 ];
2023+ __u8 Command ;
2024+ union {
2025+ struct {
2026+ __u8 ErrorClass ;
2027+ __u8 Reserved ;
2028+ __le16 Error ;
2029+ } __packed DosError ;
2030+ __le32 CifsError ;
2031+ } __packed Status ;
2032+ __u8 Flags ;
2033+ __le16 Flags2 ; /* note: le */
2034+ __le16 PidHigh ;
2035+ union {
2036+ struct {
2037+ __le32 SequenceNumber ; /* le */
2038+ __u32 Reserved ; /* zero */
2039+ } __packed Sequence ;
2040+ __u8 SecuritySignature [8 ]; /* le */
2041+ } __packed Signature ;
2042+ __u8 pad [2 ];
2043+ __u16 Tid ;
2044+ __le16 Pid ;
2045+ __u16 Uid ;
2046+ __le16 Mid ;
2047+ __u8 WordCount ;
2048+ } __packed ;
2049+
19922050#define OP_BREAK_STRUCT_SIZE_20 24
19932051#define OP_BREAK_STRUCT_SIZE_21 36
2052+
2053+ /*
2054+ * See MS-SMB2 2.2.13.1.1
2055+ * MS-SMB 2.2.1.4.1
2056+ * These are the file access permission bits defined in CIFS for the
2057+ * NTCreateAndX as well as the level 0x107
2058+ * TRANS2_QUERY_PATH_INFORMATION API. The level 0x107, SMB_QUERY_FILE_ALL_INFO
2059+ * responds with the AccessFlags.
2060+ * The AccessFlags specifies the access permissions a caller has to the
2061+ * file and can have any suitable combination of the following values:
2062+ */
2063+ #define FILE_READ_DATA 0x00000001 /* Data can be read from the file */
2064+ /* or directory child entries can */
2065+ /* be listed together with the */
2066+ /* associated child attributes */
2067+ /* (so the FILE_READ_ATTRIBUTES on */
2068+ /* the child entry is not needed) */
2069+ #define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */
2070+ /* or new file can be created in */
2071+ /* the directory */
2072+ #define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */
2073+ /* (for non-local files over SMB it */
2074+ /* is same as FILE_WRITE_DATA) */
2075+ /* or new subdirectory can be */
2076+ /* created in the directory */
2077+ #define FILE_READ_EA 0x00000008 /* Extended attributes associated */
2078+ /* with the file can be read */
2079+ #define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */
2080+ /* with the file can be written */
2081+ #define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */
2082+ /* the file using system paging I/O */
2083+ /* for executing the file / script */
2084+ /* or right to traverse directory */
2085+ /* (but by default all users have */
2086+ /* directory bypass traverse */
2087+ /* privilege and do not need this */
2088+ /* permission on directories at all)*/
2089+ #define FILE_DELETE_CHILD 0x00000040 /* Child entry can be deleted from */
2090+ /* the directory (so the DELETE on */
2091+ /* the child entry is not needed) */
2092+ #define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */
2093+ /* file or directory can be read */
2094+ #define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */
2095+ /* file or directory can be written */
2096+ #define DELETE 0x00010000 /* The file or dir can be deleted */
2097+ #define READ_CONTROL 0x00020000 /* The discretionary access control */
2098+ /* list and ownership associated */
2099+ /* with the file or dir can be read */
2100+ #define WRITE_DAC 0x00040000 /* The discretionary access control */
2101+ /* list associated with the file or */
2102+ /* directory can be written */
2103+ #define WRITE_OWNER 0x00080000 /* Ownership information associated */
2104+ /* with the file/dir can be written */
2105+ #define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */
2106+ /* synchronize with the completion */
2107+ /* of an input/output request */
2108+ #define SYSTEM_SECURITY 0x01000000 /* The system access control list */
2109+ /* associated with the file or */
2110+ /* directory can be read or written */
2111+ /* (cannot be in DACL, can in SACL) */
2112+ #define MAXIMUM_ALLOWED 0x02000000 /* Maximal subset of GENERIC_ALL */
2113+ /* permissions which can be granted */
2114+ /* (cannot be in DACL nor SACL) */
2115+ #define GENERIC_ALL 0x10000000 /* Same as: GENERIC_EXECUTE | */
2116+ /* GENERIC_WRITE | */
2117+ /* GENERIC_READ | */
2118+ /* FILE_DELETE_CHILD | */
2119+ /* DELETE | */
2120+ /* WRITE_DAC | */
2121+ /* WRITE_OWNER */
2122+ /* So GENERIC_ALL contains all bits */
2123+ /* mentioned above except these two */
2124+ /* SYSTEM_SECURITY MAXIMUM_ALLOWED */
2125+ #define GENERIC_EXECUTE 0x20000000 /* Same as: FILE_EXECUTE | */
2126+ /* FILE_READ_ATTRIBUTES | */
2127+ /* READ_CONTROL | */
2128+ /* SYNCHRONIZE */
2129+ #define GENERIC_WRITE 0x40000000 /* Same as: FILE_WRITE_DATA | */
2130+ /* FILE_APPEND_DATA | */
2131+ /* FILE_WRITE_EA | */
2132+ /* FILE_WRITE_ATTRIBUTES | */
2133+ /* READ_CONTROL | */
2134+ /* SYNCHRONIZE */
2135+ #define GENERIC_READ 0x80000000 /* Same as: FILE_READ_DATA | */
2136+ /* FILE_READ_EA | */
2137+ /* FILE_READ_ATTRIBUTES | */
2138+ /* READ_CONTROL | */
2139+ /* SYNCHRONIZE */
2140+
2141+ /* Combinations of file access permission bits */
2142+ #define FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES)
2143+ #define FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
2144+ | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
2145+ #define FILE_EXEC_RIGHTS (FILE_EXECUTE)
2146+ #define SET_FILE_EXEC_RIGHTS (FILE_READ_EA | FILE_WRITE_EA | FILE_EXECUTE \
2147+ | FILE_READ_ATTRIBUTES \
2148+ | FILE_WRITE_ATTRIBUTES \
2149+ | DELETE | READ_CONTROL | WRITE_DAC \
2150+ | WRITE_OWNER | SYNCHRONIZE)
2151+ #define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \
2152+ | READ_CONTROL | SYNCHRONIZE)
2153+
19942154#endif /* _COMMON_SMB2PDU_H */
0 commit comments