Compartilhar via


3.3.5.41 Receiving an SMB_COM_TREE_DISCONNECT Request

When the server receives an SMB_COM_TREE_DISCONNECT Request, the server can verify that the user indicated by the Server.Session.UserSecurityContext identified by UID has sufficient privileges, and it MUST:

  • Validate the TID in the SMB Header (section 2.2.3.1) by verifying that it is listed in Server.Connection.TreeConnectTable.

  • List all Opens (by FID) in the Server.Connection.FileOpenTable that exist within the TID. For each file:

    • Release every lock in Open.Locks.

    • Close the file, regardless of the OpLock states.

    • Remove the Open entry from the Server.Connection.FileOpenTable.

    • Decrease Open.TreeConnect.OpenCount and Server.Statistics.sts0_fopens by 1.

    • Deregister the Open by invoking the event Server Deregisters an Open ([MS-SRVS] section 3.1.6.5), providing Open.FileGlobalId as an input parameter.

  • List all open searches (by SID) in the Server.Connection.SearchOpenTable that were opened within the specified TID. For each search:

    • Close the search.

    • Remove the SID from the Server.Connection.SearchOpenTable.

    • Server.TreeConnect.Share.CurrentUses MUST be decreased by 1.

Upon success, the resource sharing connection identified by the TID is closed, and the TID is invalidated by removing the TreeConnect entry from Server.Connection.TreeConnectTable.

The server MUST deregister TreeConnect by invoking the event Server Deregisters a Treeconnect ([MS-SRVS] section 3.1.6.7) with the tuple <TreeConnect.Share.ServerName, TreeConnect.Share.Name> and Server.TreeConnect.TreeGlobalId as input parameters.

The response message indicates success or an error condition. The list of possible error codes is specified in section 2.2.4.51.2. The response MUST be sent to the client as specified in section 3.3.4.1.