]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * fs/cifs/cifspdu.h | |
3 | * | |
4 | * Copyright (c) International Business Machines Corp., 2002 | |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | |
6 | * | |
7 | * This library is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU Lesser General Public License as published | |
9 | * by the Free Software Foundation; either version 2.1 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This library is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
15 | * the GNU Lesser General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Lesser General Public License | |
18 | * along with this library; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | */ | |
21 | ||
22 | #ifndef _CIFSPDU_H | |
23 | #define _CIFSPDU_H | |
24 | ||
25 | #include <net/sock.h> | |
26 | ||
27 | #define CIFS_PROT 0 | |
28 | #define BAD_PROT CIFS_PROT+1 | |
29 | ||
30 | /* SMB command codes */ | |
31 | /* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses | |
32 | (ie which include no useful data other than the SMB error code itself). | |
33 | Knowing this helps avoid response buffer allocations and copy in some cases */ | |
34 | #define SMB_COM_CREATE_DIRECTORY 0x00 /* trivial response */ | |
35 | #define SMB_COM_DELETE_DIRECTORY 0x01 /* trivial response */ | |
36 | #define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */ | |
37 | #define SMB_COM_DELETE 0x06 /* trivial response */ | |
38 | #define SMB_COM_RENAME 0x07 /* trivial response */ | |
39 | #define SMB_COM_SETATTR 0x09 /* trivial response */ | |
40 | #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ | |
41 | #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ | |
42 | #define SMB_COM_READ_ANDX 0x2E | |
43 | #define SMB_COM_WRITE_ANDX 0x2F | |
44 | #define SMB_COM_TRANSACTION2 0x32 | |
45 | #define SMB_COM_TRANSACTION2_SECONDARY 0x33 | |
46 | #define SMB_COM_FIND_CLOSE2 0x34 /* trivial response */ | |
47 | #define SMB_COM_TREE_DISCONNECT 0x71 /* trivial response */ | |
48 | #define SMB_COM_NEGOTIATE 0x72 | |
49 | #define SMB_COM_SESSION_SETUP_ANDX 0x73 | |
50 | #define SMB_COM_LOGOFF_ANDX 0x74 /* trivial response */ | |
51 | #define SMB_COM_TREE_CONNECT_ANDX 0x75 | |
52 | #define SMB_COM_NT_TRANSACT 0xA0 | |
53 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 | |
54 | #define SMB_COM_NT_CREATE_ANDX 0xA2 | |
55 | #define SMB_COM_NT_RENAME 0xA5 /* trivial response */ | |
56 | ||
57 | /* Transact2 subcommand codes */ | |
58 | #define TRANS2_OPEN 0x00 | |
59 | #define TRANS2_FIND_FIRST 0x01 | |
60 | #define TRANS2_FIND_NEXT 0x02 | |
61 | #define TRANS2_QUERY_FS_INFORMATION 0x03 | |
62 | #define TRANS2_QUERY_PATH_INFORMATION 0x05 | |
63 | #define TRANS2_SET_PATH_INFORMATION 0x06 | |
64 | #define TRANS2_QUERY_FILE_INFORMATION 0x07 | |
65 | #define TRANS2_SET_FILE_INFORMATION 0x08 | |
66 | #define TRANS2_GET_DFS_REFERRAL 0x10 | |
67 | #define TRANS2_REPORT_DFS_INCOSISTENCY 0x11 | |
68 | ||
69 | /* NT Transact subcommand codes */ | |
70 | #define NT_TRANSACT_CREATE 0x01 | |
71 | #define NT_TRANSACT_IOCTL 0x02 | |
72 | #define NT_TRANSACT_SET_SECURITY_DESC 0x03 | |
73 | #define NT_TRANSACT_NOTIFY_CHANGE 0x04 | |
74 | #define NT_TRANSACT_RENAME 0x05 | |
75 | #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06 | |
76 | #define NT_TRANSACT_GET_USER_QUOTA 0x07 | |
77 | #define NT_TRANSACT_SET_USER_QUOTA 0x08 | |
78 | ||
79 | #define MAX_CIFS_HDR_SIZE 256 /* chained NTCreateXReadX will probably be biggest */ | |
80 | ||
81 | /* internal cifs vfs structures */ | |
82 | /***************************************************************** | |
83 | * All constants go here | |
84 | ***************************************************************** | |
85 | */ | |
86 | ||
87 | /* | |
88 | * Starting value for maximum SMB size negotiation | |
89 | */ | |
90 | #define CIFS_MAX_MSGSIZE (4*4096) | |
91 | ||
92 | /* | |
93 | * Size of encrypted user password in bytes | |
94 | */ | |
95 | #define CIFS_ENCPWD_SIZE (16) | |
96 | ||
97 | /* | |
98 | * Size of the crypto key returned on the negotiate SMB in bytes | |
99 | */ | |
100 | #define CIFS_CRYPTO_KEY_SIZE (8) | |
101 | ||
102 | /* | |
103 | * Size of the session key (crypto key encrypted with the password | |
104 | */ | |
105 | #define CIFS_SESSION_KEY_SIZE (24) | |
106 | ||
107 | /* | |
108 | * Maximum user name length | |
109 | */ | |
110 | #define CIFS_UNLEN (20) | |
111 | ||
112 | /* | |
113 | * Flags on SMB open | |
114 | */ | |
115 | #define SMBOPEN_WRITE_THROUGH 0x4000 | |
116 | #define SMBOPEN_DENY_ALL 0x0010 | |
117 | #define SMBOPEN_DENY_WRITE 0x0020 | |
118 | #define SMBOPEN_DENY_READ 0x0030 | |
119 | #define SMBOPEN_DENY_NONE 0x0040 | |
120 | #define SMBOPEN_READ 0x0000 | |
121 | #define SMBOPEN_WRITE 0x0001 | |
122 | #define SMBOPEN_READWRITE 0x0002 | |
123 | #define SMBOPEN_EXECUTE 0x0003 | |
124 | ||
125 | #define SMBOPEN_OCREATE 0x0010 | |
126 | #define SMBOPEN_OTRUNC 0x0002 | |
127 | #define SMBOPEN_OAPPEND 0x0001 | |
128 | ||
129 | /* | |
130 | * SMB flag definitions | |
131 | */ | |
132 | #define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock primitives */ | |
133 | #define SMBFLG_RCV_POSTED 0x02 /* obsolete */ | |
134 | #define SMBFLG_RSVD 0x04 | |
135 | #define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off implies case sensitive file handling requested) */ | |
136 | #define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */ | |
137 | #define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */ | |
138 | #define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */ | |
139 | #define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */ | |
140 | ||
141 | /* | |
142 | * SMB flag2 definitions | |
143 | */ | |
144 | #define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) path names in response */ | |
145 | #define SMBFLG2_KNOWS_EAS cpu_to_le16(2) | |
146 | #define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) | |
147 | #define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) | |
148 | #define SMBFLG2_EXT_SEC cpu_to_le16(0x800) | |
149 | #define SMBFLG2_DFS cpu_to_le16(0x1000) | |
150 | #define SMBFLG2_PAGING_IO cpu_to_le16(0x2000) | |
151 | #define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000) | |
152 | #define SMBFLG2_UNICODE cpu_to_le16(0x8000) | |
153 | ||
154 | /* | |
155 | * These are the file access permission bits defined in CIFS for the | |
156 | * NTCreateAndX as well as the level 0x107 | |
157 | * TRANS2_QUERY_PATH_INFORMATION API. The level 0x107, SMB_QUERY_FILE_ALL_INFO | |
158 | * responds with the AccessFlags. | |
159 | * The AccessFlags specifies the access permissions a caller has to the | |
160 | * file and can have any suitable combination of the following values: | |
161 | */ | |
162 | ||
163 | #define FILE_READ_DATA 0x00000001 /* Data can be read from the file */ | |
164 | #define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */ | |
165 | #define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */ | |
166 | #define FILE_READ_EA 0x00000008 /* Extended attributes associated */ | |
167 | /* with the file can be read */ | |
168 | #define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */ | |
169 | /* with the file can be written */ | |
170 | #define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */ | |
171 | /* the file using system paging I/O */ | |
172 | #define FILE_DELETE_CHILD 0x00000040 | |
173 | #define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */ | |
174 | /* file can be read */ | |
175 | #define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */ | |
176 | /* file can be written */ | |
177 | #define DELETE 0x00010000 /* The file can be deleted */ | |
178 | #define READ_CONTROL 0x00020000 /* The access control list and */ | |
179 | /* ownership associated with the */ | |
180 | /* file can be read */ | |
181 | #define WRITE_DAC 0x00040000 /* The access control list and */ | |
182 | /* ownership associated with the */ | |
183 | /* file can be written. */ | |
184 | #define WRITE_OWNER 0x00080000 /* Ownership information associated */ | |
185 | /* with the file can be written */ | |
186 | #define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */ | |
187 | /* synchronize with the completion */ | |
188 | /* of an input/output request */ | |
189 | #define GENERIC_ALL 0x10000000 | |
190 | #define GENERIC_EXECUTE 0x20000000 | |
191 | #define GENERIC_WRITE 0x40000000 | |
192 | #define GENERIC_READ 0x80000000 | |
193 | /* In summary - Relevant file */ | |
194 | /* access flags from CIFS are */ | |
195 | /* file_read_data, file_write_data */ | |
196 | /* file_execute, file_read_attributes */ | |
197 | /* write_dac, and delete. */ | |
198 | ||
199 | /* | |
200 | * Invalid readdir handle | |
201 | */ | |
202 | #define CIFS_NO_HANDLE 0xFFFF | |
203 | ||
204 | /* IPC$ in ASCII */ | |
205 | #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24" | |
206 | ||
207 | /* IPC$ in Unicode */ | |
208 | #define CIFS_IPC_UNICODE_RESOURCE "\x00\x49\x00\x50\x00\x43\x00\x24\x00\x00" | |
209 | ||
210 | /* Unicode Null terminate 2 bytes of 0 */ | |
211 | #define UNICODE_NULL "\x00\x00" | |
212 | #define ASCII_NULL 0x00 | |
213 | ||
214 | /* | |
215 | * Server type values (returned on EnumServer API | |
216 | */ | |
217 | #define CIFS_SV_TYPE_DC 0x00000008 | |
218 | #define CIFS_SV_TYPE_BACKDC 0x00000010 | |
219 | ||
220 | /* | |
221 | * Alias type flags (From EnumAlias API call | |
222 | */ | |
223 | #define CIFS_ALIAS_TYPE_FILE 0x0001 | |
224 | #define CIFS_SHARE_TYPE_FILE 0x0000 | |
225 | ||
226 | /* | |
227 | * File Attribute flags | |
228 | */ | |
229 | #define ATTR_READONLY 0x0001 | |
230 | #define ATTR_HIDDEN 0x0002 | |
231 | #define ATTR_SYSTEM 0x0004 | |
232 | #define ATTR_VOLUME 0x0008 | |
233 | #define ATTR_DIRECTORY 0x0010 | |
234 | #define ATTR_ARCHIVE 0x0020 | |
235 | #define ATTR_DEVICE 0x0040 | |
236 | #define ATTR_NORMAL 0x0080 | |
237 | #define ATTR_TEMPORARY 0x0100 | |
238 | #define ATTR_SPARSE 0x0200 | |
239 | #define ATTR_REPARSE 0x0400 | |
240 | #define ATTR_COMPRESSED 0x0800 | |
241 | #define ATTR_OFFLINE 0x1000 /* ie file not immediately available - offline storage */ | |
242 | #define ATTR_NOT_CONTENT_INDEXED 0x2000 | |
243 | #define ATTR_ENCRYPTED 0x4000 | |
244 | #define ATTR_POSIX_SEMANTICS 0x01000000 | |
245 | #define ATTR_BACKUP_SEMANTICS 0x02000000 | |
246 | #define ATTR_DELETE_ON_CLOSE 0x04000000 | |
247 | #define ATTR_SEQUENTIAL_SCAN 0x08000000 | |
248 | #define ATTR_RANDOM_ACCESS 0x10000000 | |
249 | #define ATTR_NO_BUFFERING 0x20000000 | |
250 | #define ATTR_WRITE_THROUGH 0x80000000 | |
251 | ||
252 | /* ShareAccess flags */ | |
253 | #define FILE_NO_SHARE 0x00000000 | |
254 | #define FILE_SHARE_READ 0x00000001 | |
255 | #define FILE_SHARE_WRITE 0x00000002 | |
256 | #define FILE_SHARE_DELETE 0x00000004 | |
257 | #define FILE_SHARE_ALL 0x00000007 | |
258 | ||
259 | /* CreateDisposition flags */ | |
260 | #define FILE_SUPERSEDE 0x00000000 | |
261 | #define FILE_OPEN 0x00000001 | |
262 | #define FILE_CREATE 0x00000002 | |
263 | #define FILE_OPEN_IF 0x00000003 | |
264 | #define FILE_OVERWRITE 0x00000004 | |
265 | #define FILE_OVERWRITE_IF 0x00000005 | |
266 | ||
267 | /* CreateOptions */ | |
268 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ | |
269 | #define CREATE_WRITE_THROUGH 0x00000002 | |
270 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ | |
271 | #define CREATE_RANDOM_ACCESS 0x00000800 | |
272 | #define CREATE_DELETE_ON_CLOSE 0x00001000 | |
273 | #define OPEN_REPARSE_POINT 0x00200000 | |
274 | ||
275 | /* ImpersonationLevel flags */ | |
276 | #define SECURITY_ANONYMOUS 0 | |
277 | #define SECURITY_IDENTIFICATION 1 | |
278 | #define SECURITY_IMPERSONATION 2 | |
279 | #define SECURITY_DELEGATION 3 | |
280 | ||
281 | /* SecurityFlags */ | |
282 | #define SECURITY_CONTEXT_TRACKING 0x01 | |
283 | #define SECURITY_EFFECTIVE_ONLY 0x02 | |
284 | ||
285 | /* | |
286 | * Default PID value, used in all SMBs where the PID is not important | |
287 | */ | |
288 | #define CIFS_DFT_PID 0x1234 | |
289 | ||
290 | /* | |
291 | * We use the same routine for Copy and Move SMBs. This flag is used to | |
292 | * distinguish | |
293 | */ | |
294 | #define CIFS_COPY_OP 1 | |
295 | #define CIFS_RENAME_OP 2 | |
296 | ||
297 | #define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */ | |
298 | #define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */ | |
299 | ||
300 | #pragma pack(1) | |
301 | ||
302 | struct smb_hdr { | |
303 | __u32 smb_buf_length; /* big endian on wire *//* BB length is only two or three bytes - with one or two byte type preceding it but that is always zero - we could mask the type byte off just in case BB */ | |
304 | __u8 Protocol[4]; | |
305 | __u8 Command; | |
306 | union { | |
307 | struct { | |
308 | __u8 ErrorClass; | |
309 | __u8 Reserved; | |
310 | __le16 Error; | |
311 | } DosError; | |
312 | __le32 CifsError; | |
313 | } Status; | |
314 | __u8 Flags; | |
315 | __le16 Flags2; /* note: le */ | |
316 | __le16 PidHigh; | |
317 | union { | |
318 | struct { | |
319 | __le32 SequenceNumber; /* le */ | |
320 | __u32 Reserved; /* zero */ | |
321 | } Sequence; | |
322 | __u8 SecuritySignature[8]; /* le */ | |
323 | } Signature; | |
324 | __u8 pad[2]; | |
325 | __u16 Tid; | |
326 | __le16 Pid; | |
327 | __u16 Uid; | |
328 | __u16 Mid; | |
329 | __u8 WordCount; | |
330 | }; | |
331 | /* given a pointer to an smb_hdr retrieve the value of byte count */ | |
332 | #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) | |
333 | ||
334 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ | |
335 | #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) | |
336 | ||
337 | /* | |
338 | * Computer Name Length | |
339 | */ | |
340 | #define CNLEN 15 | |
341 | ||
342 | /* | |
343 | * Share Name Length @S8A | |
344 | * Note: This length is limited by the SMB used to get @S8A | |
345 | * the Share info. NetShareEnum only returns 13 @S8A | |
346 | * chars, including the null termination. @S8A | |
347 | */ | |
348 | #define SNLEN 12 /*@S8A */ | |
349 | ||
350 | /* | |
351 | * Comment Length | |
352 | */ | |
353 | #define MAXCOMMENTLEN 40 | |
354 | ||
355 | /* | |
356 | * The OS/2 maximum path name | |
357 | */ | |
358 | #define MAX_PATHCONF 256 | |
359 | ||
360 | /* | |
361 | * SMB frame definitions (following must be packed structs) | |
362 | * See the SNIA CIFS Specification for details. | |
363 | * | |
364 | * The Naming convention is the lower case version of the | |
365 | * smb command code name for the struct and this is typedef to the | |
366 | * uppercase version of the same name with the prefix SMB_ removed | |
367 | * for brevity. Although typedefs are not commonly used for | |
368 | * structure definitions in the Linux kernel, their use in the | |
369 | * CIFS standards document, which this code is based on, may | |
370 | * make this one of the cases where typedefs for structures make | |
371 | * sense to improve readability for readers of the standards doc. | |
372 | * Typedefs can always be removed later if they are too distracting | |
373 | * and they are only used for the CIFSs PDUs themselves, not | |
374 | * internal cifs vfs structures | |
375 | * | |
376 | */ | |
377 | ||
378 | typedef struct negotiate_req { | |
379 | struct smb_hdr hdr; /* wct = 0 */ | |
380 | __le16 ByteCount; | |
381 | unsigned char DialectsArray[1]; | |
382 | } NEGOTIATE_REQ; | |
383 | ||
384 | typedef struct negotiate_rsp { | |
385 | struct smb_hdr hdr; /* wct = 17 */ | |
386 | __le16 DialectIndex; | |
387 | __u8 SecurityMode; | |
388 | __le16 MaxMpxCount; | |
389 | __le16 MaxNumberVcs; | |
390 | __le32 MaxBufferSize; | |
391 | __le32 MaxRawSize; | |
392 | __le32 SessionKey; | |
393 | __le32 Capabilities; /* see below */ | |
394 | __le32 SystemTimeLow; | |
395 | __le32 SystemTimeHigh; | |
396 | __le16 ServerTimeZone; | |
397 | __u8 EncryptionKeyLength; | |
398 | __u16 ByteCount; | |
399 | union { | |
400 | unsigned char EncryptionKey[1]; /* if cap extended security is off */ | |
401 | /* followed by Domain name - if extended security is off */ | |
402 | /* followed by 16 bytes of server GUID */ | |
403 | /* followed by security blob if cap_extended_security negotiated */ | |
404 | struct { | |
405 | unsigned char GUID[16]; | |
406 | unsigned char SecurityBlob[1]; | |
407 | } extended_response; | |
408 | } u; | |
409 | } NEGOTIATE_RSP; | |
410 | ||
411 | /* SecurityMode bits */ | |
412 | #define SECMODE_USER 0x01 /* off indicates share level security */ | |
413 | #define SECMODE_PW_ENCRYPT 0x02 | |
414 | #define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */ | |
415 | #define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required */ | |
416 | ||
417 | /* Negotiate response Capabilities */ | |
418 | #define CAP_RAW_MODE 0x00000001 | |
419 | #define CAP_MPX_MODE 0x00000002 | |
420 | #define CAP_UNICODE 0x00000004 | |
421 | #define CAP_LARGE_FILES 0x00000008 | |
422 | #define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */ | |
423 | #define CAP_RPC_REMOTE_APIS 0x00000020 | |
424 | #define CAP_STATUS32 0x00000040 | |
425 | #define CAP_LEVEL_II_OPLOCKS 0x00000080 | |
426 | #define CAP_LOCK_AND_READ 0x00000100 | |
427 | #define CAP_NT_FIND 0x00000200 | |
428 | #define CAP_DFS 0x00001000 | |
429 | #define CAP_INFOLEVEL_PASSTHRU 0x00002000 | |
430 | #define CAP_LARGE_READ_X 0x00004000 | |
431 | #define CAP_LARGE_WRITE_X 0x00008000 | |
432 | #define CAP_UNIX 0x00800000 | |
433 | #define CAP_RESERVED 0x02000000 | |
434 | #define CAP_BULK_TRANSFER 0x20000000 | |
435 | #define CAP_COMPRESSED_DATA 0x40000000 | |
436 | #define CAP_EXTENDED_SECURITY 0x80000000 | |
437 | ||
438 | typedef union smb_com_session_setup_andx { | |
439 | struct { /* request format */ | |
440 | struct smb_hdr hdr; /* wct = 12 */ | |
441 | __u8 AndXCommand; | |
442 | __u8 AndXReserved; | |
443 | __le16 AndXOffset; | |
444 | __le16 MaxBufferSize; | |
445 | __le16 MaxMpxCount; | |
446 | __le16 VcNumber; | |
447 | __u32 SessionKey; | |
448 | __le16 SecurityBlobLength; | |
449 | __u32 Reserved; | |
450 | __le32 Capabilities; /* see below */ | |
451 | __le16 ByteCount; | |
452 | unsigned char SecurityBlob[1]; /* followed by */ | |
453 | /* STRING NativeOS */ | |
454 | /* STRING NativeLanMan */ | |
455 | } req; /* NTLM request format (with extended security */ | |
456 | ||
457 | struct { /* request format */ | |
458 | struct smb_hdr hdr; /* wct = 13 */ | |
459 | __u8 AndXCommand; | |
460 | __u8 AndXReserved; | |
461 | __le16 AndXOffset; | |
462 | __le16 MaxBufferSize; | |
463 | __le16 MaxMpxCount; | |
464 | __le16 VcNumber; | |
465 | __u32 SessionKey; | |
466 | __le16 CaseInsensitivePasswordLength; /* ASCII password length */ | |
467 | __le16 CaseSensitivePasswordLength; /* Unicode password length */ | |
468 | __u32 Reserved; /* see below */ | |
469 | __le32 Capabilities; | |
470 | __le16 ByteCount; | |
471 | unsigned char CaseInsensitivePassword[1]; /* followed by: */ | |
472 | /* unsigned char * CaseSensitivePassword; */ | |
473 | /* STRING AccountName */ | |
474 | /* STRING PrimaryDomain */ | |
475 | /* STRING NativeOS */ | |
476 | /* STRING NativeLanMan */ | |
477 | } req_no_secext; /* NTLM request format (without extended security */ | |
478 | ||
479 | struct { /* default (NTLM) response format */ | |
480 | struct smb_hdr hdr; /* wct = 4 */ | |
481 | __u8 AndXCommand; | |
482 | __u8 AndXReserved; | |
483 | __le16 AndXOffset; | |
484 | __le16 Action; /* see below */ | |
485 | __le16 SecurityBlobLength; | |
486 | __u16 ByteCount; | |
487 | unsigned char SecurityBlob[1]; /* followed by */ | |
488 | /* unsigned char * NativeOS; */ | |
489 | /* unsigned char * NativeLanMan; */ | |
490 | /* unsigned char * PrimaryDomain; */ | |
491 | } resp; /* NTLM response format (with or without extended security */ | |
492 | ||
493 | struct { /* request format */ | |
494 | struct smb_hdr hdr; /* wct = 10 */ | |
495 | __u8 AndXCommand; | |
496 | __u8 AndXReserved; | |
497 | __le16 AndXOffset; | |
498 | __le16 MaxBufferSize; | |
499 | __le16 MaxMpxCount; | |
500 | __le16 VcNumber; | |
501 | __u32 SessionKey; | |
502 | __le16 PassswordLength; | |
503 | __u32 Reserved; | |
504 | __le16 ByteCount; | |
505 | unsigned char AccountPassword[1]; /* followed by */ | |
506 | /* STRING AccountName */ | |
507 | /* STRING PrimaryDomain */ | |
508 | /* STRING NativeOS */ | |
509 | /* STRING NativeLanMan */ | |
510 | } old_req; /* pre-NTLM (LANMAN2.1) request format */ | |
511 | ||
512 | struct { /* default (NTLM) response format */ | |
513 | struct smb_hdr hdr; /* wct = 3 */ | |
514 | __u8 AndXCommand; | |
515 | __u8 AndXReserved; | |
516 | __le16 AndXOffset; | |
517 | __le16 Action; /* see below */ | |
518 | __u16 ByteCount; | |
519 | unsigned char NativeOS[1]; /* followed by */ | |
520 | /* unsigned char * NativeLanMan; */ | |
521 | /* unsigned char * PrimaryDomain; */ | |
522 | } old_resp; /* pre-NTLM (LANMAN2.1) response format */ | |
523 | } SESSION_SETUP_ANDX; | |
524 | ||
525 | #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" | |
526 | ||
527 | /* Capabilities bits (for NTLM SessSetup request) */ | |
528 | #define CAP_UNICODE 0x00000004 | |
529 | #define CAP_LARGE_FILES 0x00000008 | |
530 | #define CAP_NT_SMBS 0x00000010 | |
531 | #define CAP_STATUS32 0x00000040 | |
532 | #define CAP_LEVEL_II_OPLOCKS 0x00000080 | |
533 | #define CAP_NT_FIND 0x00000200 /* reserved should be zero (presumably because NT_SMBs implies the same thing) */ | |
534 | #define CAP_BULK_TRANSFER 0x20000000 | |
535 | #define CAP_EXTENDED_SECURITY 0x80000000 | |
536 | ||
537 | /* Action bits */ | |
538 | #define GUEST_LOGIN 1 | |
539 | ||
540 | typedef struct smb_com_tconx_req { | |
541 | struct smb_hdr hdr; /* wct = 4 */ | |
542 | __u8 AndXCommand; | |
543 | __u8 AndXReserved; | |
544 | __le16 AndXOffset; | |
545 | __le16 Flags; /* see below */ | |
546 | __le16 PasswordLength; | |
547 | __le16 ByteCount; | |
548 | unsigned char Password[1]; /* followed by */ | |
549 | /* STRING Path *//* \\server\share name */ | |
550 | /* STRING Service */ | |
551 | } TCONX_REQ; | |
552 | ||
553 | typedef struct smb_com_tconx_rsp { | |
554 | struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ | |
555 | __u8 AndXCommand; | |
556 | __u8 AndXReserved; | |
557 | __le16 AndXOffset; | |
558 | __le16 OptionalSupport; /* see below */ | |
559 | __u16 ByteCount; | |
560 | unsigned char Service[1]; /* always ASCII, not Unicode */ | |
561 | /* STRING NativeFileSystem */ | |
562 | } TCONX_RSP; | |
563 | ||
564 | /* tree connect Flags */ | |
565 | #define DISCONNECT_TID 0x0001 | |
566 | #define TCON_EXTENDED_SECINFO 0x0008 | |
567 | /* OptionalSupport bits */ | |
568 | #define SMB_SUPPORT_SEARCH_BITS 0x0001 /* must have bits (exclusive searches suppt. */ | |
569 | #define SMB_SHARE_IS_IN_DFS 0x0002 | |
570 | ||
571 | typedef struct smb_com_logoff_andx_req { | |
572 | struct smb_hdr hdr; /* wct = 2 */ | |
573 | __u8 AndXCommand; | |
574 | __u8 AndXReserved; | |
575 | __u16 AndXOffset; | |
576 | __u16 ByteCount; | |
577 | } LOGOFF_ANDX_REQ; | |
578 | ||
579 | typedef struct smb_com_logoff_andx_rsp { | |
580 | struct smb_hdr hdr; /* wct = 2 */ | |
581 | __u8 AndXCommand; | |
582 | __u8 AndXReserved; | |
583 | __u16 AndXOffset; | |
584 | __u16 ByteCount; | |
585 | } LOGOFF_ANDX_RSP; | |
586 | ||
587 | typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */ | |
588 | struct { | |
589 | struct smb_hdr hdr; /* wct = 0 */ | |
590 | __u16 ByteCount; /* bcc = 0 */ | |
591 | } req; | |
592 | struct { | |
593 | struct smb_hdr hdr; /* wct = 0 */ | |
594 | __u16 ByteCount; /* bcc = 0 */ | |
595 | } resp; | |
596 | } TREE_DISCONNECT; | |
597 | ||
598 | typedef struct smb_com_close_req { | |
599 | struct smb_hdr hdr; /* wct = 3 */ | |
600 | __u16 FileID; | |
601 | __u32 LastWriteTime; /* should be zero */ | |
602 | __u16 ByteCount; /* 0 */ | |
603 | } CLOSE_REQ; | |
604 | ||
605 | typedef struct smb_com_close_rsp { | |
606 | struct smb_hdr hdr; /* wct = 0 */ | |
607 | __u16 ByteCount; /* bct = 0 */ | |
608 | } CLOSE_RSP; | |
609 | ||
610 | typedef struct smb_com_findclose_req { | |
611 | struct smb_hdr hdr; /* wct = 1 */ | |
612 | __u16 FileID; | |
613 | __u16 ByteCount; /* 0 */ | |
614 | } FINDCLOSE_REQ; | |
615 | ||
616 | /* OpenFlags */ | |
617 | #define REQ_OPLOCK 0x00000002 | |
618 | #define REQ_BATCHOPLOCK 0x00000004 | |
619 | #define REQ_OPENDIRONLY 0x00000008 | |
620 | ||
621 | typedef struct smb_com_open_req { /* also handles create */ | |
622 | struct smb_hdr hdr; /* wct = 24 */ | |
623 | __u8 AndXCommand; | |
624 | __u8 AndXReserved; | |
625 | __le16 AndXOffset; | |
626 | __u8 Reserved; /* Must Be Zero */ | |
627 | __le16 NameLength; | |
628 | __le32 OpenFlags; | |
629 | __le32 RootDirectoryFid; | |
630 | __le32 DesiredAccess; | |
631 | __le64 AllocationSize; | |
632 | __le32 FileAttributes; | |
633 | __le32 ShareAccess; | |
634 | __le32 CreateDisposition; | |
635 | __le32 CreateOptions; | |
636 | __le32 ImpersonationLevel; | |
637 | __u8 SecurityFlags; | |
638 | __le16 ByteCount; | |
639 | char fileName[1]; | |
640 | } OPEN_REQ; | |
641 | ||
642 | /* open response: oplock levels */ | |
643 | #define OPLOCK_NONE 0 | |
644 | #define OPLOCK_EXCLUSIVE 1 | |
645 | #define OPLOCK_BATCH 2 | |
646 | #define OPLOCK_READ 3 /* level 2 oplock */ | |
647 | ||
648 | /* open response for CreateAction shifted left */ | |
649 | #define CIFS_CREATE_ACTION 0x20000 /* file created */ | |
650 | ||
651 | typedef struct smb_com_open_rsp { | |
652 | struct smb_hdr hdr; /* wct = 34 BB */ | |
653 | __u8 AndXCommand; | |
654 | __u8 AndXReserved; | |
655 | __le16 AndXOffset; | |
656 | __u8 OplockLevel; | |
657 | __u16 Fid; | |
658 | __le32 CreateAction; | |
659 | __le64 CreationTime; | |
660 | __le64 LastAccessTime; | |
661 | __le64 LastWriteTime; | |
662 | __le64 ChangeTime; | |
663 | __le32 FileAttributes; | |
664 | __le64 AllocationSize; | |
665 | __le64 EndOfFile; | |
666 | __le16 FileType; | |
667 | __le16 DeviceState; | |
668 | __u8 DirectoryFlag; | |
669 | __u16 ByteCount; /* bct = 0 */ | |
670 | } OPEN_RSP; | |
671 | ||
672 | typedef struct smb_com_write_req { | |
673 | struct smb_hdr hdr; /* wct = 14 */ | |
674 | __u8 AndXCommand; | |
675 | __u8 AndXReserved; | |
676 | __le16 AndXOffset; | |
677 | __u16 Fid; | |
678 | __le32 OffsetLow; | |
679 | __u32 Reserved; | |
680 | __le16 WriteMode; | |
681 | __le16 Remaining; | |
682 | __le16 DataLengthHigh; | |
683 | __le16 DataLengthLow; | |
684 | __le16 DataOffset; | |
685 | __le32 OffsetHigh; | |
686 | __le16 ByteCount; | |
687 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ | |
688 | char Data[0]; | |
689 | } WRITE_REQ; | |
690 | ||
691 | typedef struct smb_com_write_rsp { | |
692 | struct smb_hdr hdr; /* wct = 6 */ | |
693 | __u8 AndXCommand; | |
694 | __u8 AndXReserved; | |
695 | __le16 AndXOffset; | |
696 | __le16 Count; | |
697 | __le16 Remaining; | |
698 | __le16 CountHigh; | |
699 | __u16 Reserved; | |
700 | __u16 ByteCount; | |
701 | } WRITE_RSP; | |
702 | ||
703 | typedef struct smb_com_read_req { | |
704 | struct smb_hdr hdr; /* wct = 12 */ | |
705 | __u8 AndXCommand; | |
706 | __u8 AndXReserved; | |
707 | __le16 AndXOffset; | |
708 | __u16 Fid; | |
709 | __le32 OffsetLow; | |
710 | __le16 MaxCount; | |
711 | __le16 MinCount; /* obsolete */ | |
712 | __le32 MaxCountHigh; | |
713 | __le16 Remaining; | |
714 | __le32 OffsetHigh; | |
715 | __le16 ByteCount; | |
716 | } READ_REQ; | |
717 | ||
718 | typedef struct smb_com_read_rsp { | |
719 | struct smb_hdr hdr; /* wct = 12 */ | |
720 | __u8 AndXCommand; | |
721 | __u8 AndXReserved; | |
722 | __le16 AndXOffset; | |
723 | __le16 Remaining; | |
724 | __le16 DataCompactionMode; | |
725 | __le16 Reserved; | |
726 | __le16 DataLength; | |
727 | __le16 DataOffset; | |
728 | __le16 DataLengthHigh; | |
729 | __u64 Reserved2; | |
730 | __u16 ByteCount; | |
731 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ | |
732 | char Data[1]; | |
733 | } READ_RSP; | |
734 | ||
735 | typedef struct locking_andx_range { | |
736 | __le16 Pid; | |
737 | __le16 Pad; | |
738 | __le32 OffsetHigh; | |
739 | __le32 OffsetLow; | |
740 | __le32 LengthHigh; | |
741 | __le32 LengthLow; | |
742 | } LOCKING_ANDX_RANGE; | |
743 | ||
744 | #define LOCKING_ANDX_SHARED_LOCK 0x01 | |
745 | #define LOCKING_ANDX_OPLOCK_RELEASE 0x02 | |
746 | #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 | |
747 | #define LOCKING_ANDX_CANCEL_LOCK 0x08 | |
748 | #define LOCKING_ANDX_LARGE_FILES 0x10 /* always on for us */ | |
749 | ||
750 | typedef struct smb_com_lock_req { | |
751 | struct smb_hdr hdr; /* wct = 8 */ | |
752 | __u8 AndXCommand; | |
753 | __u8 AndXReserved; | |
754 | __le16 AndXOffset; | |
755 | __u16 Fid; | |
756 | __u8 LockType; | |
757 | __u8 OplockLevel; | |
758 | __le32 Timeout; | |
759 | __le16 NumberOfUnlocks; | |
760 | __le16 NumberOfLocks; | |
761 | __le16 ByteCount; | |
762 | LOCKING_ANDX_RANGE Locks[1]; | |
763 | } LOCK_REQ; | |
764 | ||
f654bac2 SF |
765 | |
766 | typedef struct cifs_posix_lock { | |
767 | __le16 lock_type; /* 0 = Read, 1 = Write, 2 = Unlock */ | |
768 | __le16 lock_flags; /* 1 = Wait (only valid for setlock) */ | |
769 | __le32 pid; | |
770 | __le64 start; | |
771 | __le64 length; | |
772 | /* BB what about additional owner info to identify network client */ | |
773 | } CIFS_POSIX_LOCK; | |
774 | ||
1da177e4 LT |
775 | typedef struct smb_com_lock_rsp { |
776 | struct smb_hdr hdr; /* wct = 2 */ | |
777 | __u8 AndXCommand; | |
778 | __u8 AndXReserved; | |
779 | __le16 AndXOffset; | |
780 | __u16 ByteCount; | |
781 | } LOCK_RSP; | |
782 | ||
783 | typedef struct smb_com_rename_req { | |
784 | struct smb_hdr hdr; /* wct = 1 */ | |
785 | __le16 SearchAttributes; /* target file attributes */ | |
786 | __le16 ByteCount; | |
787 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ | |
788 | unsigned char OldFileName[1]; | |
789 | /* followed by __u8 BufferFormat2 */ | |
790 | /* followed by NewFileName */ | |
791 | } RENAME_REQ; | |
792 | ||
793 | /* copy request flags */ | |
794 | #define COPY_MUST_BE_FILE 0x0001 | |
795 | #define COPY_MUST_BE_DIR 0x0002 | |
796 | #define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ | |
797 | #define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ | |
798 | #define COPY_VERIFY_WRITES 0x0010 | |
799 | #define COPY_TREE 0x0020 | |
800 | ||
801 | typedef struct smb_com_copy_req { | |
802 | struct smb_hdr hdr; /* wct = 3 */ | |
803 | __u16 Tid2; | |
804 | __le16 OpenFunction; | |
805 | __le16 Flags; | |
806 | __le16 ByteCount; | |
807 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ | |
808 | unsigned char OldFileName[1]; | |
809 | /* followed by __u8 BufferFormat2 */ | |
810 | /* followed by NewFileName string */ | |
811 | } COPY_REQ; | |
812 | ||
813 | typedef struct smb_com_copy_rsp { | |
814 | struct smb_hdr hdr; /* wct = 1 */ | |
815 | __le16 CopyCount; /* number of files copied */ | |
816 | __u16 ByteCount; /* may be zero */ | |
817 | __u8 BufferFormat; /* 0x04 - only present if errored file follows */ | |
818 | unsigned char ErrorFileName[1]; /* only present if error in copy */ | |
819 | } COPY_RSP; | |
820 | ||
821 | #define CREATE_HARD_LINK 0x103 | |
822 | #define MOVEFILE_COPY_ALLOWED 0x0002 | |
823 | #define MOVEFILE_REPLACE_EXISTING 0x0001 | |
824 | ||
825 | typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ | |
826 | struct smb_hdr hdr; /* wct = 4 */ | |
827 | __le16 SearchAttributes; /* target file attributes */ | |
828 | __le16 Flags; /* spec says Information Level */ | |
829 | __le32 ClusterCount; | |
830 | __le16 ByteCount; | |
831 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ | |
832 | unsigned char OldFileName[1]; | |
833 | /* followed by __u8 BufferFormat2 */ | |
834 | /* followed by NewFileName */ | |
835 | } NT_RENAME_REQ; | |
836 | ||
837 | typedef struct smb_com_rename_rsp { | |
838 | struct smb_hdr hdr; /* wct = 0 */ | |
839 | __u16 ByteCount; /* bct = 0 */ | |
840 | } RENAME_RSP; | |
841 | ||
842 | typedef struct smb_com_delete_file_req { | |
843 | struct smb_hdr hdr; /* wct = 1 */ | |
844 | __le16 SearchAttributes; | |
845 | __le16 ByteCount; | |
846 | __u8 BufferFormat; /* 4 = ASCII */ | |
847 | unsigned char fileName[1]; | |
848 | } DELETE_FILE_REQ; | |
849 | ||
850 | typedef struct smb_com_delete_file_rsp { | |
851 | struct smb_hdr hdr; /* wct = 0 */ | |
852 | __u16 ByteCount; /* bct = 0 */ | |
853 | } DELETE_FILE_RSP; | |
854 | ||
855 | typedef struct smb_com_delete_directory_req { | |
856 | struct smb_hdr hdr; /* wct = 0 */ | |
857 | __le16 ByteCount; | |
858 | __u8 BufferFormat; /* 4 = ASCII */ | |
859 | unsigned char DirName[1]; | |
860 | } DELETE_DIRECTORY_REQ; | |
861 | ||
862 | typedef struct smb_com_delete_directory_rsp { | |
863 | struct smb_hdr hdr; /* wct = 0 */ | |
864 | __u16 ByteCount; /* bct = 0 */ | |
865 | } DELETE_DIRECTORY_RSP; | |
866 | ||
867 | typedef struct smb_com_create_directory_req { | |
868 | struct smb_hdr hdr; /* wct = 0 */ | |
869 | __le16 ByteCount; | |
870 | __u8 BufferFormat; /* 4 = ASCII */ | |
871 | unsigned char DirName[1]; | |
872 | } CREATE_DIRECTORY_REQ; | |
873 | ||
874 | typedef struct smb_com_create_directory_rsp { | |
875 | struct smb_hdr hdr; /* wct = 0 */ | |
876 | __u16 ByteCount; /* bct = 0 */ | |
877 | } CREATE_DIRECTORY_RSP; | |
878 | ||
879 | typedef struct smb_com_setattr_req { | |
880 | struct smb_hdr hdr; /* wct = 8 */ | |
881 | __le16 attr; | |
882 | __le16 time_low; | |
883 | __le16 time_high; | |
884 | __le16 reserved[5]; /* must be zero */ | |
885 | __u16 ByteCount; | |
886 | __u8 BufferFormat; /* 4 = ASCII */ | |
887 | unsigned char fileName[1]; | |
888 | } SETATTR_REQ; | |
889 | ||
890 | typedef struct smb_com_setattr_rsp { | |
891 | struct smb_hdr hdr; /* wct = 0 */ | |
892 | __u16 ByteCount; /* bct = 0 */ | |
893 | } SETATTR_RSP; | |
894 | ||
895 | /* empty wct response to setattr */ | |
896 | ||
897 | /***************************************************/ | |
898 | /* NT Transact structure defintions follow */ | |
899 | /* Currently only ioctl and notify are implemented */ | |
900 | /***************************************************/ | |
901 | typedef struct smb_com_transaction_ioctl_req { | |
902 | struct smb_hdr hdr; /* wct = 23 */ | |
903 | __u8 MaxSetupCount; | |
904 | __u16 Reserved; | |
905 | __le32 TotalParameterCount; | |
906 | __le32 TotalDataCount; | |
907 | __le32 MaxParameterCount; | |
908 | __le32 MaxDataCount; | |
909 | __le32 ParameterCount; | |
910 | __le32 ParameterOffset; | |
911 | __le32 DataCount; | |
912 | __le32 DataOffset; | |
913 | __u8 SetupCount; /* four setup words follow subcommand */ | |
914 | /* SNIA spec incorrectly included spurious pad here */ | |
915 | __le16 SubCommand;/* 2 = IOCTL/FSCTL */ | |
916 | __le32 FunctionCode; | |
917 | __u16 Fid; | |
918 | __u8 IsFsctl; /* 1 = File System Control, 0 = device control (IOCTL)*/ | |
919 | __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/ | |
920 | __le16 ByteCount; | |
921 | __u8 Pad[3]; | |
922 | __u8 Data[1]; | |
923 | } TRANSACT_IOCTL_REQ; | |
924 | ||
925 | typedef struct smb_com_transaction_ioctl_rsp { | |
926 | struct smb_hdr hdr; /* wct = 19 */ | |
927 | __u8 Reserved[3]; | |
928 | __le32 TotalParameterCount; | |
929 | __le32 TotalDataCount; | |
930 | __le32 ParameterCount; | |
931 | __le32 ParameterOffset; | |
932 | __le32 ParameterDisplacement; | |
933 | __le32 DataCount; | |
934 | __le32 DataOffset; | |
935 | __le32 DataDisplacement; | |
936 | __u8 SetupCount; /* 1 */ | |
937 | __le16 ReturnedDataLen; | |
938 | __u16 ByteCount; | |
939 | __u8 Pad[3]; | |
940 | } TRANSACT_IOCTL_RSP; | |
941 | ||
942 | typedef struct smb_com_transaction_change_notify_req { | |
943 | struct smb_hdr hdr; /* wct = 23 */ | |
944 | __u8 MaxSetupCount; | |
945 | __u16 Reserved; | |
946 | __le32 TotalParameterCount; | |
947 | __le32 TotalDataCount; | |
948 | __le32 MaxParameterCount; | |
949 | __le32 MaxDataCount; | |
950 | __le32 ParameterCount; | |
951 | __le32 ParameterOffset; | |
952 | __le32 DataCount; | |
953 | __le32 DataOffset; | |
954 | __u8 SetupCount; /* four setup words follow subcommand */ | |
955 | /* SNIA spec incorrectly included spurious pad here */ | |
956 | __le16 SubCommand;/* 4 = Change Notify */ | |
957 | __le32 CompletionFilter; /* operation to monitor */ | |
958 | __u16 Fid; | |
959 | __u8 WatchTree; /* 1 = Monitor subdirectories */ | |
960 | __u8 Reserved2; | |
961 | __le16 ByteCount; | |
962 | /* __u8 Pad[3];*/ | |
963 | /* __u8 Data[1];*/ | |
964 | } TRANSACT_CHANGE_NOTIFY_REQ; | |
965 | ||
966 | typedef struct smb_com_transaction_change_notify_rsp { | |
967 | struct smb_hdr hdr; /* wct = 18 */ | |
968 | __u8 Reserved[3]; | |
969 | __le32 TotalParameterCount; | |
970 | __le32 TotalDataCount; | |
971 | __le32 ParameterCount; | |
972 | __le32 ParameterOffset; | |
973 | __le32 ParameterDisplacement; | |
974 | __le32 DataCount; | |
975 | __le32 DataOffset; | |
976 | __le32 DataDisplacement; | |
977 | __u8 SetupCount; /* 0 */ | |
978 | __u16 ByteCount; | |
979 | /* __u8 Pad[3]; */ | |
980 | } TRANSACT_CHANGE_NOTIFY_RSP; | |
981 | /* Completion Filter flags for Notify */ | |
982 | #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 | |
983 | #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 | |
984 | #define FILE_NOTIFY_CHANGE_NAME 0x00000003 | |
985 | #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 | |
986 | #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 | |
987 | #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 | |
988 | #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 | |
989 | #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 | |
990 | #define FILE_NOTIFY_CHANGE_EA 0x00000080 | |
991 | #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 | |
992 | #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 | |
993 | #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 | |
994 | #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 | |
995 | ||
996 | #define FILE_ACTION_ADDED 0x00000001 | |
997 | #define FILE_ACTION_REMOVED 0x00000002 | |
998 | #define FILE_ACTION_MODIFIED 0x00000003 | |
999 | #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 | |
1000 | #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 | |
1001 | #define FILE_ACTION_ADDED_STREAM 0x00000006 | |
1002 | #define FILE_ACTION_REMOVED_STREAM 0x00000007 | |
1003 | #define FILE_ACTION_MODIFIED_STREAM 0x00000008 | |
1004 | ||
1005 | /* response contains array of the following structures */ | |
1006 | struct file_notify_information { | |
1007 | __le32 NextEntryOffset; | |
1008 | __le32 Action; | |
1009 | __le32 FileNameLength; | |
1010 | __u8 FileName[0]; | |
1011 | }; | |
1012 | ||
1013 | struct reparse_data { | |
1014 | __u32 ReparseTag; | |
1015 | __u16 ReparseDataLength; | |
1016 | __u16 Reserved; | |
1017 | __u16 AltNameOffset; | |
1018 | __u16 AltNameLen; | |
1019 | __u16 TargetNameOffset; | |
1020 | __u16 TargetNameLen; | |
1021 | char LinkNamesBuf[1]; | |
1022 | }; | |
1023 | ||
1024 | struct cifs_quota_data { | |
1025 | __u32 rsrvd1; /* 0 */ | |
1026 | __u32 sid_size; | |
1027 | __u64 rsrvd2; /* 0 */ | |
1028 | __u64 space_used; | |
1029 | __u64 soft_limit; | |
1030 | __u64 hard_limit; | |
1031 | char sid[1]; /* variable size? */ | |
1032 | }; | |
1033 | ||
1034 | /* quota sub commands */ | |
1035 | #define QUOTA_LIST_CONTINUE 0 | |
1036 | #define QUOTA_LIST_START 0x100 | |
1037 | #define QUOTA_FOR_SID 0x101 | |
1038 | ||
1039 | struct trans2_req { | |
1040 | /* struct smb_hdr hdr precedes. Set wct = 14+ */ | |
1041 | __le16 TotalParameterCount; | |
1042 | __le16 TotalDataCount; | |
1043 | __le16 MaxParameterCount; | |
1044 | __le16 MaxDataCount; | |
1045 | __u8 MaxSetupCount; | |
1046 | __u8 Reserved; | |
1047 | __le16 Flags; | |
1048 | __le32 Timeout; | |
1049 | __u16 Reserved2; | |
1050 | __le16 ParameterCount; | |
1051 | __le16 ParameterOffset; | |
1052 | __le16 DataCount; | |
1053 | __le16 DataOffset; | |
1054 | __u8 SetupCount; | |
1055 | __u8 Reserved3; | |
1056 | __le16 SubCommand; /* 1st setup word - SetupCount words follow */ | |
1057 | __le16 ByteCount; | |
1058 | }; | |
1059 | ||
1060 | struct smb_t2_req { | |
1061 | struct smb_hdr hdr; | |
1062 | struct trans2_req t2_req; | |
1063 | }; | |
1064 | ||
1065 | struct trans2_resp { | |
1066 | /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */ | |
1067 | __le16 TotalParameterCount; | |
1068 | __le16 TotalDataCount; | |
1069 | __u16 Reserved; | |
1070 | __le16 ParameterCount; | |
1071 | __le16 ParameterOffset; | |
1072 | __le16 ParameterDisplacement; | |
1073 | __le16 DataCount; | |
1074 | __le16 DataOffset; | |
1075 | __le16 DataDisplacement; | |
1076 | __u8 SetupCount; | |
1077 | __u8 Reserved1; | |
1078 | /* SetupWords[SetupCount]; | |
1079 | __u16 ByteCount; | |
1080 | __u16 Reserved2;*/ | |
1081 | /* data area follows */ | |
1082 | }; | |
1083 | ||
1084 | struct smb_t2_rsp { | |
1085 | struct smb_hdr hdr; | |
1086 | struct trans2_resp t2_rsp; | |
1087 | }; | |
1088 | ||
1089 | /* PathInfo/FileInfo infolevels */ | |
1090 | #define SMB_INFO_STANDARD 1 | |
1091 | #define SMB_SET_FILE_EA 2 | |
1092 | #define SMB_QUERY_FILE_EA_SIZE 2 | |
1093 | #define SMB_INFO_QUERY_EAS_FROM_LIST 3 | |
1094 | #define SMB_INFO_QUERY_ALL_EAS 4 | |
1095 | #define SMB_INFO_IS_NAME_VALID 6 | |
1096 | #define SMB_QUERY_FILE_BASIC_INFO 0x101 | |
1097 | #define SMB_QUERY_FILE_STANDARD_INFO 0x102 | |
1098 | #define SMB_QUERY_FILE_EA_INFO 0x103 | |
1099 | #define SMB_QUERY_FILE_NAME_INFO 0x104 | |
1100 | #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 | |
1101 | #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 | |
1102 | #define SMB_QUERY_FILE_ALL_INFO 0x107 | |
1103 | #define SMB_QUERY_ALT_NAME_INFO 0x108 | |
1104 | #define SMB_QUERY_FILE_STREAM_INFO 0x109 | |
1105 | #define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B | |
1106 | #define SMB_QUERY_FILE_UNIX_BASIC 0x200 | |
1107 | #define SMB_QUERY_FILE_UNIX_LINK 0x201 | |
1108 | #define SMB_QUERY_POSIX_ACL 0x204 | |
1109 | #define SMB_QUERY_XATTR 0x205 | |
1110 | #define SMB_QUERY_ATTR_FLAGS 0x206 /* append,immutable etc. */ | |
f654bac2 SF |
1111 | #define SMB_QUERY_POSIX_PERMISSION 0x207 |
1112 | #define SMB_QUERY_POSIX_LOCK 0x208 | |
1da177e4 LT |
1113 | #define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee |
1114 | #define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 | |
1115 | #define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ | |
1116 | #define SMB_QUERY_FILE_POSITION_INFO 0x3f6 | |
1117 | #define SMB_QUERY_FILE_MODE_INFO 0x3f8 | |
1118 | #define SMB_QUERY_FILE_ALGN_INFO 0x3f9 | |
1119 | ||
1120 | ||
1121 | #define SMB_SET_FILE_BASIC_INFO 0x101 | |
1122 | #define SMB_SET_FILE_DISPOSITION_INFO 0x102 | |
1123 | #define SMB_SET_FILE_ALLOCATION_INFO 0x103 | |
1124 | #define SMB_SET_FILE_END_OF_FILE_INFO 0x104 | |
1125 | #define SMB_SET_FILE_UNIX_BASIC 0x200 | |
1126 | #define SMB_SET_FILE_UNIX_LINK 0x201 | |
1127 | #define SMB_SET_FILE_UNIX_HLINK 0x203 | |
1128 | #define SMB_SET_POSIX_ACL 0x204 | |
1129 | #define SMB_SET_XATTR 0x205 | |
1130 | #define SMB_SET_ATTR_FLAGS 0x206 /* append, immutable etc. */ | |
f654bac2 | 1131 | #define SMB_SET_POSIX_LOCK 0x208 |
1da177e4 LT |
1132 | #define SMB_SET_FILE_BASIC_INFO2 0x3ec |
1133 | #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo level too */ | |
1134 | #define SMB_FILE_ALL_INFO2 0x3fa | |
1135 | #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb | |
1136 | #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc | |
1137 | #define SMB_FILE_MOVE_CLUSTER_INFO 0x407 | |
1138 | #define SMB_FILE_QUOTA_INFO 0x408 | |
1139 | #define SMB_FILE_REPARSEPOINT_INFO 0x409 | |
1140 | #define SMB_FILE_MAXIMUM_INFO 0x40d | |
1141 | ||
1142 | /* Find File infolevels */ | |
1143 | #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 | |
1144 | #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 | |
1145 | #define SMB_FIND_FILE_NAMES_INFO 0x103 | |
1146 | #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 | |
1147 | #define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105 | |
1148 | #define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106 | |
1149 | #define SMB_FIND_FILE_UNIX 0x202 | |
1150 | ||
1151 | typedef struct smb_com_transaction2_qpi_req { | |
1152 | struct smb_hdr hdr; /* wct = 14+ */ | |
1153 | __le16 TotalParameterCount; | |
1154 | __le16 TotalDataCount; | |
1155 | __le16 MaxParameterCount; | |
1156 | __le16 MaxDataCount; | |
1157 | __u8 MaxSetupCount; | |
1158 | __u8 Reserved; | |
1159 | __le16 Flags; | |
1160 | __le32 Timeout; | |
1161 | __u16 Reserved2; | |
1162 | __le16 ParameterCount; | |
1163 | __le16 ParameterOffset; | |
1164 | __le16 DataCount; | |
1165 | __le16 DataOffset; | |
1166 | __u8 SetupCount; | |
1167 | __u8 Reserved3; | |
1168 | __le16 SubCommand; /* one setup word */ | |
1169 | __le16 ByteCount; | |
1170 | __u8 Pad; | |
1171 | __le16 InformationLevel; | |
1172 | __u32 Reserved4; | |
1173 | char FileName[1]; | |
1174 | } TRANSACTION2_QPI_REQ; | |
1175 | ||
1176 | typedef struct smb_com_transaction2_qpi_rsp { | |
1177 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | |
1178 | struct trans2_resp t2; | |
1179 | __u16 ByteCount; | |
1180 | __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ | |
1181 | } TRANSACTION2_QPI_RSP; | |
1182 | ||
1183 | typedef struct smb_com_transaction2_spi_req { | |
1184 | struct smb_hdr hdr; /* wct = 15 */ | |
1185 | __le16 TotalParameterCount; | |
1186 | __le16 TotalDataCount; | |
1187 | __le16 MaxParameterCount; | |
1188 | __le16 MaxDataCount; | |
1189 | __u8 MaxSetupCount; | |
1190 | __u8 Reserved; | |
1191 | __le16 Flags; | |
1192 | __le32 Timeout; | |
1193 | __u16 Reserved2; | |
1194 | __le16 ParameterCount; | |
1195 | __le16 ParameterOffset; | |
1196 | __le16 DataCount; | |
1197 | __le16 DataOffset; | |
1198 | __u8 SetupCount; | |
1199 | __u8 Reserved3; | |
1200 | __le16 SubCommand; /* one setup word */ | |
1201 | __le16 ByteCount; | |
1202 | __u8 Pad; | |
1203 | __u16 Pad1; | |
1204 | __le16 InformationLevel; | |
1205 | __u32 Reserved4; | |
1206 | char FileName[1]; | |
1207 | } TRANSACTION2_SPI_REQ; | |
1208 | ||
1209 | typedef struct smb_com_transaction2_spi_rsp { | |
1210 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | |
1211 | struct trans2_resp t2; | |
1212 | __u16 ByteCount; | |
1213 | __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ | |
1214 | } TRANSACTION2_SPI_RSP; | |
1215 | ||
1216 | struct set_file_rename { | |
1217 | __le32 overwrite; /* 1 = overwrite dest */ | |
1218 | __u32 root_fid; /* zero */ | |
1219 | __le32 target_name_len; | |
1220 | char target_name[0]; /* Must be unicode */ | |
1221 | }; | |
1222 | ||
1223 | struct smb_com_transaction2_sfi_req { | |
1224 | struct smb_hdr hdr; /* wct = 15 */ | |
1225 | __le16 TotalParameterCount; | |
1226 | __le16 TotalDataCount; | |
1227 | __le16 MaxParameterCount; | |
1228 | __le16 MaxDataCount; | |
1229 | __u8 MaxSetupCount; | |
1230 | __u8 Reserved; | |
1231 | __le16 Flags; | |
1232 | __le32 Timeout; | |
1233 | __u16 Reserved2; | |
1234 | __le16 ParameterCount; | |
1235 | __le16 ParameterOffset; | |
1236 | __le16 DataCount; | |
1237 | __le16 DataOffset; | |
1238 | __u8 SetupCount; | |
1239 | __u8 Reserved3; | |
1240 | __le16 SubCommand; /* one setup word */ | |
1241 | __le16 ByteCount; | |
1242 | __u8 Pad; | |
1243 | __u16 Pad1; | |
1244 | __u16 Fid; | |
1245 | __le16 InformationLevel; | |
1246 | __u16 Reserved4; | |
1247 | }; | |
1248 | ||
1249 | struct smb_com_transaction2_sfi_rsp { | |
1250 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | |
1251 | struct trans2_resp t2; | |
1252 | __u16 ByteCount; | |
f654bac2 SF |
1253 | __u16 Reserved2; /* parameter word reserved - |
1254 | present for infolevels > 100 */ | |
1255 | }; | |
1256 | ||
1257 | struct smb_t2_qfi_req { | |
1258 | struct smb_hdr hdr; | |
1259 | struct trans2_req t2; | |
1260 | __u8 Pad; | |
f654bac2 SF |
1261 | __u16 Fid; |
1262 | __le16 InformationLevel; | |
1da177e4 LT |
1263 | }; |
1264 | ||
f654bac2 SF |
1265 | struct smb_t2_qfi_rsp { |
1266 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | |
1267 | struct trans2_resp t2; | |
1268 | __u16 ByteCount; | |
1269 | __u16 Reserved2; /* parameter word reserved - | |
1270 | present for infolevels > 100 */ | |
1271 | }; | |
1da177e4 LT |
1272 | |
1273 | /* | |
1274 | * Flags on T2 FINDFIRST and FINDNEXT | |
1275 | */ | |
1276 | #define CIFS_SEARCH_CLOSE_ALWAYS 0x0001 | |
1277 | #define CIFS_SEARCH_CLOSE_AT_END 0x0002 | |
1278 | #define CIFS_SEARCH_RETURN_RESUME 0x0004 | |
1279 | #define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008 | |
1280 | #define CIFS_SEARCH_BACKUP_SEARCH 0x0010 | |
1281 | ||
1282 | /* | |
1283 | * Size of the resume key on FINDFIRST and FINDNEXT calls | |
1284 | */ | |
1285 | #define CIFS_SMB_RESUME_KEY_SIZE 4 | |
1286 | ||
1287 | typedef struct smb_com_transaction2_ffirst_req { | |
1288 | struct smb_hdr hdr; /* wct = 15 */ | |
1289 | __le16 TotalParameterCount; | |
1290 | __le16 TotalDataCount; | |
1291 | __le16 MaxParameterCount; | |
1292 | __le16 MaxDataCount; | |
1293 | __u8 MaxSetupCount; | |
1294 | __u8 Reserved; | |
1295 | __le16 Flags; | |
1296 | __le32 Timeout; | |
1297 | __u16 Reserved2; | |
1298 | __le16 ParameterCount; | |
1299 | __le16 ParameterOffset; | |
1300 | __le16 DataCount; | |
1301 | __le16 DataOffset; | |
1302 | __u8 SetupCount; /* one */ | |
1303 | __u8 Reserved3; | |
1304 | __le16 SubCommand; /* TRANS2_FIND_FIRST */ | |
1305 | __le16 ByteCount; | |
1306 | __u8 Pad; | |
1307 | __le16 SearchAttributes; | |
1308 | __le16 SearchCount; | |
1309 | __le16 SearchFlags; | |
1310 | __le16 InformationLevel; | |
1311 | __le32 SearchStorageType; | |
1312 | char FileName[1]; | |
1313 | } TRANSACTION2_FFIRST_REQ; | |
1314 | ||
1315 | typedef struct smb_com_transaction2_ffirst_rsp { | |
1316 | struct smb_hdr hdr; /* wct = 10 */ | |
1317 | struct trans2_resp t2; | |
1318 | __u16 ByteCount; | |
1319 | } TRANSACTION2_FFIRST_RSP; | |
1320 | ||
1321 | typedef struct smb_com_transaction2_ffirst_rsp_parms { | |
1322 | __u16 SearchHandle; | |
1323 | __le16 SearchCount; | |
1324 | __le16 EndofSearch; | |
1325 | __le16 EAErrorOffset; | |
1326 | __le16 LastNameOffset; | |
1327 | } T2_FFIRST_RSP_PARMS; | |
1328 | ||
1329 | typedef struct smb_com_transaction2_fnext_req { | |
1330 | struct smb_hdr hdr; /* wct = 15 */ | |
1331 | __le16 TotalParameterCount; | |
1332 | __le16 TotalDataCount; | |
1333 | __le16 MaxParameterCount; | |
1334 | __le16 MaxDataCount; | |
1335 | __u8 MaxSetupCount; | |
1336 | __u8 Reserved; | |
1337 | __le16 Flags; | |
1338 | __le32 Timeout; | |
1339 | __u16 Reserved2; | |
1340 | __le16 ParameterCount; | |
1341 | __le16 ParameterOffset; | |
1342 | __le16 DataCount; | |
1343 | __le16 DataOffset; | |
1344 | __u8 SetupCount; /* one */ | |
1345 | __u8 Reserved3; | |
1346 | __le16 SubCommand; /* TRANS2_FIND_NEXT */ | |
1347 | __le16 ByteCount; | |
1348 | __u8 Pad; | |
1349 | __u16 SearchHandle; | |
1350 | __le16 SearchCount; | |
1351 | __le16 InformationLevel; | |
1352 | __u32 ResumeKey; | |
1353 | __le16 SearchFlags; | |
1354 | char ResumeFileName[1]; | |
1355 | } TRANSACTION2_FNEXT_REQ; | |
1356 | ||
1357 | typedef struct smb_com_transaction2_fnext_rsp { | |
1358 | struct smb_hdr hdr; /* wct = 10 */ | |
1359 | struct trans2_resp t2; | |
1360 | __u16 ByteCount; | |
1361 | } TRANSACTION2_FNEXT_RSP; | |
1362 | ||
1363 | typedef struct smb_com_transaction2_fnext_rsp_parms { | |
1364 | __le16 SearchCount; | |
1365 | __le16 EndofSearch; | |
1366 | __le16 EAErrorOffset; | |
1367 | __le16 LastNameOffset; | |
1368 | } T2_FNEXT_RSP_PARMS; | |
1369 | ||
1370 | /* QFSInfo Levels */ | |
1371 | #define SMB_INFO_ALLOCATION 1 | |
1372 | #define SMB_INFO_VOLUME 2 | |
1373 | #define SMB_QUERY_FS_VOLUME_INFO 0x102 | |
1374 | #define SMB_QUERY_FS_SIZE_INFO 0x103 | |
1375 | #define SMB_QUERY_FS_DEVICE_INFO 0x104 | |
1376 | #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 | |
1377 | #define SMB_QUERY_CIFS_UNIX_INFO 0x200 | |
1378 | #define SMB_QUERY_POSIX_FS_INFO 0x201 | |
1379 | #define SMB_QUERY_LABEL_INFO 0x3ea | |
1380 | #define SMB_QUERY_FS_QUOTA_INFO 0x3ee | |
1381 | #define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef | |
1382 | #define SMB_QUERY_OBJECTID_INFO 0x3f0 | |
1383 | ||
1384 | typedef struct smb_com_transaction2_qfsi_req { | |
1385 | struct smb_hdr hdr; /* wct = 14+ */ | |
1386 | __le16 TotalParameterCount; | |
1387 | __le16 TotalDataCount; | |
1388 | __le16 MaxParameterCount; | |
1389 | __le16 MaxDataCount; | |
1390 | __u8 MaxSetupCount; | |
1391 | __u8 Reserved; | |
1392 | __le16 Flags; | |
1393 | __le32 Timeout; | |
1394 | __u16 Reserved2; | |
1395 | __le16 ParameterCount; | |
1396 | __le16 ParameterOffset; | |
1397 | __le16 DataCount; | |
1398 | __le16 DataOffset; | |
1399 | __u8 SetupCount; | |
1400 | __u8 Reserved3; | |
1401 | __le16 SubCommand; /* one setup word */ | |
1402 | __le16 ByteCount; | |
1403 | __u8 Pad; | |
1404 | __le16 InformationLevel; | |
1405 | } TRANSACTION2_QFSI_REQ; | |
1406 | ||
1407 | typedef struct smb_com_transaction_qfsi_rsp { | |
1408 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ | |
1409 | struct trans2_resp t2; | |
1410 | __u16 ByteCount; | |
1411 | __u8 Pad; /* may be three bytes *//* followed by data area */ | |
1412 | } TRANSACTION2_QFSI_RSP; | |
1413 | ||
1414 | typedef struct smb_com_transaction2_get_dfs_refer_req { | |
1415 | struct smb_hdr hdr; /* wct = 15 */ | |
1416 | __le16 TotalParameterCount; | |
1417 | __le16 TotalDataCount; | |
1418 | __le16 MaxParameterCount; | |
1419 | __le16 MaxDataCount; | |
1420 | __u8 MaxSetupCount; | |
1421 | __u8 Reserved; | |
1422 | __le16 Flags; | |
1423 | __le32 Timeout; | |
1424 | __u16 Reserved2; | |
1425 | __le16 ParameterCount; | |
1426 | __le16 ParameterOffset; | |
1427 | __le16 DataCount; | |
1428 | __le16 DataOffset; | |
1429 | __u8 SetupCount; | |
1430 | __u8 Reserved3; | |
1431 | __le16 SubCommand; /* one setup word */ | |
1432 | __le16 ByteCount; | |
1433 | __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ | |
1434 | __le16 MaxReferralLevel; | |
1435 | char RequestFileName[1]; | |
1436 | } TRANSACTION2_GET_DFS_REFER_REQ; | |
1437 | ||
1438 | typedef struct dfs_referral_level_3 { | |
1439 | __le16 VersionNumber; | |
1440 | __le16 ReferralSize; | |
1441 | __le16 ServerType; /* 0x0001 = CIFS server */ | |
1442 | __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ | |
1443 | __le16 TimeToLive; | |
1444 | __le16 Proximity; | |
1445 | __le16 DfsPathOffset; | |
1446 | __le16 DfsAlternatePathOffset; | |
1447 | __le16 NetworkAddressOffset; | |
1448 | } REFERRAL3; | |
1449 | ||
1450 | typedef struct smb_com_transaction_get_dfs_refer_rsp { | |
1451 | struct smb_hdr hdr; /* wct = 10 */ | |
1452 | struct trans2_resp t2; | |
1453 | __u16 ByteCount; | |
1454 | __u8 Pad; | |
1455 | __le16 PathConsumed; | |
1456 | __le16 NumberOfReferrals; | |
1457 | __le16 DFSFlags; | |
1458 | __u16 Pad2; | |
1459 | REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ | |
1460 | /* followed by the strings pointed to by the referral structures */ | |
1461 | } TRANSACTION2_GET_DFS_REFER_RSP; | |
1462 | ||
1463 | /* DFS Flags */ | |
1464 | #define DFSREF_REFERRAL_SERVER 0x0001 | |
1465 | #define DFSREF_STORAGE_SERVER 0x0002 | |
1466 | ||
1467 | /* IOCTL information */ | |
1468 | /* List of ioctl function codes that look to be of interest to remote clients like this. */ | |
1469 | /* Need to do some experimentation to make sure they all work remotely. */ | |
1470 | /* Some of the following such as the encryption/compression ones would be */ | |
1471 | /* invoked from tools via a specialized hook into the VFS rather than via the */ | |
1472 | /* standard vfs entry points */ | |
1473 | #define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 | |
1474 | #define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 | |
1475 | #define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 | |
1476 | #define FSCTL_LOCK_VOLUME 0x00090018 | |
1477 | #define FSCTL_UNLOCK_VOLUME 0x0009001C | |
1478 | #define FSCTL_GET_COMPRESSION 0x0009003C | |
1479 | #define FSCTL_SET_COMPRESSION 0x0009C040 | |
1480 | #define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C | |
1481 | #define FSCTL_FILESYS_GET_STATISTICS 0x00090090 | |
1482 | #define FSCTL_SET_REPARSE_POINT 0x000900A4 | |
1483 | #define FSCTL_GET_REPARSE_POINT 0x000900A8 | |
1484 | #define FSCTL_DELETE_REPARSE_POINT 0x000900AC | |
1485 | #define FSCTL_SET_SPARSE 0x000900C4 | |
1486 | #define FSCTL_SET_ZERO_DATA 0x000900C8 | |
1487 | #define FSCTL_SET_ENCRYPTION 0x000900D7 | |
1488 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB | |
1489 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF | |
1490 | #define FSCTL_READ_RAW_ENCRYPTED 0x000900E3 | |
1491 | #define FSCTL_SIS_COPYFILE 0x00090100 | |
1492 | #define FSCTL_SIS_LINK_FILES 0x0009C104 | |
1493 | ||
1494 | #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 | |
1495 | #define IO_REPARSE_TAG_HSM 0xC0000004 | |
1496 | #define IO_REPARSE_TAG_SIS 0x80000007 | |
1497 | ||
1498 | /* | |
1499 | ************************************************************************ | |
1500 | * All structs for everything above the SMB PDUs themselves | |
1501 | * (such as the T2 level specific data) go here | |
1502 | ************************************************************************ | |
1503 | */ | |
1504 | ||
1505 | /* | |
1506 | * Information on a server | |
1507 | */ | |
1508 | ||
1509 | struct serverInfo { | |
1510 | char name[16]; | |
1511 | unsigned char versionMajor; | |
1512 | unsigned char versionMinor; | |
1513 | unsigned long type; | |
1514 | unsigned int commentOffset; | |
1515 | }; | |
1516 | ||
1517 | /* | |
1518 | * The following structure is the format of the data returned on a NetShareEnum | |
1519 | * with level "90" (x5A) | |
1520 | */ | |
1521 | ||
1522 | struct shareInfo { | |
1523 | char shareName[13]; | |
1524 | char pad; | |
1525 | unsigned short type; | |
1526 | unsigned int commentOffset; | |
1527 | }; | |
1528 | ||
1529 | struct aliasInfo { | |
1530 | char aliasName[9]; | |
1531 | char pad; | |
1532 | unsigned int commentOffset; | |
1533 | unsigned char type[2]; | |
1534 | }; | |
1535 | ||
1536 | struct aliasInfo92 { | |
1537 | int aliasNameOffset; | |
1538 | int serverNameOffset; | |
1539 | int shareNameOffset; | |
1540 | }; | |
1541 | ||
1542 | typedef struct { | |
1543 | __le64 TotalAllocationUnits; | |
1544 | __le64 FreeAllocationUnits; | |
1545 | __le32 SectorsPerAllocationUnit; | |
1546 | __le32 BytesPerSector; | |
1547 | } FILE_SYSTEM_INFO; /* size info, level 0x103 */ | |
1548 | ||
1549 | typedef struct { | |
1550 | __le16 MajorVersionNumber; | |
1551 | __le16 MinorVersionNumber; | |
1552 | __le64 Capability; | |
1553 | } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ | |
1554 | /* Linux/Unix extensions capability flags */ | |
1555 | #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ | |
f654bac2 SF |
1556 | #define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ |
1557 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ | |
1558 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ | |
1da177e4 LT |
1559 | |
1560 | typedef struct { | |
1561 | /* For undefined recommended transfer size return -1 in that field */ | |
1562 | __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ | |
1563 | __le32 BlockSize; | |
1564 | /* The next three fields are in terms of the block size. | |
1565 | (above). If block size is unknown, 4096 would be a | |
1566 | reasonable block size for a server to report. | |
1567 | Note that returning the blocks/blocksavail removes need | |
1568 | to make a second call (to QFSInfo level 0x103 to get this info. | |
1569 | UserBlockAvail is typically less than or equal to BlocksAvail, | |
1570 | if no distinction is made return the same value in each */ | |
1571 | __le64 TotalBlocks; | |
1572 | __le64 BlocksAvail; /* bfree */ | |
1573 | __le64 UserBlocksAvail; /* bavail */ | |
1574 | /* For undefined Node fields or FSID return -1 */ | |
1575 | __le64 TotalFileNodes; | |
1576 | __le64 FreeFileNodes; | |
1577 | __le64 FileSysIdentifier; /* fsid */ | |
1578 | /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ | |
1579 | /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ | |
1580 | } FILE_SYSTEM_POSIX_INFO; | |
1581 | ||
1582 | /* DeviceType Flags */ | |
1583 | #define FILE_DEVICE_CD_ROM 0x00000002 | |
1584 | #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 | |
1585 | #define FILE_DEVICE_DFS 0x00000006 | |
1586 | #define FILE_DEVICE_DISK 0x00000007 | |
1587 | #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 | |
1588 | #define FILE_DEVICE_FILE_SYSTEM 0x00000009 | |
1589 | #define FILE_DEVICE_NAMED_PIPE 0x00000011 | |
1590 | #define FILE_DEVICE_NETWORK 0x00000012 | |
1591 | #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 | |
1592 | #define FILE_DEVICE_NULL 0x00000015 | |
1593 | #define FILE_DEVICE_PARALLEL_PORT 0x00000016 | |
1594 | #define FILE_DEVICE_PRINTER 0x00000018 | |
1595 | #define FILE_DEVICE_SERIAL_PORT 0x0000001b | |
1596 | #define FILE_DEVICE_STREAMS 0x0000001e | |
1597 | #define FILE_DEVICE_TAPE 0x0000001f | |
1598 | #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 | |
1599 | #define FILE_DEVICE_VIRTUAL_DISK 0x00000024 | |
1600 | #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 | |
1601 | ||
1602 | typedef struct { | |
1603 | __le32 DeviceType; | |
1604 | __le32 DeviceCharacteristics; | |
1605 | } FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ | |
1606 | ||
1607 | typedef struct { | |
1608 | __le32 Attributes; | |
1609 | __le32 MaxPathNameComponentLength; | |
1610 | __le32 FileSystemNameLen; | |
1611 | char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ | |
1612 | } FILE_SYSTEM_ATTRIBUTE_INFO; | |
1613 | ||
1614 | /******************************************************************************/ | |
1615 | /* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */ | |
1616 | /******************************************************************************/ | |
1617 | typedef struct { /* data block encoding of response to level 263 QPathInfo */ | |
1618 | __le64 CreationTime; | |
1619 | __le64 LastAccessTime; | |
1620 | __le64 LastWriteTime; | |
1621 | __le64 ChangeTime; | |
1622 | __le32 Attributes; | |
1623 | __u32 Pad1; | |
1624 | __le64 AllocationSize; | |
1625 | __le64 EndOfFile; /* size ie offset to first free byte in file */ | |
1626 | __le32 NumberOfLinks; /* hard links */ | |
1627 | __u8 DeletePending; | |
1628 | __u8 Directory; | |
1629 | __u16 Pad2; | |
1630 | __u64 IndexNumber; | |
1631 | __le32 EASize; | |
1632 | __le32 AccessFlags; | |
1633 | __u64 IndexNumber1; | |
1634 | __le64 CurrentByteOffset; | |
1635 | __le32 Mode; | |
1636 | __le32 AlignmentRequirement; | |
1637 | __le32 FileNameLength; | |
1638 | char FileName[1]; | |
1639 | } FILE_ALL_INFO; /* level 0x107 QPathInfo */ | |
1640 | ||
1641 | /* defines for enumerating possible values of the Unix type field below */ | |
1642 | #define UNIX_FILE 0 | |
1643 | #define UNIX_DIR 1 | |
1644 | #define UNIX_SYMLINK 2 | |
1645 | #define UNIX_CHARDEV 3 | |
1646 | #define UNIX_BLOCKDEV 4 | |
1647 | #define UNIX_FIFO 5 | |
1648 | #define UNIX_SOCKET 6 | |
1649 | typedef struct { | |
1650 | __le64 EndOfFile; | |
1651 | __le64 NumOfBytes; | |
1652 | __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */ | |
1653 | __le64 LastAccessTime; | |
1654 | __le64 LastModificationTime; | |
1655 | __le64 Uid; | |
1656 | __le64 Gid; | |
1657 | __le32 Type; | |
1658 | __le64 DevMajor; | |
1659 | __le64 DevMinor; | |
1660 | __u64 UniqueId; | |
1661 | __le64 Permissions; | |
1662 | __le64 Nlinks; | |
1663 | } FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ | |
1664 | ||
1665 | typedef struct { | |
1666 | char LinkDest[1]; | |
1667 | } FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ | |
1668 | ||
1669 | /* The following three structures are needed only for | |
1670 | setting time to NT4 and some older servers via | |
1671 | the primitive DOS time format */ | |
1672 | typedef struct { | |
1673 | __u16 Day:5; | |
1674 | __u16 Month:4; | |
1675 | __u16 Year:7; | |
1676 | } SMB_DATE; | |
1677 | ||
1678 | typedef struct { | |
1679 | __u16 TwoSeconds:5; | |
1680 | __u16 Minutes:6; | |
1681 | __u16 Hours:5; | |
1682 | } SMB_TIME; | |
1683 | ||
1684 | typedef struct { | |
1685 | __le16 CreationDate; /* SMB Date see above */ | |
1686 | __le16 CreationTime; /* SMB Time */ | |
1687 | __le16 LastAccessDate; | |
1688 | __le16 LastAccessTime; | |
1689 | __le16 LastWriteDate; | |
1690 | __le16 LastWriteTime; | |
1691 | __le32 DataSize; /* File Size (EOF) */ | |
1692 | __le32 AllocationSize; | |
1693 | __le16 Attributes; /* verify not u32 */ | |
1694 | __le32 EASize; | |
1695 | } FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */ | |
1696 | ||
1697 | typedef struct { | |
1698 | __le64 CreationTime; | |
1699 | __le64 LastAccessTime; | |
1700 | __le64 LastWriteTime; | |
1701 | __le64 ChangeTime; | |
1702 | __le32 Attributes; | |
1703 | __u32 Pad; | |
1704 | } FILE_BASIC_INFO; /* size info, level 0x101 */ | |
1705 | ||
1706 | struct file_allocation_info { | |
1707 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ | |
1708 | }; /* size used on disk, level 0x103 for set, 0x105 for query */ | |
1709 | ||
1710 | struct file_end_of_file_info { | |
1711 | __le64 FileSize; /* offset to end of file */ | |
1712 | }; /* size info, level 0x104 for set, 0x106 for query */ | |
1713 | ||
1714 | struct file_alt_name_info { | |
1715 | __u8 alt_name[1]; | |
1716 | }; /* level 0x0108 */ | |
1717 | ||
1718 | struct file_stream_info { | |
1719 | __le32 number_of_streams; /* BB check sizes and verify location */ | |
1720 | /* followed by info on streams themselves | |
1721 | u64 size; | |
1722 | u64 allocation_size | |
1723 | stream info */ | |
1724 | }; /* level 0x109 */ | |
1725 | ||
1726 | struct file_compression_info { | |
1727 | __le64 compressed_size; | |
1728 | __le16 format; | |
1729 | __u8 unit_shift; | |
1730 | __u8 ch_shift; | |
1731 | __u8 cl_shift; | |
1732 | __u8 pad[3]; | |
1733 | }; /* level 0x10b */ | |
1734 | ||
1735 | /* POSIX ACL set/query path info structures */ | |
1736 | #define CIFS_ACL_VERSION 1 | |
1737 | struct cifs_posix_ace { /* access control entry (ACE) */ | |
1738 | __u8 cifs_e_tag; | |
1739 | __u8 cifs_e_perm; | |
1740 | __le64 cifs_uid; /* or gid */ | |
1741 | }; | |
1742 | ||
1743 | struct cifs_posix_acl { /* access conrol list (ACL) */ | |
1744 | __le16 version; | |
1745 | __le16 access_entry_count; /* access ACL - count of entries */ | |
1746 | __le16 default_entry_count; /* default ACL - count of entries */ | |
1747 | struct cifs_posix_ace ace_array[0]; | |
1748 | /* followed by | |
1749 | struct cifs_posix_ace default_ace_arraay[] */ | |
1750 | }; /* level 0x204 */ | |
1751 | ||
1752 | /* types of access control entries already defined in posix_acl.h */ | |
1753 | /* #define CIFS_POSIX_ACL_USER_OBJ 0x01 | |
1754 | #define CIFS_POSIX_ACL_USER 0x02 | |
1755 | #define CIFS_POSIX_ACL_GROUP_OBJ 0x04 | |
1756 | #define CIFS_POSIX_ACL_GROUP 0x08 | |
1757 | #define CIFS_POSIX_ACL_MASK 0x10 | |
1758 | #define CIFS_POSIX_ACL_OTHER 0x20 */ | |
1759 | ||
1760 | /* types of perms */ | |
1761 | /* #define CIFS_POSIX_ACL_EXECUTE 0x01 | |
1762 | #define CIFS_POSIX_ACL_WRITE 0x02 | |
1763 | #define CIFS_POSIX_ACL_READ 0x04 */ | |
1764 | ||
1765 | /* end of POSIX ACL definitions */ | |
1766 | ||
1767 | struct file_internal_info { | |
1768 | __u64 UniqueId; /* inode number */ | |
1769 | }; /* level 0x3ee */ | |
1770 | struct file_mode_info { | |
1771 | __le32 Mode; | |
1772 | }; /* level 0x3f8 */ | |
1773 | ||
1774 | struct file_attrib_tag { | |
1775 | __le32 Attribute; | |
1776 | __le32 ReparseTag; | |
1777 | }; /* level 0x40b */ | |
1778 | ||
1779 | ||
1780 | /********************************************************/ | |
1781 | /* FindFirst/FindNext transact2 data buffer formats */ | |
1782 | /********************************************************/ | |
1783 | ||
1784 | typedef struct { | |
1785 | __le32 NextEntryOffset; | |
1786 | __u32 ResumeKey; /* as with FileIndex - no need to convert */ | |
1787 | __le64 EndOfFile; | |
1788 | __le64 NumOfBytes; | |
1789 | __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */ | |
1790 | __le64 LastAccessTime; | |
1791 | __le64 LastModificationTime; | |
1792 | __le64 Uid; | |
1793 | __le64 Gid; | |
1794 | __le32 Type; | |
1795 | __le64 DevMajor; | |
1796 | __le64 DevMinor; | |
1797 | __u64 UniqueId; | |
1798 | __le64 Permissions; | |
1799 | __le64 Nlinks; | |
1800 | char FileName[1]; | |
1801 | } FILE_UNIX_INFO; /* level 0x202 */ | |
1802 | ||
1803 | typedef struct { | |
1804 | __le32 NextEntryOffset; | |
1805 | __u32 FileIndex; | |
1806 | __le64 CreationTime; | |
1807 | __le64 LastAccessTime; | |
1808 | __le64 LastWriteTime; | |
1809 | __le64 ChangeTime; | |
1810 | __le64 EndOfFile; | |
1811 | __le64 AllocationSize; | |
1812 | __le32 ExtFileAttributes; | |
1813 | __le32 FileNameLength; | |
1814 | char FileName[1]; | |
1815 | } FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */ | |
1816 | ||
1817 | typedef struct { | |
1818 | __le32 NextEntryOffset; | |
1819 | __u32 FileIndex; | |
1820 | __le64 CreationTime; | |
1821 | __le64 LastAccessTime; | |
1822 | __le64 LastWriteTime; | |
1823 | __le64 ChangeTime; | |
1824 | __le64 EndOfFile; | |
1825 | __le64 AllocationSize; | |
1826 | __le32 ExtFileAttributes; | |
1827 | __le32 FileNameLength; | |
1828 | __le32 EaSize; /* length of the xattrs */ | |
1829 | char FileName[1]; | |
1830 | } FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */ | |
1831 | ||
1832 | typedef struct { | |
1833 | __le32 NextEntryOffset; | |
1834 | __u32 FileIndex; | |
1835 | __le64 CreationTime; | |
1836 | __le64 LastAccessTime; | |
1837 | __le64 LastWriteTime; | |
1838 | __le64 ChangeTime; | |
1839 | __le64 EndOfFile; | |
1840 | __le64 AllocationSize; | |
1841 | __le32 ExtFileAttributes; | |
1842 | __le32 FileNameLength; | |
1843 | __le32 EaSize; /* EA size */ | |
1844 | __le32 Reserved; | |
1845 | __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ | |
1846 | char FileName[1]; | |
1847 | } SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF response data area */ | |
1848 | ||
1849 | typedef struct { | |
1850 | __le32 NextEntryOffset; | |
1851 | __u32 FileIndex; | |
1852 | __le64 CreationTime; | |
1853 | __le64 LastAccessTime; | |
1854 | __le64 LastWriteTime; | |
1855 | __le64 ChangeTime; | |
1856 | __le64 EndOfFile; | |
1857 | __le64 AllocationSize; | |
1858 | __le32 ExtFileAttributes; | |
1859 | __le32 FileNameLength; | |
1860 | __le32 EaSize; /* length of the xattrs */ | |
1861 | __u8 ShortNameLength; | |
1862 | __u8 Reserved; | |
1863 | __u8 ShortName[12]; | |
1864 | char FileName[1]; | |
1865 | } FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */ | |
1866 | ||
1867 | ||
1868 | struct gea { | |
1869 | unsigned char name_len; | |
1870 | char name[1]; | |
1871 | }; | |
1872 | ||
1873 | struct gealist { | |
1874 | unsigned long list_len; | |
1875 | struct gea list[1]; | |
1876 | }; | |
1877 | ||
1878 | struct fea { | |
1879 | unsigned char EA_flags; | |
1880 | __u8 name_len; | |
1881 | __le16 value_len; | |
1882 | char name[1]; | |
1883 | /* optionally followed by value */ | |
1884 | }; | |
1885 | /* flags for _FEA.fEA */ | |
1886 | #define FEA_NEEDEA 0x80 /* need EA bit */ | |
1887 | ||
1888 | struct fealist { | |
1889 | __le32 list_len; | |
1890 | struct fea list[1]; | |
1891 | }; | |
1892 | ||
1893 | /* used to hold an arbitrary blob of data */ | |
1894 | struct data_blob { | |
1895 | __u8 *data; | |
1896 | size_t length; | |
1897 | void (*free) (struct data_blob * data_blob); | |
1898 | }; | |
1899 | ||
1900 | ||
1901 | #ifdef CONFIG_CIFS_POSIX | |
1902 | /* | |
1903 | For better POSIX semantics from Linux client, (even better | |
1904 | than the existing CIFS Unix Extensions) we need updated PDUs for: | |
1905 | ||
1906 | 1) PosixCreateX - to set and return the mode, inode#, device info and | |
1907 | perhaps add a CreateDevice - to create Pipes and other special .inodes | |
1908 | Also note POSIX open flags | |
1909 | 2) Close - to return the last write time to do cache across close more safely | |
1910 | 3) PosixQFSInfo - to return statfs info | |
1911 | 4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes) | |
1912 | 5) Mkdir - set mode | |
1913 | ||
1914 | And under consideration: | |
1915 | 6) FindClose2 (return nanosecond timestamp ??) | |
1916 | 7) Use nanosecond timestamps throughout all time fields if | |
1917 | corresponding attribute flag is set | |
1918 | 8) sendfile - handle based copy | |
1919 | 9) Direct i/o | |
1920 | 10) "POSIX ACL" support | |
1921 | 11) Misc fcntls? | |
1922 | ||
1923 | what about fixing 64 bit alignment | |
1924 | ||
1925 | There are also various legacy SMB/CIFS requests used as is | |
1926 | ||
1927 | From existing Lanman and NTLM dialects: | |
1928 | -------------------------------------- | |
1929 | NEGOTIATE | |
1930 | SESSION_SETUP_ANDX (BB which?) | |
1931 | TREE_CONNECT_ANDX (BB which wct?) | |
1932 | TREE_DISCONNECT (BB add volume timestamp on response) | |
1933 | LOGOFF_ANDX | |
1934 | DELETE (note delete open file behavior) | |
1935 | DELETE_DIRECTORY | |
1936 | READ_AND_X | |
1937 | WRITE_AND_X | |
1938 | LOCKING_AND_X (note posix lock semantics) | |
1939 | RENAME (note rename across dirs and open file rename posix behaviors) | |
1940 | NT_RENAME (for hardlinks) Is this good enough for all features? | |
1941 | FIND_CLOSE2 | |
1942 | TRANSACTION2 (18 cases) | |
1943 | SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 | |
1944 | (BB verify that never need to set allocation size) | |
1945 | SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?) | |
1946 | ||
1947 | COPY (note support for copy across directories) - FUTURE, OPTIONAL | |
1948 | setting/getting OS/2 EAs - FUTURE (BB can this handle | |
1949 | setting Linux xattrs perfectly) - OPTIONAL | |
1950 | dnotify - FUTURE, OPTIONAL | |
1951 | quota - FUTURE, OPTIONAL | |
1952 | ||
1953 | Note that various requests implemented for NT interop such as | |
1954 | NT_TRANSACT (IOCTL) QueryReparseInfo | |
1955 | are unneeded to servers compliant with the CIFS POSIX extensions | |
1956 | ||
1957 | From CIFS Unix Extensions: | |
1958 | ------------------------- | |
1959 | T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks | |
1960 | T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) | |
1961 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) | |
1962 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields | |
1963 | Actually need QUERY_FILE_UNIX_INFO since has inode num | |
1964 | BB what about a) blksize/blkbits/blocks | |
1965 | b) i_version | |
1966 | c) i_rdev | |
1967 | d) notify mask? | |
1968 | e) generation | |
1969 | f) size_seqcount | |
1970 | T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX | |
1971 | TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended | |
1972 | T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL | |
1973 | ||
1974 | ||
1975 | */ | |
1976 | ||
1977 | /* xsymlink is a symlink format that can be used | |
1978 | to save symlink info in a regular file when | |
1979 | mounted to operating systems that do not | |
1980 | support the cifs Unix extensions or EAs (for xattr | |
1981 | based symlinks). For such a file to be recognized | |
1982 | as containing symlink data: | |
1983 | ||
1984 | 1) file size must be 1067, | |
1985 | 2) signature must begin file data, | |
1986 | 3) length field must be set to ASCII representation | |
1987 | of a number which is less than or equal to 1024, | |
1988 | 4) md5 must match that of the path data */ | |
1989 | ||
1990 | struct xsymlink { | |
1991 | /* 1067 bytes */ | |
1992 | char signature[4]; /* XSym */ /* not null terminated */ | |
1993 | char cr0; /* \n */ | |
1994 | /* ASCII representation of length (4 bytes decimal) terminated by \n not null */ | |
1995 | char length[4]; | |
1996 | char cr1; /* \n */ | |
1997 | /* md5 of valid subset of path ie path[0] through path[length-1] */ | |
1998 | __u8 md5[32]; | |
1999 | char cr2; /* \n */ | |
2000 | /* if room left, then end with \n then 0x20s by convention but not required */ | |
2001 | char path[1024]; | |
2002 | }; | |
2003 | ||
f654bac2 | 2004 | typedef struct file_xattr_info { |
1da177e4 LT |
2005 | /* BB do we need another field for flags? BB */ |
2006 | __u32 xattr_name_len; | |
2007 | __u32 xattr_value_len; | |
2008 | char xattr_name[0]; | |
2009 | /* followed by xattr_value[xattr_value_len], no pad */ | |
f654bac2 SF |
2010 | } FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ |
2011 | ||
2012 | ||
2013 | /* flags for chattr command */ | |
2014 | #define EXT_SECURE_DELETE 0x00000001 /* EXT3_SECRM_FL */ | |
2015 | #define EXT_ENABLE_UNDELETE 0x00000002 /* EXT3_UNRM_FL */ | |
2016 | /* Reserved for compress file 0x4 */ | |
2017 | #define EXT_SYNCHRONOUS 0x00000008 /* EXT3_SYNC_FL */ | |
2018 | #define EXT_IMMUTABLE_FL 0x00000010 /* EXT3_IMMUTABLE_FL */ | |
2019 | #define EXT_OPEN_APPEND_ONLY 0x00000020 /* EXT3_APPEND_FL */ | |
2020 | #define EXT_DO_NOT_BACKUP 0x00000040 /* EXT3_NODUMP_FL */ | |
2021 | #define EXT_NO_UPDATE_ATIME 0x00000080 /* EXT3_NOATIME_FL */ | |
2022 | /* 0x100 through 0x800 reserved for compression flags and are GET-ONLY */ | |
2023 | #define EXT_HASH_TREE_INDEXED_DIR 0x00001000 /* GET-ONLY EXT3_INDEX_FL */ | |
2024 | /* 0x2000 reserved for IMAGIC_FL */ | |
2025 | #define EXT_JOURNAL_THIS_FILE 0x00004000 /* GET-ONLY EXT3_JOURNAL_DATA_FL */ | |
2026 | /* 0x8000 reserved for EXT3_NOTAIL_FL */ | |
2027 | #define EXT_SYNCHRONOUS_DIR 0x00010000 /* EXT3_DIRSYNC_FL */ | |
2028 | #define EXT_TOPDIR 0x00020000 /* EXT3_TOPDIR_FL */ | |
2029 | ||
2030 | #define EXT_SET_MASK 0x000300FF | |
2031 | #define EXT_GET_MASK 0x0003DFFF | |
2032 | ||
2033 | typedef struct file_chattr_info { | |
2034 | __le64 mask; /* list of all possible attribute bits */ | |
2035 | __le64 mode; /* list of actual attribute bits on this inode */ | |
2036 | } FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ | |
1da177e4 LT |
2037 | |
2038 | #endif | |
2039 | ||
2040 | #pragma pack() /* resume default structure packing */ | |
2041 | ||
2042 | #endif /* _CIFSPDU_H */ |