[cifs-protocol] preliminary UNIX extensions documentation

James Peach jpeach at apple.com
Wed Oct 8 16:33:14 GMT 2008


Hi all,

I had some time a couple of months ago, so I knocked up some  
documentation for the UNIX extensions.

Although what follows is in RFC format, I doubt that I will get around  
to submitting this as a real IETF informational RFC. If someone else  
wants to do that, I'll happily support that effort.

I haven't documented all the UNIX extensions. I have documented all  
the extensions used by the Mac OS X 10.5 SMB client, however. I'm  
happy to take patches :)

This documentation is licensed under the Common Documentation License,  
<http://www.opensource.apple.com/cdl/>.

cheers,
James

Network Working Group                                           J. Peach
Internet-Draft                                                 Apple Inc
Intended status: Informational                                  May 2008
Expires: November 2, 2008


                SMB Protocol Extensions for UNIX systems.
                   draft-jpeach-smb-unix-extensions-00

Status of this Memo

    By submitting this Internet-Draft, each author represents that any
    applicable patent or other IPR claims of which he or she is aware
    have been or will be disclosed, and any of which he or she becomes
    aware will be disclosed, in accordance with Section 6 of BCP 79.

    Internet-Drafts are working documents of the Internet Engineering
    Task Force (IETF), its areas, and its working groups.  Note that
    other groups may also distribute working documents as Internet-
    Drafts.

    Internet-Drafts are draft documents valid for a maximum of six  
months
    and may be updated, replaced, or obsoleted by other documents at any
    time.  It is inappropriate to use Internet-Drafts as reference
    material or to cite them other than as "work in progress."

    The list of current Internet-Drafts can be accessed at
    http://www.ietf.org/ietf/1id-abstracts.txt.

    The list of Internet-Draft Shadow Directories can be accessed at
    http://www.ietf.org/shadow.html.

    This Internet-Draft will expire on November 2, 2008.

Abstract

    This document describes various SMB protocol extensions that have
    been developed to more accurately express the filesystem semantics  
of
    UNIX-like systems.












Peach                   Expires November 2, 2008                [Page 1]
Internet-Draft             SMB UNIX Extensions                  May 2008


Table of Contents

    1.   
Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
      1.1.  Requirements  
Language  . . . . . . . . . . . . . . . . . .  3
      1.2.   
Terminology  . . . . . . . . . . . . . . . . . . . . . . .  3
      1.3.  Protocol Extension  
Principles  . . . . . . . . . . . . . .  3
    2.  The UNIX Trans2 Command  
Space  . . . . . . . . . . . . . . . .  4
    3.  UNIX Capabilities  
Negotiation  . . . . . . . . . . . . . . . .  4
    4.  Filesystem  
Operations  . . . . . . . . . . . . . . . . . . . .  5
      4.1.   
SMB_QUERY_CIFS_UNIX_INFO . . . . . . . . . . . . . . . . .  6
      4.2.   
SMB_SET_CIFS_UNIX_INFO . . . . . . . . . . . . . . . . . .  6
      4.3.   
SMB_QUERY_POSIX_FS_INFO  . . . . . . . . . . . . . . . . .  7
      4.4.   
SMB_QUERY_POSIX_WHOAMI . . . . . . . . . . . . . . . . . .  7
    5.  File and Directory  
Operations  . . . . . . . . . . . . . . . .  9
      5.1.  POSIX Pathnames  . . . . . . . . . . . . . . . . . . . . .  
10
      5.2.  SMB_POSIX_PATH_OPEN  . . . . . . . . . . . . . . . . . . .  
10
      5.3.  QUERY_FILE_UNIX_LINK . . . . . . . . . . . . . . . . . . .  
12
      5.4.  SMB_POSIX_PATH_UNLINK  . . . . . . . . . . . . . . . . . .  
12
      5.5.  QUERY_POSIX_ACL  . . . . . . . . . . . . . . . . . . . . .  
13
      5.6.  QUERY_FILE_UNIX_BASIC  . . . . . . . . . . . . . . . . . .  
13
      5.7.  SMB_QUERY_FILE_UNIX_INFO2  . . . . . . . . . . . . . . . .  
14
      5.8.  SMB_QUERY_POSIX_LOCK . . . . . . . . . . . . . . . . . . .  
17
      5.9.  SMB_SET_POSIX_LOCK . . . . . . . . . . . . . . . . . . . .  
17
      5.10. Minshall+French Symlinks . . . . . . . . . . . . . . . . .  
17
    6.  Security Considerations  . . . . . . . . . . . . . . . . . . .  
18
    7.  References . . . . . . . . . . . . . . . . . . . . . . . . . .  
18
      7.1.  Normative References . . . . . . . . . . . . . . . . . . .  
18
      7.2.  Informative References . . . . . . . . . . . . . . . . . .  
18
    Author's Address . . . . . . . . . . . . . . . . . . . . . . . . .  
19
    Intellectual Property and Copyright Statements . . . . . . . . . .  
20





















Peach                   Expires November 2, 2008                [Page 2]
Internet-Draft             SMB UNIX Extensions                  May 2008


1.  Introduction

    The SMB UNIX extensions were first developed by SCO and HP between
    1999 and 2001.  They were documented in the SNIA reference [SNIA] as
    a minimal set of UNIX-style operations.

    From 2004 to 2007, various new extensions were proposed and
    implemented as a response to the needs of SMB client authors who  
were
    implementing SMB client filesystems on UNIX systems.

1.1.  Requirements Language

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
    document are to be interpreted as described in RFC 2119 [RFC2119].

1.2.  Terminology

    Wherever possible, the terminology and protocol element names from
    the SMB protocol specification [MS-SMB] have been used.
    Historically, various UNIX extensions have used inconsistent names.
    Where documentation is available, the names used match the
    documentation, otherwise the names match those used in the
    implementations.

1.3.  Protocol Extension Principles

    Extensions SHOULD only use protocol identifier ranges that have been
    reserved for use by the UNIX extensions.  Extensions MUST NOT alter
    the specified or well-known behavior of the SMB protocol.

    Extensions SHOULD be minimal.  The goal is to defined extensions to
    patch small holes in the SMB protocol, not to tunnel entire new
    protocols within SMB.

    Extensions SHOULD be negotiated and discrete.  SMB client
    implementations SHOULD be able to pick and choose which extensions  
to
    enable to best support their native semantics.  Extensions SHOULD  
NOT
    duplicate functionality found in other extensions or in the SMB
    protocol.

    Extensions SHOULD be implementable on non-UNIX systems.

    Extensions SHOULD be practical.  They SHOULD help SMB client authors
    to solve an existing problem.

    Extensions MUST NOT define a new UNIX capability bit unless probing
    for the extension is impossible or would impose an undue burden on



Peach                   Expires November 2, 2008                [Page 3]
Internet-Draft             SMB UNIX Extensions                  May 2008


    client authors.


2.  The UNIX Trans2 Command Space

    The majority of the UNIX extensions are implemented as subcommands  
of
    the SMB_COM_TRANSACTION2 command.  The information levels in the
    range 0x200 to 0x2FF (inclusive) are reserved for UNIX extensions.


3.  UNIX Capabilities Negotiation

    The server indicates its support for the UNIX extensions by setting
    the CAP_UNIX bit in the Capabilities field of the SMB_COM_NEGOTIATE
    response message.

    The UNIX extensions are versioned with both a protocol revision
    number and a capability mask.  The original version of the UNIX
    extensions was version 1.0, and although new capability bits have
    been defined, this version number has never been incremented.

    Servers MUST allow client to enable and disable the UNIX  
capabilities
    on each tree connection.  Immediately after a successful
    SMB_COM_TREE_CONNECT_ANDX, the client SHOULD send a
    SMB_QUERY_CIFS_UNIX_INFO command to find out which UNIX extensions
    are enabled on the tree connection.  The client MAY send an
    additional SMB_QUERY_CIFS_UNIX_INFO command to alter the set of
    capabilities that are in force on a tree connection.

    The following UNIX capabilities are defined:

    0x0001 CIFS_UNIX_FCNTL_LOCKS_CAP
            If this capability is present, the server MUST support  
POSIX-
            style byte range locking operations by implementing
            SMB_QUERY_POSIX_LOCK and SMB_SET_POSIX_LOCK.

    0x0002 CIFS_UNIX_POSIX_ACLS_CAP
            If this capability is present, the server MUST support POSIX
            1003.1e ACL operations by implementing SMB_QUERY_POSIX_ACL
            and SMB_SET_POSIX_ACL.

    0x0004 CIFS_UNIX_XATTR_CAP
            If this capability is present, the server MUST support UNIX
            extended attribute operations by implementing
            SMB_QUERY_XATTR.






Peach                   Expires November 2, 2008                [Page 4]
Internet-Draft             SMB UNIX Extensions                  May 2008


    0x0008 CIFS_UNIX_EXATTR_CAP
            If this capability is present, the server MUST support the
            SMB_QUERY_ATTR_FLAGS SMB_SET_ATTR_FLAGS operations to
            manipulate extended file attributes.

    0x0010 CIFS_UNIX_POSIX_PATHNAMES_CAP
            If this capability is present, the server MUST interpret
            pathnames according to POSIX pathname rules rather than SMB
            rules.

    0x0020 CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP
            If this capability is present, the server MUST support the
            following UNIX-style path operations: SMB_POSIX_PATH_OPEN,
            SMB_POSIX_PATH_UNLINK.

    0x0040 CIFS_UNIX_LARGE_READ_CAP
            If this capability is present, the server MUST interpret the
            lower 24 bits of the NBT frame as a length field when
            receiving a SMB_COM_READ_ANDX command.

    0x0080 CIFS_UNIX_LARGE_WRITE_CAP
            If this capability is present, the server MUST interpret the
            lower 24 bits of the NBT frame as a length field when
            receiving a SMB_COM_WRITE_ANDX command.

    0x0100 CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP
            If this capability is present the server MUST support the
            UNIX transport encryption extension.

    0x0200 CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP
            If this capability is present the server MUST support the
            UNIX transport encryption extension and MUST NOT allow SMB
            clients to connect without negotiating transport encryption.
            Server implementations MAY allow non-UNIX clients to connect
            while ignoring.


4.  Filesystem Operations

    The following information levels are defined only for the
    TRANS2_QUERY_FS_INFORMATION command:

                    +--------------------------+--------+
                    | SMB_QUERY_CIFS_UNIX_INFO | 0x0200 |
                    | SMB_QUERY_POSIX_FS_INFO  | 0x0201 |
                    | SMB_QUERY_POSIX_WHOAMI   | 0x0202 |
                    +--------------------------+--------+




Peach                   Expires November 2, 2008                [Page 5]
Internet-Draft             SMB UNIX Extensions                  May 2008


    The following information levels are defined only for the
    TRANS2_SET_FS_INFORMATION command:

                    +--------------------------+--------+
                    | SMB_QUERY_CIFS_UNIX_INFO | 0x0200 |
                    +--------------------------+--------+

4.1.  SMB_QUERY_CIFS_UNIX_INFO

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | MajorVersionNumber            | MinorVersionNumber            |
    +-------------------------------+-------------------------------+
    |                          Capabilities                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+

4.2.  SMB_SET_CIFS_UNIX_INFO

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | MajorVersionNumber            | MinorVersionNumber            |
    +-------------------------------+-------------------------------+
    |                          Capabilities                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+



















Peach                   Expires November 2, 2008                [Page 6]
Internet-Draft             SMB UNIX Extensions                  May 2008


4.3.  SMB_QUERY_POSIX_FS_INFO

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       OptimalTransferSize                     |
    +---------------------------------------------------------------+
    |                            BlockSize                          |
    +---------------------------------------------------------------+
    |                           TotalBlocks                         |
    +---------------------------------------------------------------+
    |                           BlocksAvail                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                         UserBlocksAvail                       |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                         TotalFileNodes                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          FreeFileNodes                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          FSIdentifier                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+

4.4.  SMB_QUERY_POSIX_WHOAMI

    The SMB_QUERY_POSIX_WHOAMI request is called when the client needs  
to
    know its logon token.  This returns both the UNIX token and the
    Windows token.











Peach                   Expires November 2, 2008                [Page 7]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          MappingFlags                         |
    +---------------------------------------------------------------+
    |                        MappingFlagsMask                       |
    +---------------------------------------------------------------+
    |                          PrimaryUserID                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                         PrimaryGroupID                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                  NumberOfSupplementaryGroupIDs                |
    +---------------------------------------------------------------+
    |                           NumberOfSIDs                        |
    +---------------------------------------------------------------+
    |                         NumberOfSIDBytes                      |
    +---------------------------------------------------------------+
    |                          Reserved (MBZ)                       |
    +---------------------------------------------------------------+
    |               SupplementaryGroupIDArray (variable) ...        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                       SIDArray (variable) ...                 |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+

    Both the SupplementaryGroupIDArray and the SIDArray can be empty.   
In
    this case, they are omitted and the corresponding NumberOf fields
    MUST be zero.

    The following MappingFlags are defined:









Peach                   Expires November 2, 2008                [Page 8]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +------------------+-------- 
+---------------------------------------+
    | SMB_WHOAMI_GUEST | 0x0001 | The user is logged on to  
an           |
    |                  |        | unauthenticated account.  In  
Windows  |
    |                  |        | terminology, this bit is set if  
the   |
    |                  |        | user is not in the  
"Authenticated     |
    |                  |        | Users"  
alias.                         |
    +------------------+-------- 
+---------------------------------------+

    The SMB_WHOAMI_GUEST flag is redundant in that this bit SHOULD
    correspond to the absence of the well-known "Authenticated Users"  
SID
    (S-1-5-11) from the SIDArray.  This flag does not distinguish  
between
    anonymous access and access as a designated guest account.  Both of
    these cases MUST set the SMB_WHOAMI_GUEST flag.

    The MappingFlagsMask MUST be set to indicate the set of MappingFlags
    knnown to the server.


5.  File and Directory Operations

    The following information levels are defined only for the
    TRANS2_QUERY_FILE_INFORMATION, TRANS2_QUERY_PATH_INFORMATION,
    TRANS2_SET_FILE_INFORMATION and TRANS2_SET_PATH_INFORMATION  
commands:

                    +-------------------------+--------+
                    | QUERY_FILE_UNIX_BASIC   | 0x0200 |
                    | QUERY_POSIX_ACL         | 0x0204 |
                    | QUERY_POSIX_XATTR       | 0x0205 |
                    | QUERY_POSIX_ATTR_FLAGS  | 0x0206 |
                    | QUERY_POSIX_PERMISSIONS | 0x0207 |
                    | QUERY_FILE_UNIX_INFO2   | 0x020B |
                    +-------------------------+--------+

    The following information levels are defined only for the
    TRANS2_QUERY_PATH_INFORMATION command:

                      +----------------------+--------+
                      | QUERY_FILE_UNIX_LINK | 0x0201 |
                      +----------------------+--------+

    The following information levels are defined only for the
    TRANS2_SET_PATH_INFORMATION command:

                     +-----------------------+--------+
                     | SMB_POSIX_PATH_OPEN   | 0x0209 |
                     | SMB_POSIX_PATH_UNLINK | 0x020A |
                     +-----------------------+--------+




Peach                   Expires November 2, 2008                [Page 9]
Internet-Draft             SMB UNIX Extensions                  May 2008


    The following information levels are defined only for the
    TRANS2_SET_FILE_INFORMATION command:

                       +--------------------+--------+
                       | SMB_SET_POSIX_LOCK | 0x0208 |
                       +--------------------+--------+

    The following information levels are defined only for the
    TRANS2_QUERY_FILE_INFORMATION command:

                      +----------------------+--------+
                      | SMB_QUERY_POSIX_LOCK | 0x0208 |
                      +----------------------+--------+

5.1.  POSIX Pathnames

    If the CIFS_UNIX_POSIX_PATHNAMES_CAP capability is enabled, the
    server MUST process pathnames as UNIX paths instead of as Windows
    paths.  All characters except '/' are legal in filenames. '/' is the
    path separator instead of '\'.

5.2.  SMB_POSIX_PATH_OPEN

    If the server claims the CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP
    capability, it MUST support the SMB_POSIX_PATH_OPEN operation.  This
    operation is a SMB_COM_TRANSACTION2 command where the transaction
    path is the path of the file that is to be opened and the request
    data block is as follows:

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          NTCreateFlags                        |
    +---------------------------------------------------------------+
    |                         PosixOpenFlags                        |
    +---------------------------------------------------------------+
    |                       PosixOpenPermissions                    |
    +---------------------------------------------------------------+
    |                              ...                              |
    +-------------------------------+-------------------------------+
    |        ReplyInfoLevel         |
    +-------------------------------+

    The following PosixOpenFlags bits are defined for
    SMB_POSIX_PATH_OPEN.  Where the POSIX 1003.1 name is given, the
    meaning of the flags is defined according to the definition in POSIX
    standard [POSIX].



Peach                   Expires November 2, 2008               [Page 10]
Internet-Draft             SMB UNIX Extensions                  May 2008


                   +-----------------+----------+--------+
                   | SMB_O_RDONLY    | O_RDONLY | 0x0001 |
                   | SMB_O_WRONLY    | O_WRONLY | 0x0002 |
                   | SMB_O_RDWR      | O_RDWR   | 0x0004 |
                   | SMB_O_CREAT     | O_CREAT  | 0x0010 |
                   | SMB_O_EXCL      | O_EXCL   | 0x0020 |
                   | SMB_O_TRUNC     | O_TRUNC  | 0x0040 |
                   | SMB_O_APPEND    | O_APPEND | 0x0080 |
                   | SMB_O_SYNC      | O_SYNC   | 0x0100 |
                   | SMB_O_DIRECTORY |          | 0x0200 |
                   | SMB_O_NOFOLLOW  |          | 0x0400 |
                   | SMB_O_DIRECT    |          | 0x0800 |
                   +-----------------+----------+--------+

    The following PosixOpenPermissions bits are defined for
    SMB_POSIX_PATH_OPEN.  Where the POSIX 1003.1 name is given, the
    meaning of the flags is defined according to the definition in POSIX
    standard [POSIX].

    Note that the following bits are octal, NOT hexadecimal.

                    +---------------+---------+---------+
                    | SMB_PERM_SUID | S_ISUID | 0004000 |
                    | SMB_PERM_SGID | S_ISGID | 0002000 |
                    | SMB_PERM_SVTX | S_ISVTX | 0001000 |
                    | SMB_PERM_RUSR | S_IRUSR | 0000400 |
                    | SMB_PERM_WUSR | S_IWUSR | 0000200 |
                    | SMB_PERM_XUSR | S_IXUSR | 0000100 |
                    | SMB_PERM_RGRP | S_IRGRP | 0000040 |
                    | SMB_PERM_WGRP | S_IWGRP | 0000020 |
                    | SMB_PERM_XGRP | S_IXGRP | 0000010 |
                    | SMB_PERM_ROTH | S_IROTH | 0000004 |
                    | SMB_PERM_WOTH | S_IWOTH | 0000002 |
                    | SMB_PERM_XOTH | S_IXOTH | 0000001 |
                    +---------------+---------+---------+

    The response data block varies in length according to the attributes
    requested in the ReplyInfoLevel field.  It has the following format:













Peach                   Expires November 2, 2008               [Page 11]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         OplockFlags           |             FileID            |
    +-------------------------------+-------------------------------+
    |                          CreateAction                         |
    +---------------------------------------------------------------+
    |         ReplyInfoLevel        |            Pad (MBZ)          |
    +-------------------------------+-------------------------------+
    |                    FileAttributes (variable) ...              |
    +---------------------------------------------------------------+

    If the ReplyInfoLevel field is SMB_NO_INFO_LEVEL_RETURNED (0xffff),
    no file attributes are returned.

5.3.  QUERY_FILE_UNIX_LINK

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                    LinkTarget (variable) ...                  |
    +---------------------------------------------------------------+

    LinkTarget is the NULL-terminated path to the symbolic link
    destination.  If UNICODE has been negotiated, it is UTF-16LE,
    otherwise it is in the configured 8-bit character set.

5.4.  SMB_POSIX_PATH_UNLINK

    SMB_POSIX_PATH_UNLINK is sent as the data payload of a
    TRANS2_SET_PATH_INFORMATION transaction.  This operation is only
    supported if the CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP capability is
    enabled.

    The SMB_POSIX_PATH_UNLINK request is:

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |           Flags               |
    +-------------------------------+

    Valid flags are:





Peach                   Expires November 2, 2008               [Page 12]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +-----------------------------------+-------- 
+----------------------+
    | SMB_POSIX_UNLINK_DIRECTORY_TARGET | 0x0001 | Target MUST be  
a     |
    |                                   |        |  
directory            |
    +-----------------------------------+-------- 
+----------------------+

    If SMB_POSIX_UNLINK_DIRECTORY_TARGET is not set then the target MUST
    be a file.

    The SMB_POSIX_PATH_UNLINK response is a SMB_COM_TRANSACTION2 with an
    empty data payload.

5.5.  QUERY_POSIX_ACL

    QUERY_POSIX_ACL is sent as a TRANS2_QUERY_PATH_INFORMATION or
    TRANS2_QUERY_FILE_INFORMATION transaction with an empty data  
payload.

    The QUERY_POSIX_ACL response is:

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |     SMB_POSIX_ACL_VERSION     |         NumberOfFileACEs      |
    +-------------------------------+-------------------------------+
    |      NumberOfDefaultACEs      |      FileACL (variable) ...   |
    +-------------------------------+-------------------------------+
    |                              ...                              |
    +-------------------------------+-------------------------------+
    |                     DefaultACL (variable) ...                 |
    +-------------------------------+-------------------------------+
    |                              ...                              |
    +-------------------------------+-------------------------------+

5.6.  QUERY_FILE_UNIX_BASIC

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                           EndOfFile                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          NumberOfBytes                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                       LastStatusChangeTime                    |



Peach                   Expires November 2, 2008               [Page 13]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                         LastAccessTime                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                      LastModificationTime                     |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           OwnerUserID                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           GroupUserID                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                              Type                             |
    +---------------------------------------------------------------+
    |                            DevMajor                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                            DevMinor                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                            UniqueID                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          Permissions                          |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          NumberOfLinks                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+

5.7.  SMB_QUERY_FILE_UNIX_INFO2

    The SMB_QUERY_FILE_UNIX_INFO2 request is the same as the
    QUERY_FILE_UNIX_BASIC format, with the addition of the CreationTime,
    FileFlags and FileFlagsMask fieds.




Peach                   Expires November 2, 2008               [Page 14]
Internet-Draft             SMB UNIX Extensions                  May 2008


    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                           EndOfFile                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          NumberOfBytes                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                       LastStatusChangeTime                    |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                         LastAccessTime                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                      LastModificationTime                     |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           OwnerUserID                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           GroupUserID                         |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                              Type                             |
    +---------------------------------------------------------------+
    |                            DevMajor                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                            DevMinor                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                            UniqueID                           |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                          Permissions                          |
    +---------------------------------------------------------------+



Peach                   Expires November 2, 2008               [Page 15]
Internet-Draft             SMB UNIX Extensions                  May 2008


    |                              ...                              |
    +---------------------------------------------------------------+
    |                          NumberOfLinks                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           CreationTime                        |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           FileFlags                           |
    +---------------------------------------------------------------+
    |                         FileFlagsMask                         |
    +---------------------------------------------------------------+

    The FileFlags field is a bitmask of any of the following values:

    +--------------------------+------------ 
+---------------------------+
    | EXT_SECURE_DELETE        | 0x00000001 | This file should  
be       |
    |                          |            | deleted in a  
secure       |
    |                          |            |  
manner.                   |
    | EXT_ENABLE_UNDELETE      | 0x00000002 | This file can  
be          |
    |                          |            | recovered after  
a         |
    |                          |            |  
deletion.                 |
    | EXT_SYNCHRONOUS          | 0x00000004 | Writes to this  
file       |
    |                          |            | should by  
synchronous.    |
    | EXT_IMMUTABLE            | 0x00000008 | The file may only  
be      |
    |                          |            | opened read- 
only.         |
    | EXT_OPEN_APPEND_ONLY     | 0x00000010 | The file may only  
be      |
    |                          |            | opened in append  
mode.    |
    | EXT_DO_NOT_BACKUP        | 0x00000020 | The file should not  
be    |
    |                          |            | backed  
up.                |
    | EXT_NO_UPDATE_ATIME      | 0x00000040 | The file's last  
access    |
    |                          |            | time should not  
be        |
    |                          |            |  
updated.                  |
    | EXT_HIDDEN               | 0x00000080 | The file or directory  
is  |
    |                          |            | not intended to  
be        |
    |                          |            | displayed to the  
user.    |
    | EXT_NO_EXTENDED_SECURITY | 0x00000100 | This file has no  
extended |
    |                          |            | access controls  
applied.  |
    +--------------------------+------------ 
+---------------------------+

    The FileFlagsMask field is a bitmask that specifies which FileFlags
    bits are defined.  Bits in FileFlags that do not have the
    corresponding FileFlagsMask bit set MUST be ignored.

    The EXT_NO_EXTENDED_SECURITY bit MUST be set if the entirety of the
    access control policy applied to the filesystem object is  
represended



Peach                   Expires November 2, 2008               [Page 16]
Internet-Draft             SMB UNIX Extensions                  May 2008


    in the SMB_QUERY_FILE_UNIX_INFO2 response.  This is a hint to  
clients
    that they do not need to query for an ACL.

5.8.  SMB_QUERY_POSIX_LOCK

    This request does not appear to have ever been implemented or
    defined.

5.9.  SMB_SET_POSIX_LOCK

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
    |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         LockType              |           LockFlags           |
    +-------------------------------+-------------------------------+
    |                          LockOwnerPID                         |
    +---------------------------------------------------------------+
    |                           LockOffset                          |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+
    |                           LockLength                          |
    +---------------------------------------------------------------+
    |                              ...                              |
    +---------------------------------------------------------------+

    The following LockType values are defined:

        +------------------------+--------+------------------------+
        | POSIX_LOCK_TYPE_READ   | 0x0001 | Set a read lock.       |
        | POSIX_LOCK_TYPE_WRITE  | 0x0002 | Set a read/write lock. |
        | POSIX_LOCK_TYPE_UNLOCK | 0x0003 | Remove a lock.         |
        +------------------------+--------+------------------------+

    The following LockFlags values are defined:

    +----------------------+-------- 
+-----------------------------------+
    | POSIX_LOCK_FLAG_WAIT | 0x0001 | Block until the locking  
request   |
    |                      |        |  
succeeds.                         |
    +----------------------+-------- 
+-----------------------------------+

5.10.  Minshall+French Symlinks

    The Minshall+French symlink is a data format designed to enable UNIX
    clients to represent symlinks on filesystems that have no native
    support for them.  It consists 4 fields separated by the '\n'
    character:



Peach                   Expires November 2, 2008               [Page 17]
Internet-Draft             SMB UNIX Extensions                  May 2008


    XSym
            The literal ASCII characters 'X', 'S', 'y', 'm'.

    length
            The length of the symlink target name printed as a base 10
            ASCII string.

    md5sum
            The MD5 hash of the link target name, printed in base 16 as
            32 ASCII characters.

    target
            The link target path in UTF8.


6.  Security Considerations

    The SMB security model is specified in MS-SMB [MS-SMB] and LEACH
    [LEACH].

    The UNIX extensions do not alter the SMB security model.


7.  References

7.1.  Normative References

    [LEACH]    Leach, P. and D. Naik, "A Common Internet File System
               (CIFS/1.0) Protocol", 1997.

    [MS-SMB]   Microsoft Corporation, "Server Message Block (SMB)
               Protocol Specification", 2007.

    [POSIX]    The Open Group, "Single UNIX Specification, Version 3",
               2004.

    [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
               Requirement Levels", BCP 14, RFC 2119, March 1997.

    [RFC3552]  Rescorla, E. and B. Korver, "Guidelines for Writing RFC
               Text on Security Considerations", BCP 72, RFC 3552,
               July 2003.

7.2.  Informative References

    [SNIA]     Storage Networking Industry Association, "Common Internet
               File System (CIFS) Technical Reference", 2002.




Peach                   Expires November 2, 2008               [Page 18]
Internet-Draft             SMB UNIX Extensions                  May 2008


Author's Address

    James Peach
    Apple Inc
    1 Infinite Loop
    Cupertino, CA  95014
    USA

    Email: jpeach at apple.com










































Peach                   Expires November 2, 2008               [Page 19]
Internet-Draft             SMB UNIX Extensions                  May 2008


Full Copyright Statement

    Copyright (C) 2008 Apple Inc.

    This material has been released under and is subject to the terms
    of the Common Documentation License, v.1.0, the terms of which
    are hereby incorporated by reference. Please obtain a copy of
    the License at http://www.opensource.apple.com/cdl/ and read it
    before using this material. Your use of this material signifies
    your agreement to the terms of the License."











Peach                   Expires November 2, 2008               [Page 20]




More information about the cifs-protocol mailing list