Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/include/trans2.h

    r740 r988  
    282282#define TYPE_MOUNTED                    0x20
    283283#define TYPE_VIRTUAL                    0x40
     284
     285/* SMB_FS_SECTOR_SIZE_INFORMATION values */
     286#define SSINFO_FLAGS_ALIGNED_DEVICE                     0x00000001
     287#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE        0x00000002
     288#define SSINFO_FLAGS_NO_SEEK_PENALTY                    0x00000004
     289#define SSINFO_FLAGS_TRIM_ENABLED                       0x00000008
     290
     291#define SSINFO_OFFSET_UNKNOWN                           0xffffffff
    284292
    285293/* NT passthrough levels... */
     
    334342#define SMB_FS_FULL_SIZE_INFORMATION                    1007
    335343#define SMB_FS_OBJECTID_INFORMATION                     1008
     344#define SMB_FS_SECTOR_SIZE_INFORMATION                  1011
    336345
    337346/* SMB_FS_DEVICE_INFORMATION device types. */
     
    356365#define FLAG_TRANS2_FIND_BACKUP_INTENT  0x10
    357366
    358 /* UNIX CIFS Extensions - created by HP */
    359 /*
    360  * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
    361  * Supposedly Microsoft have agreed to this.
    362  */
    363 
    364 #define MIN_UNIX_INFO_LEVEL 0x200
    365 #define MAX_UNIX_INFO_LEVEL 0x2FF
    366 
    367 #define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
    368 
    369 #define SMB_QUERY_FILE_UNIX_BASIC      0x200   /* UNIX File Info*/
    370 #define SMB_SET_FILE_UNIX_BASIC        0x200
    371 #define SMB_SET_FILE_UNIX_INFO2        0x20B   /* UNIX File Info2 */
    372 
    373 #define SMB_MODE_NO_CHANGE                 0xFFFFFFFF     /* file mode value which */
    374                                               /* means "don't change it" */
    375 #define SMB_UID_NO_CHANGE                  0xFFFFFFFF
    376 #define SMB_GID_NO_CHANGE                  0xFFFFFFFF
    377 
    378 #define SMB_SIZE_NO_CHANGE_LO              0xFFFFFFFF
    379 #define SMB_SIZE_NO_CHANGE_HI              0xFFFFFFFF
    380  
    381 #define SMB_TIME_NO_CHANGE_LO              0xFFFFFFFF
    382 #define SMB_TIME_NO_CHANGE_HI              0xFFFFFFFF
    383 
    384 /*
    385 Offset Size         Name
    386 0      LARGE_INTEGER EndOfFile                File size
    387 8      LARGE_INTEGER Blocks                   Number of bytes used on disk (st_blocks).
    388 16     LARGE_INTEGER CreationTime             Creation time
    389 24     LARGE_INTEGER LastAccessTime           Last access time
    390 32     LARGE_INTEGER LastModificationTime     Last modification time
    391 40     LARGE_INTEGER Uid                      Numeric user id for the owner
    392 48     LARGE_INTEGER Gid                      Numeric group id of owner
    393 56     ULONG Type                             Enumeration specifying the pathname type:
    394                                               0 -- File
    395                                               1 -- Directory
    396                                               2 -- Symbolic link
    397                                               3 -- Character device
    398                                               4 -- Block device
    399                                               5 -- FIFO (named pipe)
    400                                               6 -- Unix domain socket
    401 
    402 60     LARGE_INTEGER devmajor                 Major device number if type is device
    403 68     LARGE_INTEGER devminor                 Minor device number if type is device
    404 76     LARGE_INTEGER uniqueid                 This is a server-assigned unique id for the file. The client
    405                                               will typically map this onto an inode number. The scope of
    406                                               uniqueness is the share.
    407 84     LARGE_INTEGER permissions              Standard UNIX file permissions  - see below.
    408 92     LARGE_INTEGER nlinks                   The number of directory entries that map to this entry
    409                                               (number of hard links)
    410 
    411 100 - end.
    412 */
    413 
    414 #define SMB_FILE_UNIX_BASIC_SIZE 100
    415 
    416 /* UNIX filetype mappings. */
    417 
    418 #define UNIX_TYPE_FILE 0
    419 #define UNIX_TYPE_DIR 1
    420 #define UNIX_TYPE_SYMLINK 2
    421 #define UNIX_TYPE_CHARDEV 3
    422 #define UNIX_TYPE_BLKDEV 4
    423 #define UNIX_TYPE_FIFO 5
    424 #define UNIX_TYPE_SOCKET 6
    425 #define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
    426 
    427 /*
    428  * Oh this is fun. "Standard UNIX permissions" has no
    429  * meaning in POSIX. We need to define the mapping onto
    430  * and off the wire as this was not done in the original HP
    431  * spec. JRA.
    432  */
    433 
    434 #define UNIX_X_OTH                      0000001
    435 #define UNIX_W_OTH                      0000002
    436 #define UNIX_R_OTH                      0000004
    437 #define UNIX_X_GRP                      0000010
    438 #define UNIX_W_GRP                      0000020
    439 #define UNIX_R_GRP                      0000040
    440 #define UNIX_X_USR                      0000100
    441 #define UNIX_W_USR                      0000200
    442 #define UNIX_R_USR                      0000400
    443 #define UNIX_STICKY                     0001000
    444 #define UNIX_SET_GID                    0002000
    445 #define UNIX_SET_UID                    0004000
    446 
    447 /* Masks for the above */
    448 #define UNIX_OTH_MASK                   0000007
    449 #define UNIX_GRP_MASK                   0000070
    450 #define UNIX_USR_MASK                   0000700
    451 #define UNIX_PERM_MASK                  0000777
    452 #define UNIX_EXTRA_MASK                 0007000
    453 #define UNIX_ALL_MASK                   0007777
    454 
    455 /* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and
    456  * SMB_QUERY_FILE_UNIX_INFO2.
    457  */
    458 #define EXT_SECURE_DELETE               0x00000001
    459 #define EXT_ENABLE_UNDELETE             0x00000002
    460 #define EXT_SYNCHRONOUS                 0x00000004
    461 #define EXT_IMMUTABLE                   0x00000008
    462 #define EXT_OPEN_APPEND_ONLY            0x00000010
    463 #define EXT_DO_NOT_BACKUP               0x00000020
    464 #define EXT_NO_UPDATE_ATIME             0x00000040
    465 #define EXT_HIDDEN                      0x00000080
    466 
    467 #define SMB_QUERY_FILE_UNIX_LINK       0x201
    468 #define SMB_SET_FILE_UNIX_LINK         0x201
    469 #define SMB_SET_FILE_UNIX_HLINK        0x203
    470 /* SMB_QUERY_POSIX_ACL 0x204 see below */
    471 #define SMB_QUERY_XATTR                0x205 /* need for non-user XATTRs */
    472 #define SMB_QUERY_ATTR_FLAGS           0x206 /* chflags, chattr */
    473 #define SMB_SET_ATTR_FLAGS             0x206
    474 #define SMB_QUERY_POSIX_PERMISSION     0x207
    475 /* Only valid for qfileinfo */
    476 #define SMB_QUERY_POSIX_LOCK           0x208
    477 /* Only valid for setfileinfo */
    478 #define SMB_SET_POSIX_LOCK             0x208
    479 
    480 /* The set info levels for POSIX path operations. */
    481 #define SMB_POSIX_PATH_OPEN            0x209
    482 #define SMB_POSIX_PATH_UNLINK          0x20A
    483 
    484 #define SMB_QUERY_FILE_UNIX_INFO2      0x20B   /* UNIX File Info2 */
    485 #define SMB_SET_FILE_UNIX_INFO2        0x20B
    486 
    487 /*
    488 SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create
    489 time and file flags appended. The corresponding info level for
    490 findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
    491     Size    Offset  Value
    492     ---------------------
    493     0      LARGE_INTEGER EndOfFile  File size
    494     8      LARGE_INTEGER Blocks     Number of blocks used on disk
    495     16     LARGE_INTEGER ChangeTime Attribute change time
    496     24     LARGE_INTEGER LastAccessTime           Last access time
    497     32     LARGE_INTEGER LastModificationTime     Last modification time
    498     40     LARGE_INTEGER Uid        Numeric user id for the owner
    499     48     LARGE_INTEGER Gid        Numeric group id of owner
    500     56     ULONG Type               Enumeration specifying the file type
    501     60     LARGE_INTEGER devmajor   Major device number if type is device
    502     68     LARGE_INTEGER devminor   Minor device number if type is device
    503     76     LARGE_INTEGER uniqueid   This is a server-assigned unique id
    504     84     LARGE_INTEGER permissions            Standard UNIX permissions
    505     92     LARGE_INTEGER nlinks                 Number of hard links
    506     100    LARGE_INTEGER CreationTime           Create/birth time
    507     108    ULONG FileFlags          File flags enumeration
    508     112    ULONG FileFlagsMask      Mask of valid flags
    509 */
    510 
    511 /* Transact 2 Find First levels */
    512 #define SMB_FIND_FILE_UNIX             0x202
    513 #define SMB_FIND_FILE_UNIX_INFO2       0x20B /* UNIX File Info2 */
    514 
    515 #define SMB_FILE_UNIX_INFO2_SIZE 116
    516 
    517 /*
    518  Info level for TRANS2_QFSINFO - returns version of CIFS UNIX extensions, plus
    519  64-bits worth of capability fun :-).
    520  Use the same info level for TRANS2_SETFSINFO
    521 */
    522 
    523 #define SMB_QUERY_CIFS_UNIX_INFO      0x200
    524 #define SMB_SET_CIFS_UNIX_INFO        0x200
    525 
    526 /* Returns or sets the following.
    527 
    528   UINT16             major version number
    529   UINT16             minor version number
    530   LARGE_INTEGER      capability bitfield
    531 
    532 */
    533 
    534 #define CIFS_UNIX_MAJOR_VERSION 1
    535 #define CIFS_UNIX_MINOR_VERSION 0
    536 
    537 #define CIFS_UNIX_FCNTL_LOCKS_CAP           0x1
    538 #define CIFS_UNIX_POSIX_ACLS_CAP            0x2
    539 #define CIFS_UNIX_XATTTR_CAP                0x4 /* for support of other xattr
    540                                                 namespaces such as system,
    541                                                 security and trusted */
    542 #define CIFS_UNIX_EXTATTR_CAP               0x8 /* for support of chattr
    543                                                 (chflags) and lsattr */
    544 #define CIFS_UNIX_POSIX_PATHNAMES_CAP      0x10 /* Use POSIX pathnames on the wire. */
    545 #define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP        0x20 /* We can cope with POSIX open/mkdir/unlink etc. */
    546 #define CIFS_UNIX_LARGE_READ_CAP           0x40 /* We can cope with 24 bit reads in readX. */
    547 #define CIFS_UNIX_LARGE_WRITE_CAP          0x80 /* We can cope with 24 bit writes in writeX. */
    548 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP      0x100 /* We can do SPNEGO negotiations for encryption. */
    549 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP    0x200 /* We *must* SPNEGO negotiations for encryption. */
    550 
    551 #define SMB_QUERY_POSIX_FS_INFO     0x201
    552 
    553 /* Returns FILE_SYSTEM_POSIX_INFO struct as follows
    554       (NB   For undefined values return -1 in that field)
    555    le32 OptimalTransferSize;    bsize on some os, iosize on other os, This
    556                                 is a hint to the client about best size. Server
    557                                 can return -1 if no preference, ie if SMB
    558                                 negotiated size is adequate for optimal
    559                                 read/write performance
    560    le32 BlockSize; (often 512 bytes) NB: BlockSize * TotalBlocks = disk space
    561    le64 TotalBlocks;  redundant with other infolevels but easy to ret here
    562    le64 BlocksAvail;  although redundant, easy to return
    563    le64 UserBlocksAvail;      bavail
    564    le64 TotalFileNodes;
    565    le64 FreeFileNodes;
    566    le64 FileSysIdentifier;    fsid
    567    (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call)
    568    (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call) 
    569 */
    570 
    571 #define SMB_QUERY_POSIX_WHO_AM_I  0x202 /* QFS Info */
    572 /* returns:
    573         __u32 flags;  0 = Authenticated user 1 = GUEST
    574         __u32 mask;  which flags bits server understands ie 0x0001
    575         __u64 unix_user_id;
    576         __u64 unix_user_gid;
    577         __u32 number_of_supplementary_gids;  may be zero
    578         __u32 number_of_sids;  may be zero
    579         __u32 length_of_sid_array;  in bytes - may be zero
    580         __u32 pad;  reserved - MBZ
    581         __u64 gid_array[0];  may be empty
    582         __u8 * psid_list  may be empty
    583 */
    584 
    585 /* ... more as we think of them :-). */
    586 
    587 /* SMB POSIX ACL definitions. */
    588 /* Wire format is (all little endian) :
    589 
    590 [2 bytes]              -     Version number.
    591 [2 bytes]              -     Number of ACE entries to follow.
    592 [2 bytes]              -     Number of default ACE entries to follow.
    593 -------------------------------------
    594 ^
    595 |
    596 ACE entries
    597 |
    598 v
    599 -------------------------------------
    600 ^
    601 |
    602 Default ACE entries
    603 |
    604 v
    605 -------------------------------------
    606 
    607 Where an ACE entry looks like :
    608 
    609 [1 byte]           - Entry type.
    610 
    611 Entry types are :
    612 
    613 ACL_USER_OBJ            0x01
    614 ACL_USER                0x02
    615 ACL_GROUP_OBJ           0x04
    616 ACL_GROUP               0x08
    617 ACL_MASK                0x10
    618 ACL_OTHER               0x20
    619 
    620 [1 byte]          - permissions (perm_t)
    621 
    622 perm_t types are :
    623 
    624 ACL_READ                0x04
    625 ACL_WRITE               0x02
    626 ACL_EXECUTE             0x01
    627 
    628 [8 bytes]         - uid/gid to apply this permission to.
    629 
    630 In the same format as the uid/gid fields in the other
    631 UNIX extensions definitions. Use 0xFFFFFFFFFFFFFFFF for
    632 the MASK and OTHER entry types.
    633 
    634 If the Number of ACE entries for either file or default ACE's
    635 is set to 0xFFFF this means ignore this kind of ACE (and the
    636 number of entries sent will be zero.
    637 
    638 */
    639 
    640 #define SMB_QUERY_POSIX_WHOAMI     0x202
    641 
    642 enum smb_whoami_flags {
    643     SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */
    644 };
    645 
    646 /* Mask of which WHOAMI bits are valid. This should make it easier for clients
    647  * to cope with servers that have different sets of WHOAMI flags (as more get
    648  * added).
    649  */
    650 #define SMB_WHOAMI_MASK 0x00000001
    651 
    652 /*
    653    SMBWhoami - Query the user mapping performed by the server for the
    654    connected tree. This is a subcommand of the TRANS2_QFSINFO.
    655 
    656    Returns:
    657         4 bytes unsigned -      mapping flags (smb_whoami_flags)
    658         4 bytes unsigned -      flags mask
    659 
    660         8 bytes unsigned -      primary UID
    661         8 bytes unsigned -      primary GID
    662         4 bytes unsigned -      number of supplementary GIDs
    663         4 bytes unsigned -      number of SIDs
    664         4 bytes unsigned -      SID list byte count
    665         4 bytes -               pad / reserved (must be zero)
    666 
    667         8 bytes unsigned[] -    list of GIDs (may be empty)
    668         struct dom_sid[] -              list of SIDs (may be empty)
    669 */
    670 
    671 /*
    672  * The following trans2 is done between client and server
    673  * as a FSINFO call to set up the encryption state for transport
    674  * encryption.
    675  * This is a subcommand of the TRANS2_QFSINFO.
    676  *
    677  * The request looks like :
    678  *
    679  * [data block] -> SPNEGO framed GSSAPI request.
    680  *
    681  * The reply looks like :
    682  *
    683  * [data block] -> SPNEGO framed GSSAPI reply - if error
    684  *                 is NT_STATUS_OK then we're done, if it's
    685  *                 NT_STATUS_MORE_PROCESSING_REQUIRED then the
    686  *                 client needs to keep going. If it's an
    687  *                 error it can be any NT_STATUS error.
    688  *
    689  */
    690 
    691 #define SMB_REQUEST_TRANSPORT_ENCRYPTION     0x203 /* QFSINFO */
    692 
    693 
    694 /* The query/set info levels for POSIX ACLs. */
    695 #define SMB_QUERY_POSIX_ACL  0x204
    696 #define SMB_SET_POSIX_ACL  0x204
    697 
    698 /* Current on the wire ACL version. */
    699 #define SMB_POSIX_ACL_VERSION 1
    700 
    701 /* ACE entry type. */
    702 #define SMB_POSIX_ACL_USER_OBJ            0x01
    703 #define SMB_POSIX_ACL_USER                0x02
    704 #define SMB_POSIX_ACL_GROUP_OBJ           0x04
    705 #define SMB_POSIX_ACL_GROUP               0x08
    706 #define SMB_POSIX_ACL_MASK                0x10
    707 #define SMB_POSIX_ACL_OTHER               0x20
    708 
    709 /* perm_t types. */
    710 #define SMB_POSIX_ACL_READ                0x04
    711 #define SMB_POSIX_ACL_WRITE               0x02
    712 #define SMB_POSIX_ACL_EXECUTE             0x01
    713 
    714 #define SMB_POSIX_ACL_HEADER_SIZE         6
    715 #define SMB_POSIX_ACL_ENTRY_SIZE         10
    716 
    717 #define SMB_POSIX_IGNORE_ACE_ENTRIES    0xFFFF
    718 
    719 /* Definition of data block of SMB_SET_POSIX_LOCK */
    720 /*
    721   [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock
    722   [2 bytes] lock_flags - 1 = Wait (only valid for setlock)
    723   [4 bytes] pid = locking context.
    724   [8 bytes] start = unsigned 64 bits.
    725   [8 bytes] length = unsigned 64 bits.
    726 */
    727 
    728 #define POSIX_LOCK_TYPE_OFFSET 0
    729 #define POSIX_LOCK_FLAGS_OFFSET 2
    730 #define POSIX_LOCK_PID_OFFSET 4
    731 #define POSIX_LOCK_START_OFFSET 8
    732 #define POSIX_LOCK_LEN_OFFSET 16
    733 #define POSIX_LOCK_DATA_SIZE 24
    734 
    735 #define POSIX_LOCK_FLAG_NOWAIT 0
    736 #define POSIX_LOCK_FLAG_WAIT 1
    737 
    738 #define POSIX_LOCK_TYPE_READ 0
    739 #define POSIX_LOCK_TYPE_WRITE 1
    740 #define POSIX_LOCK_TYPE_UNLOCK 2
    741 
    742 /* SMB_POSIX_PATH_OPEN "open_mode" definitions. */
    743 #define SMB_O_RDONLY                      0x1
    744 #define SMB_O_WRONLY                      0x2
    745 #define SMB_O_RDWR                        0x4
    746 
    747 #define SMB_ACCMODE                       0x7
    748 
    749 #define SMB_O_CREAT                      0x10
    750 #define SMB_O_EXCL                       0x20
    751 #define SMB_O_TRUNC                      0x40
    752 #define SMB_O_APPEND                     0x80
    753 #define SMB_O_SYNC                      0x100
    754 #define SMB_O_DIRECTORY                 0x200
    755 #define SMB_O_NOFOLLOW                  0x400
    756 #define SMB_O_DIRECT                    0x800
    757 
    758 /* Definition of request data block for SMB_POSIX_PATH_OPEN */
    759 /*
    760   [4 bytes] flags (as smb_ntcreate_Flags).
    761   [4 bytes] open_mode                   - SMB_O_xxx flags above.
    762   [8 bytes] mode_t (permissions)        - same encoding as "Standard UNIX permissions" above in SMB_SET_FILE_UNIX_BASIC.
    763   [2 bytes] ret_info_level      - optimization. Info level to be returned.
    764 */
    765 
    766 /* Definition of reply data block for SMB_POSIX_PATH_OPEN */
    767 
    768 #define SMB_NO_INFO_LEVEL_RETURNED 0xFFFF
    769 
    770 /*
    771   [2 bytes] - flags field. Identical to flags reply for oplock response field in SMBNTCreateX)
    772   [2 bytes] - FID returned.
    773   [4 bytes] - CreateAction (same as in NTCreateX response).
    774   [2 bytes] - reply info level    - as requested or 0xFFFF if not available.
    775   [2 bytes] - padding (must be zero)
    776   [n bytes] - info level reply  - if available.
    777 */
    778 
    779 /* Definition of request data block for SMB_POSIX_UNLINK */
    780 /*
    781   [2 bytes] flags (defined below).
    782 */
    783 
    784 #define SMB_POSIX_UNLINK_FILE_TARGET 0
    785 #define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
    786 
    787367#endif
Note: See TracChangeset for help on using the changeset viewer.