|
10 | 10 | #include "ntlmssp.h"
|
11 | 11 | #include "smbacl.h"
|
12 | 12 |
|
13 |
| -/* |
14 |
| - * Note that, due to trying to use names similar to the protocol specifications, |
15 |
| - * there are many mixed case field names in the structures below. Although |
16 |
| - * this does not match typical Linux kernel style, it is necessary to be |
17 |
| - * able to match against the protocol specfication. |
18 |
| - * |
19 |
| - * SMB2 commands |
20 |
| - * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses |
21 |
| - * (ie no useful data other than the SMB error code itself) and are marked such. |
22 |
| - * Knowing this helps avoid response buffer allocations and copy in some cases. |
23 |
| - */ |
24 |
| - |
25 |
| -/* List of commands in host endian */ |
26 |
| -#define SMB2_NEGOTIATE_HE 0x0000 |
27 |
| -#define SMB2_SESSION_SETUP_HE 0x0001 |
28 |
| -#define SMB2_LOGOFF_HE 0x0002 /* trivial request/resp */ |
29 |
| -#define SMB2_TREE_CONNECT_HE 0x0003 |
30 |
| -#define SMB2_TREE_DISCONNECT_HE 0x0004 /* trivial req/resp */ |
31 |
| -#define SMB2_CREATE_HE 0x0005 |
32 |
| -#define SMB2_CLOSE_HE 0x0006 |
33 |
| -#define SMB2_FLUSH_HE 0x0007 /* trivial resp */ |
34 |
| -#define SMB2_READ_HE 0x0008 |
35 |
| -#define SMB2_WRITE_HE 0x0009 |
36 |
| -#define SMB2_LOCK_HE 0x000A |
37 |
| -#define SMB2_IOCTL_HE 0x000B |
38 |
| -#define SMB2_CANCEL_HE 0x000C |
39 |
| -#define SMB2_ECHO_HE 0x000D |
40 |
| -#define SMB2_QUERY_DIRECTORY_HE 0x000E |
41 |
| -#define SMB2_CHANGE_NOTIFY_HE 0x000F |
42 |
| -#define SMB2_QUERY_INFO_HE 0x0010 |
43 |
| -#define SMB2_SET_INFO_HE 0x0011 |
44 |
| -#define SMB2_OPLOCK_BREAK_HE 0x0012 |
45 |
| - |
46 |
| -/* The same list in little endian */ |
47 |
| -#define SMB2_NEGOTIATE cpu_to_le16(SMB2_NEGOTIATE_HE) |
48 |
| -#define SMB2_SESSION_SETUP cpu_to_le16(SMB2_SESSION_SETUP_HE) |
49 |
| -#define SMB2_LOGOFF cpu_to_le16(SMB2_LOGOFF_HE) |
50 |
| -#define SMB2_TREE_CONNECT cpu_to_le16(SMB2_TREE_CONNECT_HE) |
51 |
| -#define SMB2_TREE_DISCONNECT cpu_to_le16(SMB2_TREE_DISCONNECT_HE) |
52 |
| -#define SMB2_CREATE cpu_to_le16(SMB2_CREATE_HE) |
53 |
| -#define SMB2_CLOSE cpu_to_le16(SMB2_CLOSE_HE) |
54 |
| -#define SMB2_FLUSH cpu_to_le16(SMB2_FLUSH_HE) |
55 |
| -#define SMB2_READ cpu_to_le16(SMB2_READ_HE) |
56 |
| -#define SMB2_WRITE cpu_to_le16(SMB2_WRITE_HE) |
57 |
| -#define SMB2_LOCK cpu_to_le16(SMB2_LOCK_HE) |
58 |
| -#define SMB2_IOCTL cpu_to_le16(SMB2_IOCTL_HE) |
59 |
| -#define SMB2_CANCEL cpu_to_le16(SMB2_CANCEL_HE) |
60 |
| -#define SMB2_ECHO cpu_to_le16(SMB2_ECHO_HE) |
61 |
| -#define SMB2_QUERY_DIRECTORY cpu_to_le16(SMB2_QUERY_DIRECTORY_HE) |
62 |
| -#define SMB2_CHANGE_NOTIFY cpu_to_le16(SMB2_CHANGE_NOTIFY_HE) |
63 |
| -#define SMB2_QUERY_INFO cpu_to_le16(SMB2_QUERY_INFO_HE) |
64 |
| -#define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE) |
65 |
| -#define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE) |
66 |
| - |
67 | 13 | /*Create Action Flags*/
|
68 | 14 | #define FILE_SUPERSEDED 0x00000000
|
69 | 15 | #define FILE_OPENED 0x00000001
|
|
107 | 53 | /* BB FIXME - analyze following length BB */
|
108 | 54 | #define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
|
109 | 55 |
|
110 |
| -#define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) /* 'B''M''S' */ |
111 |
| -#define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd) |
112 |
| - |
113 | 56 | #define SMB21_DEFAULT_IOSIZE (1024 * 1024)
|
114 | 57 | #define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024)
|
115 | 58 | #define SMB3_DEFAULT_TRANS_SIZE (1024 * 1024)
|
116 | 59 | #define SMB3_MIN_IOSIZE (64 * 1024)
|
117 | 60 | #define SMB3_MAX_IOSIZE (8 * 1024 * 1024)
|
118 | 61 |
|
119 |
| -/* |
120 |
| - * SMB2 Header Definition |
121 |
| - * |
122 |
| - * "MBZ" : Must be Zero |
123 |
| - * "BB" : BugBug, Something to check/review/analyze later |
124 |
| - * "PDU" : "Protocol Data Unit" (ie a network "frame") |
125 |
| - * |
126 |
| - */ |
127 |
| - |
128 |
| -#define __SMB2_HEADER_STRUCTURE_SIZE 64 |
129 |
| -#define SMB2_HEADER_STRUCTURE_SIZE \ |
130 |
| - cpu_to_le16(__SMB2_HEADER_STRUCTURE_SIZE) |
131 |
| - |
132 |
| -struct smb2_hdr { |
133 |
| - __le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */ |
134 |
| - __le16 StructureSize; /* 64 */ |
135 |
| - __le16 CreditCharge; /* MBZ */ |
136 |
| - __le32 Status; /* Error from server */ |
137 |
| - __le16 Command; |
138 |
| - __le16 CreditRequest; /* CreditResponse */ |
139 |
| - __le32 Flags; |
140 |
| - __le32 NextCommand; |
141 |
| - __le64 MessageId; |
142 |
| - union { |
143 |
| - struct { |
144 |
| - __le32 ProcessId; |
145 |
| - __le32 TreeId; |
146 |
| - } __packed SyncId; |
147 |
| - __le64 AsyncId; |
148 |
| - } __packed Id; |
149 |
| - __le64 SessionId; |
150 |
| - __u8 Signature[16]; |
151 |
| -} __packed; |
152 |
| - |
153 |
| -struct smb2_pdu { |
154 |
| - struct smb2_hdr hdr; |
155 |
| - __le16 StructureSize2; /* size of wct area (varies, request specific) */ |
156 |
| -} __packed; |
157 |
| - |
158 |
| -#define SMB3_AES_CCM_NONCE 11 |
159 |
| -#define SMB3_AES_GCM_NONCE 12 |
160 |
| - |
161 |
| -struct smb2_transform_hdr { |
162 |
| - __le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */ |
163 |
| - __u8 Signature[16]; |
164 |
| - __u8 Nonce[16]; |
165 |
| - __le32 OriginalMessageSize; |
166 |
| - __u16 Reserved1; |
167 |
| - __le16 Flags; /* EncryptionAlgorithm */ |
168 |
| - __le64 SessionId; |
169 |
| -} __packed; |
170 |
| - |
171 |
| -/* |
172 |
| - * SMB2 flag definitions |
173 |
| - */ |
174 |
| -#define SMB2_FLAGS_SERVER_TO_REDIR cpu_to_le32(0x00000001) |
175 |
| -#define SMB2_FLAGS_ASYNC_COMMAND cpu_to_le32(0x00000002) |
176 |
| -#define SMB2_FLAGS_RELATED_OPERATIONS cpu_to_le32(0x00000004) |
177 |
| -#define SMB2_FLAGS_SIGNED cpu_to_le32(0x00000008) |
178 |
| -#define SMB2_FLAGS_DFS_OPERATIONS cpu_to_le32(0x10000000) |
179 |
| -#define SMB2_FLAGS_REPLAY_OPERATIONS cpu_to_le32(0x20000000) |
180 |
| - |
181 | 62 | /*
|
182 | 63 | * Definitions for SMB2 Protocol Data Units (network frames)
|
183 | 64 | *
|
@@ -410,63 +291,6 @@ struct smb2_logoff_rsp {
|
410 | 291 | __le16 Reserved;
|
411 | 292 | } __packed;
|
412 | 293 |
|
413 |
| -struct smb2_tree_connect_req { |
414 |
| - struct smb2_hdr hdr; |
415 |
| - __le16 StructureSize; /* Must be 9 */ |
416 |
| - __le16 Reserved; /* Flags in SMB3.1.1 */ |
417 |
| - __le16 PathOffset; |
418 |
| - __le16 PathLength; |
419 |
| - __u8 Buffer[1]; /* variable length */ |
420 |
| -} __packed; |
421 |
| - |
422 |
| -struct smb2_tree_connect_rsp { |
423 |
| - struct smb2_hdr hdr; |
424 |
| - __le16 StructureSize; /* Must be 16 */ |
425 |
| - __u8 ShareType; /* see below */ |
426 |
| - __u8 Reserved; |
427 |
| - __le32 ShareFlags; /* see below */ |
428 |
| - __le32 Capabilities; /* see below */ |
429 |
| - __le32 MaximalAccess; |
430 |
| -} __packed; |
431 |
| - |
432 |
| -/* Possible ShareType values */ |
433 |
| -#define SMB2_SHARE_TYPE_DISK 0x01 |
434 |
| -#define SMB2_SHARE_TYPE_PIPE 0x02 |
435 |
| -#define SMB2_SHARE_TYPE_PRINT 0x03 |
436 |
| - |
437 |
| -/* |
438 |
| - * Possible ShareFlags - exactly one and only one of the first 4 caching flags |
439 |
| - * must be set (any of the remaining, SHI1005, flags may be set individually |
440 |
| - * or in combination. |
441 |
| - */ |
442 |
| -#define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000 |
443 |
| -#define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010 |
444 |
| -#define SMB2_SHAREFLAG_VDO_CACHING 0x00000020 |
445 |
| -#define SMB2_SHAREFLAG_NO_CACHING 0x00000030 |
446 |
| -#define SHI1005_FLAGS_DFS 0x00000001 |
447 |
| -#define SHI1005_FLAGS_DFS_ROOT 0x00000002 |
448 |
| -#define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100 |
449 |
| -#define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200 |
450 |
| -#define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400 |
451 |
| -#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800 |
452 |
| -#define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000 |
453 |
| -#define SHI1005_FLAGS_ENABLE_HASH 0x00002000 |
454 |
| - |
455 |
| -/* Possible share capabilities */ |
456 |
| -#define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) |
457 |
| - |
458 |
| -struct smb2_tree_disconnect_req { |
459 |
| - struct smb2_hdr hdr; |
460 |
| - __le16 StructureSize; /* Must be 4 */ |
461 |
| - __le16 Reserved; |
462 |
| -} __packed; |
463 |
| - |
464 |
| -struct smb2_tree_disconnect_rsp { |
465 |
| - struct smb2_hdr hdr; |
466 |
| - __le16 StructureSize; /* Must be 4 */ |
467 |
| - __le16 Reserved; |
468 |
| -} __packed; |
469 |
| - |
470 | 294 | #define ATTR_READONLY_LE cpu_to_le32(ATTR_READONLY)
|
471 | 295 | #define ATTR_HIDDEN_LE cpu_to_le32(ATTR_HIDDEN)
|
472 | 296 | #define ATTR_SYSTEM_LE cpu_to_le32(ATTR_SYSTEM)
|
|
0 commit comments