2 Unix SMB/CIFS implementation.
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /* static body buffer 38 (0x26) bytes */
27 /* uint16_t buffer_code; 0x24 (why?) */
28 uint16_t unknown1; /* 0x0001 */
29 uint8_t unknown2[32]; /* all zero */
30 uint16_t unknown3; /* 0x00000 */
33 /* static body buffer 64 (0x40) bytes */
34 /* uint16_t buffer_code; 0x41 = 0x40 + 1 */
36 uint32_t unknown2; /* 0x06 */
38 uint32_t unknown3; /* 0x0d */
39 uint16_t unknown4; /* 0x00 */
40 uint32_t unknown5; /* 0x01 */
41 uint32_t unknown6; /* 0x01 */
42 uint16_t unknown7; /* 0x01 */
45 /* uint16_t secblob_ofs */
46 /* uint16_t secblob_size */
47 uint32_t unknown9; /* 0x204d4c20 */
49 /* dynamic body buffer */
54 struct smb2_session_setup {
56 /* static body buffer 16 (0x10) bytes */
57 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
59 uint32_t unknown2; /* 0xF */
60 uint32_t unknown3; /* 0x00 */
61 /* uint16_t secblob_ofs */
62 /* uint16_t secblob_size */
68 /* static body buffer 8 (0x08) bytes */
69 /* uint16_t buffer_code; 0x09 = 0x08 +1 */
71 /* uint16_t secblob_ofs */
72 /* uint16_t secblob_size */
77 /* extracted from the SMB2 header */
82 struct smb2_tree_connect {
84 /* static body buffer 8 (0x08) bytes */
85 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
86 uint16_t unknown1; /* 0x0000 */
87 /* uint16_t path_ofs */
88 /* uint16_t path_size */
91 const char *path; /* as non-terminated UTF-16 on the wire */
94 /* static body buffer 16 (0x10) bytes */
95 /* uint16_t buffer_code; 0x10 */
96 uint16_t unknown1; /* 0x02 */
97 uint32_t unknown2; /* 0x00 */
98 uint32_t unknown3; /* 0x00 */
101 /* extracted from the SMB2 header */
106 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
107 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
108 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
109 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
113 /* static body buffer 56 (0x38) bytes */
114 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
115 uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
117 uint32_t unknown3[4];
118 uint32_t access_mask;
121 uint32_t share_access;
122 uint32_t open_disposition;
123 uint32_t create_options;
125 /* uint16_t fname_ofs */
126 /* uint16_t fname_size */
127 /* uint32_t blob_ofs; */
128 /* uint32_t blob_size; */
133 /* optional list of extended attributes */
134 struct smb_ea_list eas;
138 /* static body buffer 88 (0x58) bytes */
139 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
140 uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
141 uint32_t create_action;
150 struct smb2_handle handle;
151 /* uint32_t blob_ofs; */
152 /* uint32_t blob_size; */
160 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
164 /* static body buffer 24 (0x18) bytes */
165 /* uint16_t buffer_code; 0x18 */
166 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
168 struct smb2_handle handle;
172 /* static body buffer 60 (0x3C) bytes */
173 /* uint16_t buffer_code; 0x3C */
186 /* getinfo classes */
187 #define SMB2_GETINFO_FILE 0x01
188 #define SMB2_GETINFO_FS 0x02
189 #define SMB2_GETINFO_SECURITY 0x03
191 /* flags for RAW_FILEINFO_SMB2_ALL_EAS */
192 #define SMB2_CONTINUE_FLAG_RESTART 0x01
193 #define SMB2_CONTINUE_FLAG_SINGLE 0x02
195 /* NOTE! the getinfo fs and file levels exactly match up with the
196 'passthru' SMB levels, which are levels >= 1000. The SMB2 client
197 lib uses the names from the libcli/raw/ library */
199 struct smb2_getinfo {
201 /* static body buffer 40 (0x28) bytes */
202 /* uint16_t buffer_code; 0x29 = 0x28 + 1 (why???) */
204 uint32_t max_response_size;
207 uint32_t flags; /* level specific */
208 uint32_t flags2; /* used by all_eas level */
209 struct smb2_handle handle;
213 /* static body buffer 8 (0x08) bytes */
214 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
215 /* uint16_t blob_ofs; */
216 /* uint16_t blob_size; */
223 struct smb2_setinfo {
227 struct smb2_handle handle;
234 /* static body buffer 48 (0x30) bytes */
235 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
236 /* uint16_t data_ofs; */
237 /* uint32_t data_size; */
239 struct smb2_handle handle;
240 uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
241 uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
248 /* static body buffer 17 (0x11) bytes */
249 /* uint16_t buffer_code; 0x11 */
252 uint64_t unknown1; /* 0x0000000000000000 */
259 /* static body buffer 48 (0x30) bytes */
260 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
264 struct smb2_handle handle;
265 uint64_t unknown1; /* 0x0000000000000000 */
266 uint64_t unknown2; /* 0x0000000000000000 */
271 /* static body buffer 16 (0x10) bytes */
272 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
273 /* uint16_t data_ofs; */
274 /* uint32_t data_size; */
275 uint64_t unknown1; /* 0x0000000000000000 */
285 uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
286 uint32_t unknown; /* perhaps a continue token? */
287 struct smb2_handle handle;
288 uint32_t max_response_size;