s3: "dotareof" only looks at the file type
[Samba.git] / source3 / include / trans2.h
blob3759d59681161aff4d1db6b3e29882404b60b4cf
1 /*
2 Unix SMB/CIFS implementation.
3 SMB transaction2 handling
5 Copyright (C) James Peach 2007
6 Copyright (C) Jeremy Allison 1994-2002.
8 Extensively modified by Andrew Tridgell, 1995
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef _TRANS2_H_
25 #define _TRANS2_H_
27 /* Define the structures needed for the trans2 calls. */
29 /*******************************************************
30 For DosFindFirst/DosFindNext - level 1
32 MAXFILENAMELEN = 255;
33 FDATE == uint16
34 FTIME == uint16
35 ULONG == uint32
36 USHORT == uint16
38 typedef struct _FILEFINDBUF {
39 Byte offset Type name description
40 -------------+-------+-------------------+--------------
41 0 FDATE fdateCreation;
42 2 FTIME ftimeCreation;
43 4 FDATE fdateLastAccess;
44 6 FTIME ftimeLastAccess;
45 8 FDATE fdateLastWrite;
46 10 FTIME ftimeLastWrite;
47 12 ULONG cbFile file length in bytes
48 16 ULONG cbFileAlloc size of file allocation unit
49 20 USHORT attrFile
50 22 UCHAR cchName length of name to follow (not including zero)
51 23 UCHAR achName[MAXFILENAMELEN]; Null terminated name
52 } FILEFINDBUF;
53 *********************************************************/
55 #define l1_fdateCreation 0
56 #define l1_fdateLastAccess 4
57 #define l1_fdateLastWrite 8
58 #define l1_cbFile 12
59 #define l1_cbFileAlloc 16
60 #define l1_attrFile 20
61 #define l1_cchName 22
62 #define l1_achName 23
64 /**********************************************************
65 For DosFindFirst/DosFindNext - level 2
67 typedef struct _FILEFINDBUF2 {
68 Byte offset Type name description
69 -------------+-------+-------------------+--------------
70 0 FDATE fdateCreation;
71 2 FTIME ftimeCreation;
72 4 FDATE fdateLastAccess;
73 6 FTIME ftimeLastAccess;
74 8 FDATE fdateLastWrite;
75 10 FTIME ftimeLastWrite;
76 12 ULONG cbFile file length in bytes
77 16 ULONG cbFileAlloc size of file allocation unit
78 20 USHORT attrFile
79 22 ULONG cbList Extended attribute list (always 0)
80 26 UCHAR cchName length of name to follow (not including zero)
81 27 UCHAR achName[MAXFILENAMELEN]; Null terminated name
82 } FILEFINDBUF2;
83 *************************************************************/
85 #define l2_fdateCreation 0
86 #define l2_fdateLastAccess 4
87 #define l2_fdateLastWrite 8
88 #define l2_cbFile 12
89 #define l2_cbFileAlloc 16
90 #define l2_attrFile 20
91 #define l2_cbList 22
92 #define l2_cchName 26
93 #define l2_achName 27
96 /**********************************************************
97 For DosFindFirst/DosFindNext - level 260
99 typedef struct _FILEFINDBUF260 {
100 Byte offset Type name description
101 -------------+-------+-------------------+--------------
102 0 ULONG NextEntryOffset;
103 4 ULONG FileIndex;
104 8 LARGE_INTEGER CreationTime;
105 16 LARGE_INTEGER LastAccessTime;
106 24 LARGE_INTEGER LastWriteTime;
107 32 LARGE_INTEGER ChangeTime;
108 40 LARGE_INTEGER EndOfFile;
109 48 LARGE_INTEGER AllocationSize;
110 56 ULONG FileAttributes;
111 60 ULONG FileNameLength;
112 64 ULONG EaSize;
113 68 CHAR ShortNameLength;
114 70 UNICODE ShortName[12];
115 94 UNICODE FileName[];
116 *************************************************************/
118 #define l260_achName 94
121 /**********************************************************
122 For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
123 DosSetFileInfo - level 1
125 typedef struct _FILESTATUS {
126 Byte offset Type name description
127 -------------+-------+-------------------+--------------
128 0 FDATE fdateCreation;
129 2 FTIME ftimeCreation;
130 4 FDATE fdateLastAccess;
131 6 FTIME ftimeLastAccess;
132 8 FDATE fdateLastWrite;
133 10 FTIME ftimeLastWrite;
134 12 ULONG cbFile file length in bytes
135 16 ULONG cbFileAlloc size of file allocation unit
136 20 USHORT attrFile
137 } FILESTATUS;
138 *************************************************************/
140 /* Use the l1_ defines from DosFindFirst */
142 /**********************************************************
143 For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
144 DosSetFileInfo - level 2
146 typedef struct _FILESTATUS2 {
147 Byte offset Type name description
148 -------------+-------+-------------------+--------------
149 0 FDATE fdateCreation;
150 2 FTIME ftimeCreation;
151 4 FDATE fdateLastAccess;
152 6 FTIME ftimeLastAccess;
153 8 FDATE fdateLastWrite;
154 10 FTIME ftimeLastWrite;
155 12 ULONG cbFile file length in bytes
156 16 ULONG cbFileAlloc size of file allocation unit
157 20 USHORT attrFile
158 22 ULONG cbList Length of EA's (0)
159 } FILESTATUS2;
160 *************************************************************/
162 /* Use the l2_ #defines from DosFindFirst */
164 /**********************************************************
165 For DosQFSInfo/DosSetFSInfo - level 1
167 typedef struct _FSALLOCATE {
168 Byte offset Type name description
169 -------------+-------+-------------------+--------------
170 0 ULONG idFileSystem id of file system
171 4 ULONG cSectorUnit number of sectors per allocation unit
172 8 ULONG cUnit number of allocation units
173 12 ULONG cUnitAvail Available allocation units
174 16 USHORT cbSector bytes per sector
175 } FSALLOCATE;
176 *************************************************************/
178 #define l1_idFileSystem 0
179 #define l1_cSectorUnit 4
180 #define l1_cUnit 8
181 #define l1_cUnitAvail 12
182 #define l1_cbSector 16
184 /**********************************************************
185 For DosQFSInfo/DosSetFSInfo - level 2
187 typedef struct _FSINFO {
188 Byte offset Type name description
189 -------------+-------+-------------------+--------------
190 0 FDATE vol_fdateCreation
191 2 FTIME vol_ftimeCreation
192 4 UCHAR vol_cch length of volume name (excluding NULL)
193 5 UCHAR vol_szVolLabel[12] volume name
194 } FSINFO;
195 *************************************************************/
197 #define SMB_INFO_STANDARD 1 /* FILESTATUS3 struct */
198 #define SMB_INFO_SET_EA 2 /* EAOP2 struct, only valid on set not query */
199 #define SMB_INFO_QUERY_EA_SIZE 2 /* FILESTATUS4 struct, only valid on query not set */
200 #define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* only valid on query not set */
201 #define SMB_INFO_QUERY_ALL_EAS 4 /* only valid on query not set */
202 #define SMB_INFO_IS_NAME_VALID 6
203 #define SMB_INFO_STANDARD_LONG 11 /* similar to level 1, ie struct FileStatus3 */
204 #define SMB_QUERY_EA_SIZE_LONG 12 /* similar to level 2, ie struct FileStatus4 */
205 #define SMB_QUERY_FS_LABEL_INFO 0x101
206 #define SMB_QUERY_FS_VOLUME_INFO 0x102
207 #define SMB_QUERY_FS_SIZE_INFO 0x103
208 #define SMB_QUERY_FS_DEVICE_INFO 0x104
209 #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
210 #if 0
211 #define SMB_QUERY_FS_QUOTA_INFO
212 #endif
214 #define l2_vol_fdateCreation 0
215 #define l2_vol_cch 4
216 #define l2_vol_szVolLabel 5
219 #define SMB_QUERY_FILE_BASIC_INFO 0x101
220 #define SMB_QUERY_FILE_STANDARD_INFO 0x102
221 #define SMB_QUERY_FILE_EA_INFO 0x103
222 #define SMB_QUERY_FILE_NAME_INFO 0x104
223 #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
224 #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
225 #define SMB_QUERY_FILE_ALL_INFO 0x107
226 #define SMB_QUERY_FILE_ALT_NAME_INFO 0x108
227 #define SMB_QUERY_FILE_STREAM_INFO 0x109
228 #define SMB_QUERY_COMPRESSION_INFO 0x10b
230 #define SMB_FIND_INFO_STANDARD 1
231 #define SMB_FIND_EA_SIZE 2
232 #define SMB_FIND_EA_LIST 3
233 #define SMB_FIND_FILE_DIRECTORY_INFO 0x101
234 #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
235 #define SMB_FIND_FILE_NAMES_INFO 0x103
236 #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
237 #define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105
238 #define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106
240 #define SMB_SET_FILE_BASIC_INFO 0x101
241 #define SMB_SET_FILE_DISPOSITION_INFO 0x102
242 #define SMB_SET_FILE_ALLOCATION_INFO 0x103
243 #define SMB_SET_FILE_END_OF_FILE_INFO 0x104
245 /* Query FS info. */
246 #define SMB_INFO_ALLOCATION 1
247 #define SMB_INFO_VOLUME 2
250 * Thursby MAC extensions....
254 * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved.
255 * Supposedly Microsoft have agreed to this.
258 #define MIN_MAC_INFO_LEVEL 0x300
259 #define MAX_MAC_INFO_LEVEL 0x3FF
261 #define SMB_MAC_QUERY_FS_INFO 0x301
263 #define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
266 * DeviceType and Characteristics returned in a
267 * SMB_QUERY_FS_DEVICE_INFO call.
270 #define DEVICETYPE_CD_ROM 0x2
271 #define DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3
272 #define DEVICETYPE_DISK 0x7
273 #define DEVICETYPE_DISK_FILE_SYSTEM 0x8
274 #define DEVICETYPE_FILE_SYSTEM 0x9
276 /* Characteristics. */
277 #define TYPE_REMOVABLE_MEDIA 0x1
278 #define TYPE_READ_ONLY_DEVICE 0x2
279 #define TYPE_FLOPPY 0x4
280 #define TYPE_WORM 0x8
281 #define TYPE_REMOTE 0x10
282 #define TYPE_MOUNTED 0x20
283 #define TYPE_VIRTUAL 0x40
285 /* NT passthrough levels... */
287 #define SMB_FILE_DIRECTORY_INFORMATION 1001
288 #define SMB_FILE_FULL_DIRECTORY_INFORMATION 1002
289 #define SMB_FILE_BOTH_DIRECTORY_INFORMATION 1003
290 #define SMB_FILE_BASIC_INFORMATION 1004
291 #define SMB_FILE_STANDARD_INFORMATION 1005
292 #define SMB_FILE_INTERNAL_INFORMATION 1006
293 #define SMB_FILE_EA_INFORMATION 1007
294 #define SMB_FILE_ACCESS_INFORMATION 1008
295 #define SMB_FILE_NAME_INFORMATION 1009
296 #define SMB_FILE_RENAME_INFORMATION 1010
297 #define SMB_FILE_LINK_INFORMATION 1011
298 #define SMB_FILE_NAMES_INFORMATION 1012
299 #define SMB_FILE_DISPOSITION_INFORMATION 1013
300 #define SMB_FILE_POSITION_INFORMATION 1014
301 #define SMB_FILE_FULL_EA_INFORMATION 1015
302 #define SMB_FILE_MODE_INFORMATION 1016
303 #define SMB_FILE_ALIGNMENT_INFORMATION 1017
304 #define SMB_FILE_ALL_INFORMATION 1018
305 #define SMB_FILE_ALLOCATION_INFORMATION 1019
306 #define SMB_FILE_END_OF_FILE_INFORMATION 1020
307 #define SMB_FILE_ALTERNATE_NAME_INFORMATION 1021
308 #define SMB_FILE_STREAM_INFORMATION 1022
309 #define SMB_FILE_PIPE_INFORMATION 1023
310 #define SMB_FILE_PIPE_LOCAL_INFORMATION 1024
311 #define SMB_FILE_PIPE_REMOTE_INFORMATION 1025
312 #define SMB_FILE_MAILSLOT_QUERY_INFORMATION 1026
313 #define SMB_FILE_MAILSLOT_SET_INFORMATION 1027
314 #define SMB_FILE_COMPRESSION_INFORMATION 1028
315 #define SMB_FILE_OBJECTID_INFORMATION 1029
316 #define SMB_FILE_COMPLETION_INFORMATION 1030
317 #define SMB_FILE_MOVE_CLUSTER_INFORMATION 1031
318 #define SMB_FILE_QUOTA_INFORMATION 1032
319 #define SMB_FILE_REPARSEPOINT_INFORMATION 1033
320 #define SMB_FILE_NETWORK_OPEN_INFORMATION 1034
321 #define SMB_FILE_ATTRIBUTE_TAG_INFORMATION 1035
322 #define SMB_FILE_TRACKING_INFORMATION 1036
323 #define SMB_FILE_MAXIMUM_INFORMATION 1037
325 /* NT passthough levels for qfsinfo. */
327 #define SMB_FS_VOLUME_INFORMATION 1001
328 #define SMB_FS_LABEL_INFORMATION 1002
329 #define SMB_FS_SIZE_INFORMATION 1003
330 #define SMB_FS_DEVICE_INFORMATION 1004
331 #define SMB_FS_ATTRIBUTE_INFORMATION 1005
332 #define SMB_FS_QUOTA_INFORMATION 1006
333 #define SMB_FS_FULL_SIZE_INFORMATION 1007
334 #define SMB_FS_OBJECTID_INFORMATION 1008
336 /* flags on trans2 findfirst/findnext that control search */
337 #define FLAG_TRANS2_FIND_CLOSE 0x1
338 #define FLAG_TRANS2_FIND_CLOSE_IF_END 0x2
339 #define FLAG_TRANS2_FIND_REQUIRE_RESUME 0x4
340 #define FLAG_TRANS2_FIND_CONTINUE 0x8
341 #define FLAG_TRANS2_FIND_BACKUP_INTENT 0x10
343 /* UNIX CIFS Extensions - created by HP */
345 * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
346 * Supposedly Microsoft have agreed to this.
349 #define MIN_UNIX_INFO_LEVEL 0x200
350 #define MAX_UNIX_INFO_LEVEL 0x2FF
352 #define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
354 #define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/
355 #define SMB_SET_FILE_UNIX_BASIC 0x200
356 #define SMB_SET_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
358 #define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */
359 /* means "don't change it" */
360 #define SMB_UID_NO_CHANGE 0xFFFFFFFF
361 #define SMB_GID_NO_CHANGE 0xFFFFFFFF
363 #define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF
364 #define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF
366 #define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF
367 #define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF
370 Offset Size Name
371 0 LARGE_INTEGER EndOfFile File size
372 8 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks).
373 16 LARGE_INTEGER CreationTime Creation time
374 24 LARGE_INTEGER LastAccessTime Last access time
375 32 LARGE_INTEGER LastModificationTime Last modification time
376 40 LARGE_INTEGER Uid Numeric user id for the owner
377 48 LARGE_INTEGER Gid Numeric group id of owner
378 56 ULONG Type Enumeration specifying the pathname type:
379 0 -- File
380 1 -- Directory
381 2 -- Symbolic link
382 3 -- Character device
383 4 -- Block device
384 5 -- FIFO (named pipe)
385 6 -- Unix domain socket
387 60 LARGE_INTEGER devmajor Major device number if type is device
388 68 LARGE_INTEGER devminor Minor device number if type is device
389 76 LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client
390 will typically map this onto an inode number. The scope of
391 uniqueness is the share.
392 84 LARGE_INTEGER permissions Standard UNIX file permissions - see below.
393 92 LARGE_INTEGER nlinks The number of directory entries that map to this entry
394 (number of hard links)
396 100 - end.
399 #define SMB_FILE_UNIX_BASIC_SIZE 100
401 /* UNIX filetype mappings. */
403 #define UNIX_TYPE_FILE 0
404 #define UNIX_TYPE_DIR 1
405 #define UNIX_TYPE_SYMLINK 2
406 #define UNIX_TYPE_CHARDEV 3
407 #define UNIX_TYPE_BLKDEV 4
408 #define UNIX_TYPE_FIFO 5
409 #define UNIX_TYPE_SOCKET 6
410 #define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
413 * Oh this is fun. "Standard UNIX permissions" has no
414 * meaning in POSIX. We need to define the mapping onto
415 * and off the wire as this was not done in the original HP
416 * spec. JRA.
419 #define UNIX_X_OTH 0000001
420 #define UNIX_W_OTH 0000002
421 #define UNIX_R_OTH 0000004
422 #define UNIX_X_GRP 0000010
423 #define UNIX_W_GRP 0000020
424 #define UNIX_R_GRP 0000040
425 #define UNIX_X_USR 0000100
426 #define UNIX_W_USR 0000200
427 #define UNIX_R_USR 0000400
428 #define UNIX_STICKY 0001000
429 #define UNIX_SET_GID 0002000
430 #define UNIX_SET_UID 0004000
432 /* Masks for the above */
433 #define UNIX_OTH_MASK 0000007
434 #define UNIX_GRP_MASK 0000070
435 #define UNIX_USR_MASK 0000700
436 #define UNIX_PERM_MASK 0000777
437 #define UNIX_EXTRA_MASK 0007000
438 #define UNIX_ALL_MASK 0007777
440 /* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and
441 * SMB_QUERY_FILE_UNIX_INFO2.
443 #define EXT_SECURE_DELETE 0x00000001
444 #define EXT_ENABLE_UNDELETE 0x00000002
445 #define EXT_SYNCHRONOUS 0x00000004
446 #define EXT_IMMUTABLE 0x00000008
447 #define EXT_OPEN_APPEND_ONLY 0x00000010
448 #define EXT_DO_NOT_BACKUP 0x00000020
449 #define EXT_NO_UPDATE_ATIME 0x00000040
450 #define EXT_HIDDEN 0x00000080
452 #define SMB_QUERY_FILE_UNIX_LINK 0x201
453 #define SMB_SET_FILE_UNIX_LINK 0x201
454 #define SMB_SET_FILE_UNIX_HLINK 0x203
455 /* SMB_QUERY_POSIX_ACL 0x204 see below */
456 #define SMB_QUERY_XATTR 0x205 /* need for non-user XATTRs */
457 #define SMB_QUERY_ATTR_FLAGS 0x206 /* chflags, chattr */
458 #define SMB_SET_ATTR_FLAGS 0x206
459 #define SMB_QUERY_POSIX_PERMISSION 0x207
460 /* Only valid for qfileinfo */
461 #define SMB_QUERY_POSIX_LOCK 0x208
462 /* Only valid for setfileinfo */
463 #define SMB_SET_POSIX_LOCK 0x208
465 /* The set info levels for POSIX path operations. */
466 #define SMB_POSIX_PATH_OPEN 0x209
467 #define SMB_POSIX_PATH_UNLINK 0x20A
469 #define SMB_QUERY_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
470 #define SMB_SET_FILE_UNIX_INFO2 0x20B
473 SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create
474 time and file flags appended. The corresponding info level for
475 findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
476 Size Offset Value
477 ---------------------
478 0 LARGE_INTEGER EndOfFile File size
479 8 LARGE_INTEGER Blocks Number of blocks used on disk
480 16 LARGE_INTEGER ChangeTime Attribute change time
481 24 LARGE_INTEGER LastAccessTime Last access time
482 32 LARGE_INTEGER LastModificationTime Last modification time
483 40 LARGE_INTEGER Uid Numeric user id for the owner
484 48 LARGE_INTEGER Gid Numeric group id of owner
485 56 ULONG Type Enumeration specifying the file type
486 60 LARGE_INTEGER devmajor Major device number if type is device
487 68 LARGE_INTEGER devminor Minor device number if type is device
488 76 LARGE_INTEGER uniqueid This is a server-assigned unique id
489 84 LARGE_INTEGER permissions Standard UNIX permissions
490 92 LARGE_INTEGER nlinks Number of hard links
491 100 LARGE_INTEGER CreationTime Create/birth time
492 108 ULONG FileFlags File flags enumeration
493 112 ULONG FileFlagsMask Mask of valid flags
496 /* Transact 2 Find First levels */
497 #define SMB_FIND_FILE_UNIX 0x202
498 #define SMB_FIND_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
500 #define SMB_FILE_UNIX_INFO2_SIZE 116
503 Info level for TRANS2_QFSINFO - returns version of CIFS UNIX extensions, plus
504 64-bits worth of capability fun :-).
505 Use the same info level for TRANS2_SETFSINFO
508 #define SMB_QUERY_CIFS_UNIX_INFO 0x200
509 #define SMB_SET_CIFS_UNIX_INFO 0x200
511 /* Returns or sets the following.
513 UINT16 major version number
514 UINT16 minor version number
515 LARGE_INTEGER capability bitfield
519 #define CIFS_UNIX_MAJOR_VERSION 1
520 #define CIFS_UNIX_MINOR_VERSION 0
522 #define CIFS_UNIX_FCNTL_LOCKS_CAP 0x1
523 #define CIFS_UNIX_POSIX_ACLS_CAP 0x2
524 #define CIFS_UNIX_XATTTR_CAP 0x4 /* for support of other xattr
525 namespaces such as system,
526 security and trusted */
527 #define CIFS_UNIX_EXTATTR_CAP 0x8 /* for support of chattr
528 (chflags) and lsattr */
529 #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x10 /* Use POSIX pathnames on the wire. */
530 #define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP 0x20 /* We can cope with POSIX open/mkdir/unlink etc. */
531 #define CIFS_UNIX_LARGE_READ_CAP 0x40 /* We can cope with 24 bit reads in readX. */
532 #define CIFS_UNIX_LARGE_WRITE_CAP 0x80 /* We can cope with 24 bit writes in writeX. */
533 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x100 /* We can do SPNEGO negotiations for encryption. */
534 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x200 /* We *must* SPNEGO negotiations for encryption. */
536 #define SMB_QUERY_POSIX_FS_INFO 0x201
538 /* Returns FILE_SYSTEM_POSIX_INFO struct as follows
539 (NB For undefined values return -1 in that field)
540 le32 OptimalTransferSize; bsize on some os, iosize on other os, This
541 is a hint to the client about best size. Server
542 can return -1 if no preference, ie if SMB
543 negotiated size is adequate for optimal
544 read/write performance
545 le32 BlockSize; (often 512 bytes) NB: BlockSize * TotalBlocks = disk space
546 le64 TotalBlocks; redundant with other infolevels but easy to ret here
547 le64 BlocksAvail; although redundant, easy to return
548 le64 UserBlocksAvail; bavail
549 le64 TotalFileNodes;
550 le64 FreeFileNodes;
551 le64 FileSysIdentifier; fsid
552 (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call)
553 (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call)
556 #define SMB_QUERY_POSIX_WHO_AM_I 0x202 /* QFS Info */
557 /* returns:
558 __u32 flags; 0 = Authenticated user 1 = GUEST
559 __u32 mask; which flags bits server understands ie 0x0001
560 __u64 unix_user_id;
561 __u64 unix_user_gid;
562 __u32 number_of_supplementary_gids; may be zero
563 __u32 number_of_sids; may be zero
564 __u32 length_of_sid_array; in bytes - may be zero
565 __u32 pad; reserved - MBZ
566 __u64 gid_array[0]; may be empty
567 __u8 * psid_list may be empty
570 /* ... more as we think of them :-). */
572 /* SMB POSIX ACL definitions. */
573 /* Wire format is (all little endian) :
575 [2 bytes] - Version number.
576 [2 bytes] - Number of ACE entries to follow.
577 [2 bytes] - Number of default ACE entries to follow.
578 -------------------------------------
581 ACE entries
584 -------------------------------------
587 Default ACE entries
590 -------------------------------------
592 Where an ACE entry looks like :
594 [1 byte] - Entry type.
596 Entry types are :
598 ACL_USER_OBJ 0x01
599 ACL_USER 0x02
600 ACL_GROUP_OBJ 0x04
601 ACL_GROUP 0x08
602 ACL_MASK 0x10
603 ACL_OTHER 0x20
605 [1 byte] - permissions (perm_t)
607 perm_t types are :
609 ACL_READ 0x04
610 ACL_WRITE 0x02
611 ACL_EXECUTE 0x01
613 [8 bytes] - uid/gid to apply this permission to.
615 In the same format as the uid/gid fields in the other
616 UNIX extensions definitions. Use 0xFFFFFFFFFFFFFFFF for
617 the MASK and OTHER entry types.
619 If the Number of ACE entries for either file or default ACE's
620 is set to 0xFFFF this means ignore this kind of ACE (and the
621 number of entries sent will be zero.
625 #define SMB_QUERY_POSIX_WHOAMI 0x202
627 enum smb_whoami_flags {
628 SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */
631 /* Mask of which WHOAMI bits are valid. This should make it easier for clients
632 * to cope with servers that have different sets of WHOAMI flags (as more get
633 * added).
635 #define SMB_WHOAMI_MASK 0x00000001
638 SMBWhoami - Query the user mapping performed by the server for the
639 connected tree. This is a subcommand of the TRANS2_QFSINFO.
641 Returns:
642 4 bytes unsigned - mapping flags (smb_whoami_flags)
643 4 bytes unsigned - flags mask
645 8 bytes unsigned - primary UID
646 8 bytes unsigned - primary GID
647 4 bytes unsigned - number of supplementary GIDs
648 4 bytes unsigned - number of SIDs
649 4 bytes unsigned - SID list byte count
650 4 bytes - pad / reserved (must be zero)
652 8 bytes unsigned[] - list of GIDs (may be empty)
653 DOM_SID[] - list of SIDs (may be empty)
657 * The following trans2 is done between client and server
658 * as a FSINFO call to set up the encryption state for transport
659 * encryption.
660 * This is a subcommand of the TRANS2_QFSINFO.
662 * The request looks like :
664 * [data block] -> SPNEGO framed GSSAPI request.
666 * The reply looks like :
668 * [data block] -> SPNEGO framed GSSAPI reply - if error
669 * is NT_STATUS_OK then we're done, if it's
670 * NT_STATUS_MORE_PROCESSING_REQUIRED then the
671 * client needs to keep going. If it's an
672 * error it can be any NT_STATUS error.
676 #define SMB_REQUEST_TRANSPORT_ENCRYPTION 0x203 /* QFSINFO */
679 /* The query/set info levels for POSIX ACLs. */
680 #define SMB_QUERY_POSIX_ACL 0x204
681 #define SMB_SET_POSIX_ACL 0x204
683 /* Current on the wire ACL version. */
684 #define SMB_POSIX_ACL_VERSION 1
686 /* ACE entry type. */
687 #define SMB_POSIX_ACL_USER_OBJ 0x01
688 #define SMB_POSIX_ACL_USER 0x02
689 #define SMB_POSIX_ACL_GROUP_OBJ 0x04
690 #define SMB_POSIX_ACL_GROUP 0x08
691 #define SMB_POSIX_ACL_MASK 0x10
692 #define SMB_POSIX_ACL_OTHER 0x20
694 /* perm_t types. */
695 #define SMB_POSIX_ACL_READ 0x04
696 #define SMB_POSIX_ACL_WRITE 0x02
697 #define SMB_POSIX_ACL_EXECUTE 0x01
699 #define SMB_POSIX_ACL_HEADER_SIZE 6
700 #define SMB_POSIX_ACL_ENTRY_SIZE 10
702 #define SMB_POSIX_IGNORE_ACE_ENTRIES 0xFFFF
704 /* Definition of data block of SMB_SET_POSIX_LOCK */
706 [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock
707 [2 bytes] lock_flags - 1 = Wait (only valid for setlock)
708 [4 bytes] pid = locking context.
709 [8 bytes] start = unsigned 64 bits.
710 [8 bytes] length = unsigned 64 bits.
713 #define POSIX_LOCK_TYPE_OFFSET 0
714 #define POSIX_LOCK_FLAGS_OFFSET 2
715 #define POSIX_LOCK_PID_OFFSET 4
716 #define POSIX_LOCK_START_OFFSET 8
717 #define POSIX_LOCK_LEN_OFFSET 16
718 #define POSIX_LOCK_DATA_SIZE 24
720 #define POSIX_LOCK_FLAG_NOWAIT 0
721 #define POSIX_LOCK_FLAG_WAIT 1
723 #define POSIX_LOCK_TYPE_READ 0
724 #define POSIX_LOCK_TYPE_WRITE 1
725 #define POSIX_LOCK_TYPE_UNLOCK 2
727 /* SMB_POSIX_PATH_OPEN "open_mode" definitions. */
728 #define SMB_O_RDONLY 0x1
729 #define SMB_O_WRONLY 0x2
730 #define SMB_O_RDWR 0x4
732 #define SMB_ACCMODE 0x7
734 #define SMB_O_CREAT 0x10
735 #define SMB_O_EXCL 0x20
736 #define SMB_O_TRUNC 0x40
737 #define SMB_O_APPEND 0x80
738 #define SMB_O_SYNC 0x100
739 #define SMB_O_DIRECTORY 0x200
740 #define SMB_O_NOFOLLOW 0x400
741 #define SMB_O_DIRECT 0x800
743 /* Definition of request data block for SMB_POSIX_PATH_OPEN */
745 [4 bytes] flags (as smb_ntcreate_Flags).
746 [4 bytes] open_mode - SMB_O_xxx flags above.
747 [8 bytes] mode_t (permissions) - same encoding as "Standard UNIX permissions" above in SMB_SET_FILE_UNIX_BASIC.
748 [2 bytes] ret_info_level - optimization. Info level to be returned.
751 /* Definition of reply data block for SMB_POSIX_PATH_OPEN */
753 #define SMB_NO_INFO_LEVEL_RETURNED 0xFFFF
756 [2 bytes] - flags field. Identical to flags reply for oplock response field in SMBNTCreateX)
757 [2 bytes] - FID returned.
758 [4 bytes] - CreateAction (same as in NTCreateX response).
759 [2 bytes] - reply info level - as requested or 0xFFFF if not available.
760 [2 bytes] - padding (must be zero)
761 [n bytes] - info level reply - if available.
764 /* Definition of request data block for SMB_POSIX_UNLINK */
766 [2 bytes] flags (defined below).
769 #define SMB_POSIX_UNLINK_FILE_TARGET 0
770 #define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
772 #endif