.. | .. |
---|
25 | 25 | #define _SMB2PDU_H |
---|
26 | 26 | |
---|
27 | 27 | #include <net/sock.h> |
---|
| 28 | +#include <cifsacl.h> |
---|
28 | 29 | |
---|
29 | 30 | /* |
---|
30 | 31 | * Note that, due to trying to use names similar to the protocol specifications, |
---|
31 | 32 | * there are many mixed case field names in the structures below. Although |
---|
32 | 33 | * this does not match typical Linux kernel style, it is necessary to be |
---|
33 | | - * be able to match against the protocol specfication. |
---|
| 34 | + * able to match against the protocol specfication. |
---|
34 | 35 | * |
---|
35 | 36 | * SMB2 commands |
---|
36 | 37 | * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses |
---|
.. | .. |
---|
85 | 86 | #define NUMBER_OF_SMB2_COMMANDS 0x0013 |
---|
86 | 87 | |
---|
87 | 88 | /* 52 transform hdr + 64 hdr + 88 create rsp */ |
---|
| 89 | +#define SMB2_TRANSFORM_HEADER_SIZE 52 |
---|
88 | 90 | #define MAX_SMB2_HDR_SIZE 204 |
---|
89 | 91 | |
---|
90 | 92 | #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) |
---|
91 | 93 | #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd) |
---|
| 94 | +#define SMB2_COMPRESSION_TRANSFORM_ID cpu_to_le32(0x424d53fc) |
---|
92 | 95 | |
---|
93 | 96 | /* |
---|
94 | 97 | * SMB2 Header Definition |
---|
.. | .. |
---|
117 | 120 | __u8 Signature[16]; |
---|
118 | 121 | } __packed; |
---|
119 | 122 | |
---|
| 123 | +/* The total header size for SMB2 read and write */ |
---|
| 124 | +#define SMB2_READWRITE_PDU_HEADER_SIZE (48 + sizeof(struct smb2_sync_hdr)) |
---|
| 125 | + |
---|
120 | 126 | struct smb2_sync_pdu { |
---|
121 | 127 | struct smb2_sync_hdr sync_hdr; |
---|
122 | 128 | __le16 StructureSize2; /* size of wct area (varies, request specific) */ |
---|
123 | 129 | } __packed; |
---|
124 | 130 | |
---|
125 | | -#define SMB3_AES128CMM_NONCE 11 |
---|
126 | | -#define SMB3_AES128GCM_NONCE 12 |
---|
| 131 | +#define SMB3_AES_CCM_NONCE 11 |
---|
| 132 | +#define SMB3_AES_GCM_NONCE 12 |
---|
127 | 133 | |
---|
| 134 | +/* Transform flags (for 3.0 dialect this flag indicates CCM */ |
---|
| 135 | +#define TRANSFORM_FLAG_ENCRYPTED 0x0001 |
---|
128 | 136 | struct smb2_transform_hdr { |
---|
129 | 137 | __le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */ |
---|
130 | 138 | __u8 Signature[16]; |
---|
131 | 139 | __u8 Nonce[16]; |
---|
132 | 140 | __le32 OriginalMessageSize; |
---|
133 | 141 | __u16 Reserved1; |
---|
134 | | - __le16 Flags; /* EncryptionAlgorithm */ |
---|
| 142 | + __le16 Flags; /* EncryptionAlgorithm for 3.0, enc enabled for 3.1.1 */ |
---|
135 | 143 | __u64 SessionId; |
---|
| 144 | +} __packed; |
---|
| 145 | + |
---|
| 146 | +/* See MS-SMB2 2.2.42 */ |
---|
| 147 | +struct smb2_compression_transform_hdr { |
---|
| 148 | + __le32 ProtocolId; /* 0xFC 'S' 'M' 'B' */ |
---|
| 149 | + __le32 OriginalCompressedSegmentSize; |
---|
| 150 | + __le16 CompressionAlgorithm; |
---|
| 151 | + __le16 Flags; |
---|
| 152 | + __le16 Length; /* if chained it is length, else offset */ |
---|
| 153 | +} __packed; |
---|
| 154 | + |
---|
| 155 | +/* See MS-SMB2 2.2.42.1 */ |
---|
| 156 | +#define SMB2_COMPRESSION_FLAG_NONE 0x0000 |
---|
| 157 | +#define SMB2_COMPRESSION_FLAG_CHAINED 0x0001 |
---|
| 158 | + |
---|
| 159 | +struct compression_payload_header { |
---|
| 160 | + __le16 CompressionAlgorithm; |
---|
| 161 | + __le16 Flags; |
---|
| 162 | + __le32 Length; /* length of compressed playload including field below if present */ |
---|
| 163 | + /* __le32 OriginalPayloadSize; */ /* optional */ |
---|
| 164 | +} __packed; |
---|
| 165 | + |
---|
| 166 | +/* See MS-SMB2 2.2.42.2 */ |
---|
| 167 | +struct compression_pattern_payload_v1 { |
---|
| 168 | + __le16 Pattern; |
---|
| 169 | + __le16 Reserved1; |
---|
| 170 | + __le16 Reserved2; |
---|
| 171 | + __le32 Repetitions; |
---|
| 172 | +} __packed; |
---|
| 173 | + |
---|
| 174 | +/* See MS-SMB2 2.2.43 */ |
---|
| 175 | +struct smb2_rdma_transform { |
---|
| 176 | + __le16 RdmaDescriptorOffset; |
---|
| 177 | + __le16 RdmaDescriptorLength; |
---|
| 178 | + __le32 Channel; /* for values see channel description in smb2 read above */ |
---|
| 179 | + __le16 TransformCount; |
---|
| 180 | + __le16 Reserved1; |
---|
| 181 | + __le32 Reserved2; |
---|
| 182 | +} __packed; |
---|
| 183 | + |
---|
| 184 | +struct smb2_rdma_encryption_transform { |
---|
| 185 | + __le16 TransformType; |
---|
| 186 | + __le16 SignatureLength; |
---|
| 187 | + __le16 NonceLength; |
---|
| 188 | + __u16 Reserved; |
---|
| 189 | + __u8 Signature[]; /* variable length */ |
---|
| 190 | + /* u8 Nonce[] */ |
---|
| 191 | + /* followed by padding */ |
---|
136 | 192 | } __packed; |
---|
137 | 193 | |
---|
138 | 194 | /* |
---|
.. | .. |
---|
142 | 198 | #define SMB2_FLAGS_ASYNC_COMMAND cpu_to_le32(0x00000002) |
---|
143 | 199 | #define SMB2_FLAGS_RELATED_OPERATIONS cpu_to_le32(0x00000004) |
---|
144 | 200 | #define SMB2_FLAGS_SIGNED cpu_to_le32(0x00000008) |
---|
| 201 | +#define SMB2_FLAGS_PRIORITY_MASK cpu_to_le32(0x00000070) /* SMB3.1.1 */ |
---|
145 | 202 | #define SMB2_FLAGS_DFS_OPERATIONS cpu_to_le32(0x10000000) |
---|
| 203 | +#define SMB2_FLAGS_REPLAY_OPERATION cpu_to_le32(0x20000000) /* SMB3 & up */ |
---|
146 | 204 | |
---|
147 | 205 | /* |
---|
148 | 206 | * Definitions for SMB2 Protocol Data Units (network frames) |
---|
.. | .. |
---|
165 | 223 | __u8 ErrorData[1]; /* variable length */ |
---|
166 | 224 | } __packed; |
---|
167 | 225 | |
---|
| 226 | +#define SYMLINK_ERROR_TAG 0x4c4d5953 |
---|
| 227 | + |
---|
168 | 228 | struct smb2_symlink_err_rsp { |
---|
169 | 229 | __le32 SymLinkLength; |
---|
170 | 230 | __le32 SymLinkErrorTag; |
---|
.. | .. |
---|
176 | 236 | __le16 PrintNameOffset; |
---|
177 | 237 | __le16 PrintNameLength; |
---|
178 | 238 | __le32 Flags; |
---|
179 | | - __u8 PathBuffer[0]; |
---|
| 239 | + __u8 PathBuffer[]; |
---|
180 | 240 | } __packed; |
---|
181 | 241 | |
---|
182 | 242 | /* SMB 3.1.1 and later dialects. See MS-SMB2 section 2.2.2.1 */ |
---|
.. | .. |
---|
185 | 245 | __le32 ErrorId; |
---|
186 | 246 | __u8 ErrorContextData; /* ErrorDataLength long array */ |
---|
187 | 247 | } __packed; |
---|
| 248 | + |
---|
| 249 | +/* ErrorId values */ |
---|
| 250 | +#define SMB2_ERROR_ID_DEFAULT 0x00000000 |
---|
| 251 | +#define SMB2_ERROR_ID_SHARE_REDIRECT cpu_to_le32(0x72645253) /* "rdRS" */ |
---|
188 | 252 | |
---|
189 | 253 | /* Defines for Type field below (see MS-SMB2 2.2.2.2.2.1) */ |
---|
190 | 254 | #define MOVE_DST_IPADDR_V4 cpu_to_le32(0x00000001) |
---|
.. | .. |
---|
204 | 268 | __le16 Flags; |
---|
205 | 269 | __le16 TargetType; |
---|
206 | 270 | __le32 IPAddrCount; |
---|
207 | | - struct move_dst_ipaddr IpAddrMoveList[0]; |
---|
| 271 | + struct move_dst_ipaddr IpAddrMoveList[]; |
---|
208 | 272 | /* __u8 ResourceName[] */ /* Name of share as counted Unicode string */ |
---|
209 | 273 | } __packed; |
---|
210 | 274 | |
---|
.. | .. |
---|
226 | 290 | } __packed; |
---|
227 | 291 | |
---|
228 | 292 | /* Dialects */ |
---|
| 293 | +#define SMB10_PROT_ID 0x0000 /* local only, not sent on wire w/CIFS negprot */ |
---|
229 | 294 | #define SMB20_PROT_ID 0x0202 |
---|
230 | 295 | #define SMB21_PROT_ID 0x0210 |
---|
231 | 296 | #define SMB30_PROT_ID 0x0300 |
---|
.. | .. |
---|
249 | 314 | /* Internal types */ |
---|
250 | 315 | #define SMB2_NT_FIND 0x00100000 |
---|
251 | 316 | #define SMB2_LARGE_FILES 0x00200000 |
---|
| 317 | + |
---|
| 318 | + |
---|
| 319 | +/* Negotiate Contexts - ContextTypes. See MS-SMB2 section 2.2.3.1 for details */ |
---|
| 320 | +#define SMB2_PREAUTH_INTEGRITY_CAPABILITIES cpu_to_le16(1) |
---|
| 321 | +#define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2) |
---|
| 322 | +#define SMB2_COMPRESSION_CAPABILITIES cpu_to_le16(3) |
---|
| 323 | +#define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID cpu_to_le16(5) |
---|
| 324 | +#define SMB2_TRANSPORT_CAPABILITIES cpu_to_le16(6) |
---|
| 325 | +#define SMB2_RDMA_TRANSFORM_CAPABILITIES cpu_to_le16(7) |
---|
| 326 | +#define SMB2_SIGNING_CAPABILITIES cpu_to_le16(8) |
---|
| 327 | +#define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100) |
---|
252 | 328 | |
---|
253 | 329 | struct smb2_neg_context { |
---|
254 | 330 | __le16 ContextType; |
---|
.. | .. |
---|
284 | 360 | /* Encryption Algorithms Ciphers */ |
---|
285 | 361 | #define SMB2_ENCRYPTION_AES128_CCM cpu_to_le16(0x0001) |
---|
286 | 362 | #define SMB2_ENCRYPTION_AES128_GCM cpu_to_le16(0x0002) |
---|
| 363 | +/* we currently do not request AES256_CCM since presumably GCM faster */ |
---|
| 364 | +#define SMB2_ENCRYPTION_AES256_CCM cpu_to_le16(0x0003) |
---|
| 365 | +#define SMB2_ENCRYPTION_AES256_GCM cpu_to_le16(0x0004) |
---|
287 | 366 | |
---|
288 | 367 | /* Min encrypt context data is one cipher so 2 bytes + 2 byte count field */ |
---|
289 | 368 | #define MIN_ENCRYPT_CTXT_DATA_LEN 4 |
---|
.. | .. |
---|
291 | 370 | __le16 ContextType; /* 2 */ |
---|
292 | 371 | __le16 DataLength; |
---|
293 | 372 | __le32 Reserved; |
---|
294 | | - __le16 CipherCount; /* AES-128-GCM and AES-128-CCM */ |
---|
295 | | - __le16 Ciphers[1]; /* Ciphers[0] since only one used now */ |
---|
| 373 | + /* CipherCount usally 2, but can be 3 when AES256-GCM enabled */ |
---|
| 374 | + __le16 CipherCount; /* AES128-GCM and AES128-CCM by default */ |
---|
| 375 | + __le16 Ciphers[3]; |
---|
296 | 376 | } __packed; |
---|
297 | 377 | |
---|
298 | | -#define POSIX_CTXT_DATA_LEN 8 |
---|
| 378 | +/* See MS-SMB2 2.2.3.1.3 */ |
---|
| 379 | +#define SMB3_COMPRESS_NONE cpu_to_le16(0x0000) |
---|
| 380 | +#define SMB3_COMPRESS_LZNT1 cpu_to_le16(0x0001) |
---|
| 381 | +#define SMB3_COMPRESS_LZ77 cpu_to_le16(0x0002) |
---|
| 382 | +#define SMB3_COMPRESS_LZ77_HUFF cpu_to_le16(0x0003) |
---|
| 383 | +/* Pattern scanning algorithm See MS-SMB2 3.1.4.4.1 */ |
---|
| 384 | +#define SMB3_COMPRESS_PATTERN cpu_to_le16(0x0004) /* Pattern_V1 */ |
---|
| 385 | + |
---|
| 386 | +/* Compression Flags */ |
---|
| 387 | +#define SMB2_COMPRESSION_CAPABILITIES_FLAG_NONE cpu_to_le32(0x00000000) |
---|
| 388 | +#define SMB2_COMPRESSION_CAPABILITIES_FLAG_CHAINED cpu_to_le32(0x00000001) |
---|
| 389 | + |
---|
| 390 | +struct smb2_compression_capabilities_context { |
---|
| 391 | + __le16 ContextType; /* 3 */ |
---|
| 392 | + __le16 DataLength; |
---|
| 393 | + __u32 Reserved; |
---|
| 394 | + __le16 CompressionAlgorithmCount; |
---|
| 395 | + __u16 Padding; |
---|
| 396 | + __u32 Flags; |
---|
| 397 | + __le16 CompressionAlgorithms[3]; |
---|
| 398 | +} __packed; |
---|
| 399 | + |
---|
| 400 | +/* |
---|
| 401 | + * For smb2_netname_negotiate_context_id See MS-SMB2 2.2.3.1.4. |
---|
| 402 | + * Its struct simply contains NetName, an array of Unicode characters |
---|
| 403 | + */ |
---|
| 404 | +struct smb2_netname_neg_context { |
---|
| 405 | + __le16 ContextType; /* 5 */ |
---|
| 406 | + __le16 DataLength; |
---|
| 407 | + __le32 Reserved; |
---|
| 408 | + __le16 NetName[]; /* hostname of target converted to UCS-2 */ |
---|
| 409 | +} __packed; |
---|
| 410 | + |
---|
| 411 | +/* |
---|
| 412 | + * For rdma transform capabilities context see MS-SMB2 2.2.3.1.6 |
---|
| 413 | + * and 2.2.4.1.5 |
---|
| 414 | + */ |
---|
| 415 | + |
---|
| 416 | +/* RDMA Transform IDs */ |
---|
| 417 | +#define SMB2_RDMA_TRANSFORM_NONE 0x0000 |
---|
| 418 | +#define SMB2_RDMA_TRANSFORM_ENCRYPTION 0x0001 |
---|
| 419 | + |
---|
| 420 | +struct smb2_rdma_transform_capabilities_context { |
---|
| 421 | + __le16 ContextType; /* 7 */ |
---|
| 422 | + __le16 DataLength; |
---|
| 423 | + __u32 Reserved; |
---|
| 424 | + __le16 TransformCount; |
---|
| 425 | + __u16 Reserved1; |
---|
| 426 | + __u32 Reserved2; |
---|
| 427 | + __le16 RDMATransformIds[1]; |
---|
| 428 | +} __packed; |
---|
| 429 | + |
---|
| 430 | +/* Signing algorithms */ |
---|
| 431 | +#define SIGNING_ALG_HMAC_SHA256 0 |
---|
| 432 | +#define SIGNING_ALG_AES_CMAC 1 |
---|
| 433 | +#define SIGNING_ALG_AES_GMAC 2 |
---|
| 434 | + |
---|
| 435 | +struct smb2_signing_capabilities { |
---|
| 436 | + __le16 ContextType; /* 8 */ |
---|
| 437 | + __le16 DataLength; |
---|
| 438 | + __u32 Reserved; |
---|
| 439 | + __le16 SigningAlgorithmCount; |
---|
| 440 | + __le16 SigningAlgorithms[]; |
---|
| 441 | +} __packed; |
---|
| 442 | + |
---|
| 443 | +#define POSIX_CTXT_DATA_LEN 16 |
---|
299 | 444 | struct smb2_posix_neg_context { |
---|
300 | 445 | __le16 ContextType; /* 0x100 */ |
---|
301 | 446 | __le16 DataLength; |
---|
302 | 447 | __le32 Reserved; |
---|
303 | | - __le64 Reserved1; /* In case needed for future (eg version or caps) */ |
---|
| 448 | + __u8 Name[16]; /* POSIX ctxt GUID 93AD25509CB411E7B42383DE968BCD7C */ |
---|
304 | 449 | } __packed; |
---|
305 | 450 | |
---|
306 | 451 | struct smb2_negotiate_rsp { |
---|
.. | .. |
---|
372 | 517 | struct smb2_tree_connect_req { |
---|
373 | 518 | struct smb2_sync_hdr sync_hdr; |
---|
374 | 519 | __le16 StructureSize; /* Must be 9 */ |
---|
375 | | - __le16 Reserved; /* Flags in SMB3.1.1 */ |
---|
| 520 | + __le16 Flags; /* Reserved MBZ for dialects prior to SMB3.1.1 */ |
---|
376 | 521 | __le16 PathOffset; |
---|
377 | 522 | __le16 PathLength; |
---|
378 | 523 | __u8 Buffer[1]; /* variable length */ |
---|
.. | .. |
---|
387 | 532 | __le16 ContextType; |
---|
388 | 533 | __le16 DataLength; |
---|
389 | 534 | __le32 Reserved; |
---|
390 | | - __u8 Data[0]; |
---|
| 535 | + __u8 Data[]; |
---|
391 | 536 | } __packed; |
---|
392 | 537 | |
---|
393 | 538 | /* Remoted identity tree connect context structures - see MS-SMB2 2.2.9.2.1 */ |
---|
394 | 539 | struct smb3_blob_data { |
---|
395 | 540 | __le16 BlobSize; |
---|
396 | | - __u8 BlobData[0]; |
---|
| 541 | + __u8 BlobData[]; |
---|
397 | 542 | } __packed; |
---|
398 | 543 | |
---|
399 | 544 | /* Valid values for Attr */ |
---|
.. | .. |
---|
443 | 588 | __le16 DeviceGroups; /* offset to SID_ARRAY_DATA struct */ |
---|
444 | 589 | __le16 UserClaims; /* offset to BLOB_DATA struct */ |
---|
445 | 590 | __le16 DeviceClaims; /* offset to BLOB_DATA struct */ |
---|
446 | | - __u8 TicketInfo[0]; /* variable length buf - remoted identity data */ |
---|
| 591 | + __u8 TicketInfo[]; /* variable length buf - remoted identity data */ |
---|
447 | 592 | } __packed; |
---|
448 | 593 | |
---|
449 | 594 | struct smb2_tree_connect_req_extension { |
---|
450 | 595 | __le32 TreeConnectContextOffset; |
---|
451 | 596 | __le16 TreeConnectContextCount; |
---|
452 | 597 | __u8 Reserved[10]; |
---|
453 | | - __u8 PathName[0]; /* variable sized array */ |
---|
| 598 | + __u8 PathName[]; /* variable sized array */ |
---|
454 | 599 | /* followed by array of TreeConnectContexts */ |
---|
455 | 600 | } __packed; |
---|
456 | 601 | |
---|
.. | .. |
---|
599 | 744 | | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE) |
---|
600 | 745 | #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE) |
---|
601 | 746 | |
---|
602 | | -/* Impersonation Levels */ |
---|
| 747 | +/* Impersonation Levels. See MS-WPO section 9.7 and MSDN-IMPERS */ |
---|
603 | 748 | #define IL_ANONYMOUS cpu_to_le32(0x00000000) |
---|
604 | 749 | #define IL_IDENTIFICATION cpu_to_le32(0x00000001) |
---|
605 | 750 | #define IL_IMPERSONATION cpu_to_le32(0x00000002) |
---|
.. | .. |
---|
618 | 763 | #define SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 "DH2Q" |
---|
619 | 764 | #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 "DH2C" |
---|
620 | 765 | #define SMB2_CREATE_APP_INSTANCE_ID 0x45BCA66AEFA7F74A9008FA462E144D74 |
---|
| 766 | +#define SMB2_CREATE_APP_INSTANCE_VERSION 0xB982D0B73B56074FA07B524A8116A010 |
---|
621 | 767 | #define SVHDX_OPEN_DEVICE_CONTEX 0x9CCBCF9E04C1E643980E158DA1F6EC83 |
---|
622 | 768 | #define SMB2_CREATE_TAG_POSIX 0x93AD25509CB411E7B42383DE968BCD7C |
---|
623 | 769 | |
---|
| 770 | +/* Flag (SMB3 open response) values */ |
---|
| 771 | +#define SMB2_CREATE_FLAG_REPARSEPOINT 0x01 |
---|
624 | 772 | |
---|
625 | 773 | /* |
---|
626 | 774 | * Maximum number of iovs we need for an open/create request. |
---|
.. | .. |
---|
630 | 778 | * [3] : durable context |
---|
631 | 779 | * [4] : posix context |
---|
632 | 780 | * [5] : time warp context |
---|
633 | | - * [6] : compound padding |
---|
| 781 | + * [6] : query id context |
---|
| 782 | + * [7] : compound padding |
---|
634 | 783 | */ |
---|
635 | | -#define SMB2_CREATE_IOV_SIZE 7 |
---|
| 784 | +#define SMB2_CREATE_IOV_SIZE 8 |
---|
636 | 785 | |
---|
637 | 786 | struct smb2_create_req { |
---|
638 | 787 | struct smb2_sync_hdr sync_hdr; |
---|
.. | .. |
---|
651 | 800 | __le16 NameLength; |
---|
652 | 801 | __le32 CreateContextsOffset; |
---|
653 | 802 | __le32 CreateContextsLength; |
---|
654 | | - __u8 Buffer[0]; |
---|
| 803 | + __u8 Buffer[]; |
---|
655 | 804 | } __packed; |
---|
| 805 | + |
---|
| 806 | +/* |
---|
| 807 | + * Maximum size of a SMB2_CREATE response is 64 (smb2 header) + |
---|
| 808 | + * 88 (fixed part of create response) + 520 (path) + 208 (contexts) + |
---|
| 809 | + * 2 bytes of padding. |
---|
| 810 | + */ |
---|
| 811 | +#define MAX_SMB2_CREATE_RESPONSE_SIZE 880 |
---|
656 | 812 | |
---|
657 | 813 | struct smb2_create_rsp { |
---|
658 | 814 | struct smb2_sync_hdr sync_hdr; |
---|
659 | 815 | __le16 StructureSize; /* Must be 89 */ |
---|
660 | 816 | __u8 OplockLevel; |
---|
661 | | - __u8 Reserved; |
---|
| 817 | + __u8 Flag; /* 0x01 if reparse point */ |
---|
662 | 818 | __le32 CreateAction; |
---|
663 | 819 | __le64 CreationTime; |
---|
664 | 820 | __le64 LastAccessTime; |
---|
.. | .. |
---|
682 | 838 | __le16 Reserved; |
---|
683 | 839 | __le16 DataOffset; |
---|
684 | 840 | __le32 DataLength; |
---|
685 | | - __u8 Buffer[0]; |
---|
| 841 | + __u8 Buffer[]; |
---|
686 | 842 | } __packed; |
---|
687 | 843 | |
---|
688 | 844 | #define SMB2_LEASE_READ_CACHING_HE 0x01 |
---|
.. | .. |
---|
694 | 850 | #define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02) |
---|
695 | 851 | #define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04) |
---|
696 | 852 | |
---|
697 | | -#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x02) |
---|
| 853 | +#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x00000002) |
---|
698 | 854 | #define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004) |
---|
699 | 855 | |
---|
700 | 856 | #define SMB2_LEASE_KEY_SIZE 16 |
---|
.. | .. |
---|
775 | 931 | __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */ |
---|
776 | 932 | } __packed; |
---|
777 | 933 | |
---|
| 934 | +/* See MS-SMB2 2.2.14.2.9 */ |
---|
| 935 | +struct create_on_disk_id { |
---|
| 936 | + struct create_context ccontext; |
---|
| 937 | + __u8 Name[8]; |
---|
| 938 | + __le64 DiskFileId; |
---|
| 939 | + __le64 VolumeId; |
---|
| 940 | + __u32 Reserved[4]; |
---|
| 941 | +} __packed; |
---|
| 942 | + |
---|
778 | 943 | /* See MS-SMB2 2.2.14.2.12 */ |
---|
779 | 944 | struct durable_reconnect_context_v2_rsp { |
---|
780 | 945 | __le32 Timeout; |
---|
.. | .. |
---|
796 | 961 | |
---|
797 | 962 | } __packed; |
---|
798 | 963 | |
---|
| 964 | +/* See MS-SMB2 2.2.13.2.9 */ |
---|
| 965 | +struct crt_query_id_ctxt { |
---|
| 966 | + struct create_context ccontext; |
---|
| 967 | + __u8 Name[8]; |
---|
| 968 | +} __packed; |
---|
| 969 | + |
---|
| 970 | +struct crt_sd_ctxt { |
---|
| 971 | + struct create_context ccontext; |
---|
| 972 | + __u8 Name[8]; |
---|
| 973 | + struct smb3_sd sd; |
---|
| 974 | +} __packed; |
---|
| 975 | + |
---|
| 976 | + |
---|
799 | 977 | #define COPY_CHUNK_RES_KEY_SIZE 24 |
---|
800 | 978 | struct resume_key_req { |
---|
801 | 979 | char ResumeKey[COPY_CHUNK_RES_KEY_SIZE]; |
---|
802 | 980 | __le32 ContextLength; /* MBZ */ |
---|
803 | | - char Context[0]; /* ignored, Windows sets to 4 bytes of zero */ |
---|
| 981 | + char Context[]; /* ignored, Windows sets to 4 bytes of zero */ |
---|
804 | 982 | } __packed; |
---|
805 | 983 | |
---|
806 | 984 | /* this goes in the ioctl buffer when doing a copychunk request */ |
---|
.. | .. |
---|
827 | 1005 | __le32 TotalBytesWritten; |
---|
828 | 1006 | } __packed; |
---|
829 | 1007 | |
---|
| 1008 | +/* See MS-FSCC 2.3.29 and 2.3.30 */ |
---|
| 1009 | +struct get_retrieval_pointer_count_req { |
---|
| 1010 | + __le64 StartingVcn; /* virtual cluster number (signed) */ |
---|
| 1011 | +} __packed; |
---|
| 1012 | + |
---|
| 1013 | +struct get_retrieval_pointer_count_rsp { |
---|
| 1014 | + __le32 ExtentCount; |
---|
| 1015 | +} __packed; |
---|
| 1016 | + |
---|
| 1017 | +/* |
---|
| 1018 | + * See MS-FSCC 2.3.33 and 2.3.34 |
---|
| 1019 | + * request is the same as get_retrieval_point_count_req struct above |
---|
| 1020 | + */ |
---|
| 1021 | +struct smb3_extents { |
---|
| 1022 | + __le64 NextVcn; |
---|
| 1023 | + __le64 Lcn; /* logical cluster number */ |
---|
| 1024 | +} __packed; |
---|
| 1025 | + |
---|
| 1026 | +struct get_retrieval_pointers_refcount_rsp { |
---|
| 1027 | + __le32 ExtentCount; |
---|
| 1028 | + __u32 Reserved; |
---|
| 1029 | + __le64 StartingVcn; |
---|
| 1030 | + struct smb3_extents extents[]; |
---|
| 1031 | +} __packed; |
---|
| 1032 | + |
---|
830 | 1033 | struct fsctl_set_integrity_information_req { |
---|
831 | 1034 | __le16 ChecksumAlgorithm; |
---|
832 | 1035 | __le16 Reserved; |
---|
.. | .. |
---|
841 | 1044 | __le32 ClusterSizeInBytes; |
---|
842 | 1045 | } __packed; |
---|
843 | 1046 | |
---|
| 1047 | +struct file_allocated_range_buffer { |
---|
| 1048 | + __le64 file_offset; |
---|
| 1049 | + __le64 length; |
---|
| 1050 | +} __packed; |
---|
| 1051 | + |
---|
844 | 1052 | /* Integrity ChecksumAlgorithm choices for above */ |
---|
845 | 1053 | #define CHECKSUM_TYPE_NONE 0x0000 |
---|
846 | 1054 | #define CHECKSUM_TYPE_CRC64 0x0002 |
---|
.. | .. |
---|
848 | 1056 | |
---|
849 | 1057 | /* Integrity flags for above */ |
---|
850 | 1058 | #define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF 0x00000001 |
---|
| 1059 | + |
---|
| 1060 | +/* Reparse structures - see MS-FSCC 2.1.2 */ |
---|
| 1061 | + |
---|
| 1062 | +/* struct fsctl_reparse_info_req is empty, only response structs (see below) */ |
---|
| 1063 | + |
---|
| 1064 | +struct reparse_data_buffer { |
---|
| 1065 | + __le32 ReparseTag; |
---|
| 1066 | + __le16 ReparseDataLength; |
---|
| 1067 | + __u16 Reserved; |
---|
| 1068 | + __u8 DataBuffer[]; /* Variable Length */ |
---|
| 1069 | +} __packed; |
---|
| 1070 | + |
---|
| 1071 | +struct reparse_guid_data_buffer { |
---|
| 1072 | + __le32 ReparseTag; |
---|
| 1073 | + __le16 ReparseDataLength; |
---|
| 1074 | + __u16 Reserved; |
---|
| 1075 | + __u8 ReparseGuid[16]; |
---|
| 1076 | + __u8 DataBuffer[]; /* Variable Length */ |
---|
| 1077 | +} __packed; |
---|
| 1078 | + |
---|
| 1079 | +struct reparse_mount_point_data_buffer { |
---|
| 1080 | + __le32 ReparseTag; |
---|
| 1081 | + __le16 ReparseDataLength; |
---|
| 1082 | + __u16 Reserved; |
---|
| 1083 | + __le16 SubstituteNameOffset; |
---|
| 1084 | + __le16 SubstituteNameLength; |
---|
| 1085 | + __le16 PrintNameOffset; |
---|
| 1086 | + __le16 PrintNameLength; |
---|
| 1087 | + __u8 PathBuffer[]; /* Variable Length */ |
---|
| 1088 | +} __packed; |
---|
| 1089 | + |
---|
| 1090 | +#define SYMLINK_FLAG_RELATIVE 0x00000001 |
---|
| 1091 | + |
---|
| 1092 | +struct reparse_symlink_data_buffer { |
---|
| 1093 | + __le32 ReparseTag; |
---|
| 1094 | + __le16 ReparseDataLength; |
---|
| 1095 | + __u16 Reserved; |
---|
| 1096 | + __le16 SubstituteNameOffset; |
---|
| 1097 | + __le16 SubstituteNameLength; |
---|
| 1098 | + __le16 PrintNameOffset; |
---|
| 1099 | + __le16 PrintNameLength; |
---|
| 1100 | + __le32 Flags; |
---|
| 1101 | + __u8 PathBuffer[]; /* Variable Length */ |
---|
| 1102 | +} __packed; |
---|
| 1103 | + |
---|
| 1104 | +/* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */ |
---|
| 1105 | + |
---|
851 | 1106 | |
---|
852 | 1107 | /* See MS-DFSC 2.2.2 */ |
---|
853 | 1108 | struct fsctl_get_dfs_referral_req { |
---|
.. | .. |
---|
870 | 1125 | __u8 Guid[SMB2_CLIENT_GUID_SIZE]; |
---|
871 | 1126 | __le16 SecurityMode; |
---|
872 | 1127 | __le16 DialectCount; |
---|
873 | | - __le16 Dialects[3]; /* BB expand this if autonegotiate > 3 dialects */ |
---|
| 1128 | + __le16 Dialects[4]; /* BB expand this if autonegotiate > 4 dialects */ |
---|
874 | 1129 | } __packed; |
---|
875 | 1130 | |
---|
876 | 1131 | struct validate_negotiate_info_rsp { |
---|
.. | .. |
---|
923 | 1178 | __le64 ByteCount; /* Bytes to be copied */ |
---|
924 | 1179 | } __packed; |
---|
925 | 1180 | |
---|
| 1181 | +/* |
---|
| 1182 | + * Maximum number of iovs we need for an ioctl request. |
---|
| 1183 | + * [0] : struct smb2_ioctl_req |
---|
| 1184 | + * [1] : in_data |
---|
| 1185 | + */ |
---|
| 1186 | +#define SMB2_IOCTL_IOV_SIZE 2 |
---|
| 1187 | + |
---|
926 | 1188 | struct smb2_ioctl_req { |
---|
927 | 1189 | struct smb2_sync_hdr sync_hdr; |
---|
928 | 1190 | __le16 StructureSize; /* Must be 57 */ |
---|
.. | .. |
---|
938 | 1200 | __le32 MaxOutputResponse; |
---|
939 | 1201 | __le32 Flags; |
---|
940 | 1202 | __u32 Reserved2; |
---|
941 | | - __u8 Buffer[0]; |
---|
| 1203 | + __u8 Buffer[]; |
---|
942 | 1204 | } __packed; |
---|
943 | 1205 | |
---|
944 | 1206 | struct smb2_ioctl_rsp { |
---|
.. | .. |
---|
967 | 1229 | __u64 PersistentFileId; /* opaque endianness */ |
---|
968 | 1230 | __u64 VolatileFileId; /* opaque endianness */ |
---|
969 | 1231 | } __packed; |
---|
| 1232 | + |
---|
| 1233 | +/* |
---|
| 1234 | + * Maximum size of a SMB2_CLOSE response is 64 (smb2 header) + 60 (data) |
---|
| 1235 | + */ |
---|
| 1236 | +#define MAX_SMB2_CLOSE_RESPONSE_SIZE 124 |
---|
970 | 1237 | |
---|
971 | 1238 | struct smb2_close_rsp { |
---|
972 | 1239 | struct smb2_sync_hdr sync_hdr; |
---|
.. | .. |
---|
999 | 1266 | |
---|
1000 | 1267 | /* For read request Flags field below, following flag is defined for SMB3.02 */ |
---|
1001 | 1268 | #define SMB2_READFLAG_READ_UNBUFFERED 0x01 |
---|
| 1269 | +#define SMB2_READFLAG_REQUEST_COMPRESSED 0x02 /* See MS-SMB2 2.2.19 */ |
---|
1002 | 1270 | |
---|
1003 | 1271 | /* Channel field for read and write: exactly one of following flags can be set*/ |
---|
1004 | 1272 | #define SMB2_CHANNEL_NONE cpu_to_le32(0x00000000) |
---|
1005 | 1273 | #define SMB2_CHANNEL_RDMA_V1 cpu_to_le32(0x00000001) /* SMB3 or later */ |
---|
1006 | 1274 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE cpu_to_le32(0x00000002) /* >= SMB3.02 */ |
---|
| 1275 | +#define SMB2_CHANNEL_RDMA_TRANSFORM cpu_to_le32(0x00000003) /* >= SMB3.02, only used on write */ |
---|
1007 | 1276 | |
---|
1008 | 1277 | /* SMB2 read request without RFC1001 length at the beginning */ |
---|
1009 | 1278 | struct smb2_read_plain_req { |
---|
.. | .. |
---|
1023 | 1292 | __u8 Buffer[1]; |
---|
1024 | 1293 | } __packed; |
---|
1025 | 1294 | |
---|
| 1295 | +/* Read flags */ |
---|
| 1296 | +#define SMB2_READFLAG_RESPONSE_NONE 0x00000000 |
---|
| 1297 | +#define SMB2_READFLAG_RESPONSE_RDMA_TRANSFORM 0x00000001 |
---|
| 1298 | + |
---|
1026 | 1299 | struct smb2_read_rsp { |
---|
1027 | 1300 | struct smb2_sync_hdr sync_hdr; |
---|
1028 | 1301 | __le16 StructureSize; /* Must be 17 */ |
---|
.. | .. |
---|
1030 | 1303 | __u8 Reserved; |
---|
1031 | 1304 | __le32 DataLength; |
---|
1032 | 1305 | __le32 DataRemaining; |
---|
1033 | | - __u32 Reserved2; |
---|
| 1306 | + __u32 Flags; |
---|
1034 | 1307 | __u8 Buffer[1]; |
---|
1035 | 1308 | } __packed; |
---|
1036 | 1309 | |
---|
.. | .. |
---|
1046 | 1319 | __le64 Offset; |
---|
1047 | 1320 | __u64 PersistentFileId; /* opaque endianness */ |
---|
1048 | 1321 | __u64 VolatileFileId; /* opaque endianness */ |
---|
1049 | | - __le32 Channel; /* Reserved MBZ */ |
---|
| 1322 | + __le32 Channel; /* MBZ unless SMB3.02 or later */ |
---|
1050 | 1323 | __le32 RemainingBytes; |
---|
1051 | 1324 | __le16 WriteChannelInfoOffset; |
---|
1052 | 1325 | __le16 WriteChannelInfoLength; |
---|
.. | .. |
---|
1063 | 1336 | __le32 DataRemaining; |
---|
1064 | 1337 | __u32 Reserved2; |
---|
1065 | 1338 | __u8 Buffer[1]; |
---|
| 1339 | +} __packed; |
---|
| 1340 | + |
---|
| 1341 | +/* notify flags */ |
---|
| 1342 | +#define SMB2_WATCH_TREE 0x0001 |
---|
| 1343 | + |
---|
| 1344 | +/* notify completion filter flags. See MS-FSCC 2.6 and MS-SMB2 2.2.35 */ |
---|
| 1345 | +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 |
---|
| 1346 | +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 |
---|
| 1347 | +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 |
---|
| 1348 | +#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 |
---|
| 1349 | +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 |
---|
| 1350 | +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 |
---|
| 1351 | +#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 |
---|
| 1352 | +#define FILE_NOTIFY_CHANGE_EA 0x00000080 |
---|
| 1353 | +#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 |
---|
| 1354 | +#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 |
---|
| 1355 | +#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 |
---|
| 1356 | +#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 |
---|
| 1357 | + |
---|
| 1358 | +struct smb2_change_notify_req { |
---|
| 1359 | + struct smb2_sync_hdr sync_hdr; |
---|
| 1360 | + __le16 StructureSize; |
---|
| 1361 | + __le16 Flags; |
---|
| 1362 | + __le32 OutputBufferLength; |
---|
| 1363 | + __u64 PersistentFileId; /* opaque endianness */ |
---|
| 1364 | + __u64 VolatileFileId; /* opaque endianness */ |
---|
| 1365 | + __le32 CompletionFilter; |
---|
| 1366 | + __u32 Reserved; |
---|
| 1367 | +} __packed; |
---|
| 1368 | + |
---|
| 1369 | +struct smb2_change_notify_rsp { |
---|
| 1370 | + struct smb2_sync_hdr sync_hdr; |
---|
| 1371 | + __le16 StructureSize; /* Must be 9 */ |
---|
| 1372 | + __le16 OutputBufferOffset; |
---|
| 1373 | + __le32 OutputBufferLength; |
---|
| 1374 | + __u8 Buffer[1]; /* array of file notify structs */ |
---|
1066 | 1375 | } __packed; |
---|
1067 | 1376 | |
---|
1068 | 1377 | #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001 |
---|
.. | .. |
---|
1111 | 1420 | #define SMB2_RETURN_SINGLE_ENTRY 0x02 |
---|
1112 | 1421 | #define SMB2_INDEX_SPECIFIED 0x04 |
---|
1113 | 1422 | #define SMB2_REOPEN 0x10 |
---|
| 1423 | + |
---|
| 1424 | +#define SMB2_QUERY_DIRECTORY_IOV_SIZE 2 |
---|
1114 | 1425 | |
---|
1115 | 1426 | struct smb2_query_directory_req { |
---|
1116 | 1427 | struct smb2_sync_hdr sync_hdr; |
---|
.. | .. |
---|
1182 | 1493 | __le32 OutputBufferLength; |
---|
1183 | 1494 | __u8 Buffer[1]; |
---|
1184 | 1495 | } __packed; |
---|
| 1496 | + |
---|
| 1497 | +/* |
---|
| 1498 | + * Maximum number of iovs we need for a set-info request. |
---|
| 1499 | + * The largest one is rename/hardlink |
---|
| 1500 | + * [0] : struct smb2_set_info_req + smb2_file_[rename|link]_info |
---|
| 1501 | + * [1] : path |
---|
| 1502 | + * [2] : compound padding |
---|
| 1503 | + */ |
---|
| 1504 | +#define SMB2_SET_INFO_IOV_SIZE 3 |
---|
1185 | 1505 | |
---|
1186 | 1506 | struct smb2_set_info_req { |
---|
1187 | 1507 | struct smb2_sync_hdr sync_hdr; |
---|
.. | .. |
---|
1288 | 1608 | __le32 VolumeLabelLength; /* includes trailing null */ |
---|
1289 | 1609 | __u8 SupportsObjects; /* True if eg like NTFS, supports objects */ |
---|
1290 | 1610 | __u8 Reserved; |
---|
1291 | | - __u8 VolumeLabel[0]; /* variable len */ |
---|
| 1611 | + __u8 VolumeLabel[]; /* variable len */ |
---|
1292 | 1612 | } __packed; |
---|
1293 | 1613 | |
---|
1294 | 1614 | /* partial list of QUERY INFO levels */ |
---|
.. | .. |
---|
1338 | 1658 | #define FILE_NORMALIZED_NAME_INFORMATION 48 |
---|
1339 | 1659 | #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50 |
---|
1340 | 1660 | #define FILE_STANDARD_LINK_INFORMATION 54 |
---|
| 1661 | +#define FILE_ID_INFORMATION 59 |
---|
1341 | 1662 | |
---|
1342 | 1663 | struct smb2_file_internal_info { |
---|
1343 | 1664 | __le64 IndexNumber; |
---|
.. | .. |
---|
1349 | 1670 | __u8 Reserved[7]; |
---|
1350 | 1671 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ |
---|
1351 | 1672 | __le32 FileNameLength; |
---|
1352 | | - char FileName[0]; /* New name to be assigned */ |
---|
| 1673 | + char FileName[]; /* New name to be assigned */ |
---|
| 1674 | + /* padding - overall struct size must be >= 24 so filename + pad >= 6 */ |
---|
1353 | 1675 | } __packed; /* level 10 Set */ |
---|
1354 | 1676 | |
---|
1355 | 1677 | struct smb2_file_link_info { /* encoding of request for level 11 */ |
---|
.. | .. |
---|
1358 | 1680 | __u8 Reserved[7]; |
---|
1359 | 1681 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ |
---|
1360 | 1682 | __le32 FileNameLength; |
---|
1361 | | - char FileName[0]; /* Name to be assigned to new link */ |
---|
| 1683 | + char FileName[]; /* Name to be assigned to new link */ |
---|
1362 | 1684 | } __packed; /* level 11 Set */ |
---|
1363 | | - |
---|
1364 | | -#define SMB2_MIN_EA_BUF 2048 |
---|
1365 | | -#define SMB2_MAX_EA_BUF 65536 |
---|
1366 | 1685 | |
---|
1367 | 1686 | struct smb2_file_full_ea_info { /* encoding of response for level 15 */ |
---|
1368 | 1687 | __le32 next_entry_offset; |
---|
1369 | 1688 | __u8 flags; |
---|
1370 | 1689 | __u8 ea_name_length; |
---|
1371 | 1690 | __le16 ea_value_length; |
---|
1372 | | - char ea_data[0]; /* \0 terminated name plus value */ |
---|
| 1691 | + char ea_data[]; /* \0 terminated name plus value */ |
---|
1373 | 1692 | } __packed; /* level 15 Set */ |
---|
1374 | 1693 | |
---|
1375 | 1694 | /* |
---|
.. | .. |
---|
1404 | 1723 | __le64 EndOfFile; /* new end of file value */ |
---|
1405 | 1724 | } __packed; /* level 20 Set */ |
---|
1406 | 1725 | |
---|
| 1726 | +struct smb2_file_reparse_point_info { |
---|
| 1727 | + __le64 IndexNumber; |
---|
| 1728 | + __le32 Tag; |
---|
| 1729 | +} __packed; |
---|
| 1730 | + |
---|
| 1731 | +struct smb2_file_network_open_info { |
---|
| 1732 | + __le64 CreationTime; |
---|
| 1733 | + __le64 LastAccessTime; |
---|
| 1734 | + __le64 LastWriteTime; |
---|
| 1735 | + __le64 ChangeTime; |
---|
| 1736 | + __le64 AllocationSize; |
---|
| 1737 | + __le64 EndOfFile; |
---|
| 1738 | + __le32 Attributes; |
---|
| 1739 | + __le32 Reserved; |
---|
| 1740 | +} __packed; /* level 34 Query also similar returned in close rsp and open rsp */ |
---|
| 1741 | + |
---|
| 1742 | +/* See MS-FSCC 2.4.43 */ |
---|
| 1743 | +struct smb2_file_id_information { |
---|
| 1744 | + __le64 VolumeSerialNumber; |
---|
| 1745 | + __u64 PersistentFileId; /* opaque endianness */ |
---|
| 1746 | + __u64 VolatileFileId; /* opaque endianness */ |
---|
| 1747 | +} __packed; /* level 59 */ |
---|
| 1748 | + |
---|
1407 | 1749 | extern char smb2_padding[7]; |
---|
1408 | 1750 | |
---|
| 1751 | +/* equivalent of the contents of SMB3.1.1 POSIX open context response */ |
---|
| 1752 | +struct create_posix_rsp { |
---|
| 1753 | + u32 nlink; |
---|
| 1754 | + u32 reparse_tag; |
---|
| 1755 | + u32 mode; |
---|
| 1756 | + struct cifs_sid owner; /* var-sized on the wire */ |
---|
| 1757 | + struct cifs_sid group; /* var-sized on the wire */ |
---|
| 1758 | +} __packed; |
---|
| 1759 | + |
---|
| 1760 | +/* |
---|
| 1761 | + * SMB2-only POSIX info level for query dir |
---|
| 1762 | + * |
---|
| 1763 | + * See posix_info_sid_size(), posix_info_extra_size() and |
---|
| 1764 | + * posix_info_parse() to help with the handling of this struct. |
---|
| 1765 | + */ |
---|
| 1766 | +struct smb2_posix_info { |
---|
| 1767 | + __le32 NextEntryOffset; |
---|
| 1768 | + __u32 Ignored; |
---|
| 1769 | + __le64 CreationTime; |
---|
| 1770 | + __le64 LastAccessTime; |
---|
| 1771 | + __le64 LastWriteTime; |
---|
| 1772 | + __le64 ChangeTime; |
---|
| 1773 | + __le64 EndOfFile; |
---|
| 1774 | + __le64 AllocationSize; |
---|
| 1775 | + __le32 DosAttributes; |
---|
| 1776 | + __le64 Inode; |
---|
| 1777 | + __le32 DeviceId; |
---|
| 1778 | + __le32 Zero; |
---|
| 1779 | + /* beginning of POSIX Create Context Response */ |
---|
| 1780 | + __le32 HardLinks; |
---|
| 1781 | + __le32 ReparseTag; |
---|
| 1782 | + __le32 Mode; |
---|
| 1783 | + /* |
---|
| 1784 | + * var sized owner SID |
---|
| 1785 | + * var sized group SID |
---|
| 1786 | + * le32 filenamelength |
---|
| 1787 | + * u8 filename[] |
---|
| 1788 | + */ |
---|
| 1789 | +} __packed; |
---|
| 1790 | + |
---|
| 1791 | +/* Level 100 query info */ |
---|
| 1792 | +struct smb311_posix_qinfo { |
---|
| 1793 | + __le64 CreationTime; |
---|
| 1794 | + __le64 LastAccessTime; |
---|
| 1795 | + __le64 LastWriteTime; |
---|
| 1796 | + __le64 ChangeTime; |
---|
| 1797 | + __le64 EndOfFile; |
---|
| 1798 | + __le64 AllocationSize; |
---|
| 1799 | + __le32 DosAttributes; |
---|
| 1800 | + __le64 Inode; |
---|
| 1801 | + __le32 DeviceId; |
---|
| 1802 | + __le32 Zero; |
---|
| 1803 | + /* beginning of POSIX Create Context Response */ |
---|
| 1804 | + __le32 HardLinks; |
---|
| 1805 | + __le32 ReparseTag; |
---|
| 1806 | + __le32 Mode; |
---|
| 1807 | + u8 Sids[]; |
---|
| 1808 | + /* |
---|
| 1809 | + * var sized owner SID |
---|
| 1810 | + * var sized group SID |
---|
| 1811 | + * le32 filenamelength |
---|
| 1812 | + * u8 filename[] |
---|
| 1813 | + */ |
---|
| 1814 | +} __packed; |
---|
| 1815 | + |
---|
| 1816 | +/* |
---|
| 1817 | + * Parsed version of the above struct. Allows direct access to the |
---|
| 1818 | + * variable length fields |
---|
| 1819 | + */ |
---|
| 1820 | +struct smb2_posix_info_parsed { |
---|
| 1821 | + const struct smb2_posix_info *base; |
---|
| 1822 | + size_t size; |
---|
| 1823 | + struct cifs_sid owner; |
---|
| 1824 | + struct cifs_sid group; |
---|
| 1825 | + int name_len; |
---|
| 1826 | + const u8 *name; |
---|
| 1827 | +}; |
---|
| 1828 | + |
---|
1409 | 1829 | #endif /* _SMB2PDU_H */ |
---|