Compartilhar via


3.3.5.40 Receiving an SMB_COM_TREE_CONNECT Request

When the server receives an SMB_COM_TREE_CONNECT Request (section 2.2.4.50.1), it MUST attempt to connect to the share indicated in the Path field. To get the updated server name, the server MUST provide <server name, share name> parsed from the Path field and MUST invoke the Server Normalizes a ServerName  event ([MS-SRVS] section 3.1.6.8). The server MUST use <updated server name, share name> to look up the Share in Server.ShareTable. If the share is not found, the server MUST send an error response with a status of STATUS_OBJECT_PATH_NOT_FOUND (ERRDOS/ERRbadpath).

Server.Paused with a value of TRUE indicates that all shares can only be accessed by an administrator. Under these conditions, if a SMB_COM_TREE_CONNECT Request (section 2.2.4.50.1) is received from a user that is not an administrator, the server MUST send an error response with a status of STATUS_SHARING_PAUSED (ERRDOS/ERRpaused).<306>

If the server global variable Server.ShareLevelAuthentication is FALSE, the Password field in the request MUST be ignored, and the UID in the header MUST be used to look up the Server.Session.UserSecurityContext to determine access rights to the share.

If Server.ShareLevelAuthentication is TRUE, the Password field MUST be passed to the Authentication subsystem as a share-level password.

The server MUST invoke the Server Notifies Current Uses of a Share ([MS-SRVS] section 3.1.6.15) event with the tuple <ServerName, ShareName> to get the total number of current uses of the share. If the number of current uses is equal to or greater than Share.MaxUses, the server MUST fail the request with STATUS_REQUEST_NOT_ACCEPTED.

The server MUST check the validity of the SMB_Data.Bytes.Service field in the request. If the value does not match any of those listed in section 2.2.4.50.1, the server MUST fail the request with a value of STATUS_BAD_DEVICE_TYPE (ERRSRV/ERRinvdevice).

If the Tree Connect is successful, the server MUST allocate a TreeConnect object and MUST insert it into Server.Connection.TreeConnectTable with the following default values:

  • A new TID MUST be generated to uniquely identify this tree connect in the Server.Connection.TreeConnectTable.

  • Session MUST be set to the session found on the UID lookup.

  • Share MUST be set to the share found on the lookup in the Server.ShareTable.

  • OpenCount MUST be set to zero.

  • CreationTime MUST be set to current time.

  • Share.CurrentUses MUST be increased by 1.

The server MUST register TreeConnect by invoking the event Server Registers a New Treeconnect ([MS-SRVS] section 3.1.6.6) and MUST assign the return value to Server.TreeConnect.TreeGlobalId.

The TID MUST be returned in both the SMB Header.TID field and the SMB_Parameter.Words.TID field of the response. The default Server.MaxBufferSize of the server MUST be returned in the MaxBufferSize field.

The SMB_COM_TREE_CONNECT Response (section 2.2.4.50.2) provides no field for indicating share characteristics such as DFS support or access rights.

If the Tree Connect is successful, a complete SMB_COM_TREE_CONNECT Response is sent. Otherwise, an error response message MUST be sent.

The response is sent to the client as specified in section 3.3.4.1.