3.3.5.5 Receiving an SMB_COM_OPEN Request

Upon receipt of an SMB_COM_OPEN Request, the server MUST validate the TID field and the UID field, as specified in section 3.3.5.2.

If the ShareType property of the Server.Share specified by the SMB_Header.TID is equal to Named Pipe and if Server.Session.IsAnonymous is TRUE, the server MUST invoke the event specified in [MS-SRVS] section 3.1.6.17 by providing the SMB_Data.Bytes.FileName field with the "\PIPE\" prefix removed as input parameter. If the event returns FALSE, indicating that no matching named pipe is found that allows an anonymous user, the server MUST fail the request with STATUS_ACCESS_DENIED and MUST increase Server.Statistics.sts0_permerrors by 1. Otherwise, the server MUST continue the open processing.

The server MUST search for a file with a name matching the name given in the request's SMB_Data.Bytes FileName field and SHOULD search based on SearchAttributes.<244> If no matching file is found, or if the file is found but cannot be opened, the server MUST return an error response with a Status indicating the error as listed in the error code table in section 2.2.4.3.2.<245> If the underlying object store returns STATUS_ACCESS_DENIED, the server MUST increase Server.Statistics.sts0_permerrors by 1. Otherwise, the server MUST allocate a new FID, format an SMB_COM_OPEN response message as specified in section 2.2.4.3, and set SMB_Header.Status to indicate success. If the command is successful, the server MUST increase Server.Statistics.sts0_fopens by 1 and MUST allocate an Open object and insert it into Server.Connection.FileOpenTable with the following default values:

  • A new FID MUST be created to uniquely identify this Open in Server.Connection.FileOpenTable.

  • If Server.EnableOplock is TRUE and a requested OpLock was granted, the type of OpLock MUST be set in Server.Open.OpLock and Server.Open.OplockState MUST be set to Held; otherwise, Server.Open.OpLock MUST be set to None and Server.Open.OplockState MUST be set to None.

  • Server.Open.TreeConnect MUST be set to the TreeConnect on which the open request was performed, and Server.Open.TreeConnect.OpenCount MUST be increased by 1.

  • Server.Open.Session MUST be set to Server.Open.TreeConnect.Session.

  • Server.Open.Connection MUST be set to the Server.Open.Session.Connection.

  • Server.Open.Locks MUST be set to an empty list.

  • Server.Open.PID MUST be set to the PID provided in the request.

  • Server.Open.PathName MUST be set to the FileName field of the request.

  • Server.Open.GrantedAccess MUST be set to the AccessMode field of the request.

The server MUST register the Open by invoking the event Server Registers a New Open ([MS-SRVS] section 3.1.6.4) and MUST assign the return value to Server.Open.FileGlobalId.

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