126.96.36.199 Receiving an SMB_COM_CREATE_TEMPORARY Request
When the server receives an SMB_COM_CREATE_TEMPORARY Request (section 188.8.131.52.1), it MUST verify that the DirectoryName passed in the request identifies a directory within the supplied TID, verify the UID and ensure that the user has the necessary permissions to create a file in the directory. If the underlying object store returns STATUS_ACCESS_DENIED, the server MUST increase Server.Statistics.sts0_permerrors by 1.
The server MUST then create the file:
The name of the newly created file MUST NOT be the same as the name of any other file in the directory; otherwise, the server MUST return an error response with Status set to STATUS_OBJECT_NAME_COLLISION (ERRDOS/ERRfilexists).
The creation time of the file MAY be set to the value of the CreationTime field in the request.
The file is opened for read/write in Compatibility Mode (see section 184.108.40.206.1).
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.<266>
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.
The server MUST construct an SMB_COM_CREATE_TEMPORARY Response (section 220.127.116.11.2) message.
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 name of the newly created file.
Server.Open.GrantedAccess MUST be set to (GENERIC_READ | GENERIC_WRITE).
If an error occurred, the server MUST send an error response message.
The response MUST be sent to the client as specified in section 18.104.22.168.