18.104.22.168 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 22.214.171.124) 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.
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 126.96.36.199) 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 188.8.131.52.2. The response MUST be sent to the client as specified in section 184.108.40.206.