UNIX Extensions: Difference between revisions
Line 76: | Line 76: | ||
SMBWhoami is performed by requesting a TRANS2_QFSINFO with an info level of SMB_QUERY_POSIX_WHOAMI. There are no parameters passed. The vuid field is implicitly used. |
SMBWhoami is performed by requesting a TRANS2_QFSINFO with an info level of SMB_QUERY_POSIX_WHOAMI. There are no parameters passed. The vuid field is implicitly used. |
||
#define SMB_QUERY_POSIX_WHOAMI 0x202 |
|||
{| |
{| |
||
! Info Level Name !! Value |
|||
|- |
|- |
||
|| SMB_QUERY_POSIX_WHOAMI || 0x202 |
|| SMB_QUERY_POSIX_WHOAMI || 0x202 |
||
|} |
|} |
||
The first two fields of the SMBWhoami response are a set of flags that further describe how the server has mapped the connected user. The mask is returned so that the client can distinguish which flag bits are meaningful. |
|||
{| |
|||
⚫ | |||
!Mapping Flag !! Value !! Interpretation |
|||
|- |
|||
⚫ | |||
|} |
|||
{| |
{| |
||
Line 109: | Line 113: | ||
|| variable || ... || List of DOM_SID structures (may be empty) |
|| variable || ... || List of DOM_SID structures (may be empty) |
||
|} |
|} |
||
Note that the list of group IDs and DOM_SIDs are both optional. A server may choose not to return these (eg. if the information is expensive to gather). If these are not returned the corresponding count fields must be zero. |
|||
== UNIX_INFO2 == |
== UNIX_INFO2 == |
Revision as of 22:21, 27 February 2007
See http://samba.org/samba/CIFS_POSIX_extensions.html
All Unix extensions are TRANSACT2 commands in the range from 0x200 to 0x2FF (inclusive).
Negotiating Capabilities
Capability | Value |
---|---|
CIFS_UNIX_FCNLT_LOCKS_CAP | 0x01 |
CIFS_UNIX_POSIX_ACLS_CAP | 0x02 |
CIFS_UNIX_XATTR_CAP | 0x04 |
CIFS_UNIX_EXATTR_CAP | 0x08 |
CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP | 0x20 |
Posix Open
The server specifies it can serve these by returning CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP in the reply to a trans2 qfsinfo (TRANSACT2_QFSINFO 0x03) info level SMB_QUERY_CIFS_UNIX_INFO (0x200) call. All values are little endian.
For open, call TRANSACT2_SETPATHINFO (0x06) call info level :
SMB_POSIX_PATH_OPEN 0x209
The request data block should be 14 bytes consisting of the following :
Size | Offset | Value |
---|---|---|
4 bytes | 0 | Flags field (same as smb_ntcreate_flags in SMBNTCreateX to request oplocks) |
4 bytes | 4 | POSIX open flags (see below) |
4 bytes | 8 | POSIX mode_t (see below) |
2 bytes | 12 | Reply info level requested (see below) |
Encodings are as follows :
POSIX open flags | Value |
---|---|
SMB_O_RDONLY | 0x1 |
SMB_O_WRONLY | 0x2 |
SMB_O_RDWR | 0x4 |
SMB_O_CREAT | 0x10 |
SMB_O_EXCL | 0x20 |
SMB_O_TRUNC | 0x40 |
SMB_O_APPEND | 0x80 |
SMB_O_SYNC | 0x100 |
SMB_O_DIRECTORY | 0x200 |
SMB_O_NOFOLLOW | 0x400 |
SMB_O_DIRECT | 0x800 |
SMB WHOAMI
The SMBWhoami extension is intended to be a lightweight method for a Unix client to be able to display sensible file ownership information.
SMBWhoami is performed by requesting a TRANS2_QFSINFO with an info level of SMB_QUERY_POSIX_WHOAMI. There are no parameters passed. The vuid field is implicitly used.
Info Level Name | Value |
---|---|
SMB_QUERY_POSIX_WHOAMI | 0x202 |
The first two fields of the SMBWhoami response are a set of flags that further describe how the server has mapped the connected user. The mask is returned so that the client can distinguish which flag bits are meaningful.
Mapping Flag | Value | Interpretation |
---|---|---|
SMB_WHOAMI_GUEST | 0x1 | Logged in as (or squashed to) guest |
Size | Offset | Value |
---|---|---|
4 bytes | 0 | Mapping flags |
4 bytes | 4 | Mask of valid mapping flags |
8 bytes | 8 | Primary user ID |
8 bytes | 16 | Primary group ID |
4 bytes | 24 | number of supplementary GIDs |
4 bytes | 28 | number of SIDs |
4 bytes | 32 | SID list byte count |
4 bytes | 36 | Reserved (should be zero) |
variable | ... | list of 8 byte group IDs (may be empty) |
variable | ... | List of DOM_SID structures (may be empty) |
Note that the list of group IDs and DOM_SIDs are both optional. A server may choose not to return these (eg. if the information is expensive to gather). If these are not returned the corresponding count fields must be zero.