3.3.5.9.12 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context
This section applies only to servers that implement the SMB 3.x dialect family.
There is no processing done for "Path Name Validation" as listed in section 3.3.5.9.
The processing changes involved for this create context are:
The server MUST look up an existing Open in the GlobalOpenTable by doing a lookup with the FileId.Persistent portion of the create context.
If the lookup fails:
If the request includes the SMB2_DHANDLE_FLAG_PERSISTENT bit in the Flags field of the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context, TreeConnect.Share.IsCA is TRUE, and Connection.ServerCapabilities includes SMB2_GLOBAL_CAP_PERSISTENT_HANDLES, the server MUST look up an existing Open in the GlobalOpenTable by doing a lookup with the CreateGuid of the create context. If the lookup fails, the server SHOULD<342> fail the request with STATUS_OBJECT_NAME_NOT_FOUND and proceed as specified in "Failed Open Handling" in section 3.3.5.9.
Otherwise, the server SHOULD<343> fail the request with STATUS_OBJECT_NAME_NOT_FOUND and proceed as specified in "Failed Open Handling" in section 3.3.5.9.
If any of the following conditions is TRUE, the server MUST fail the request with STATUS_OBJECT_NAME_NOT_FOUND:
Open.Lease is not NULL and Open.ClientGuid is not equal to the ClientGuid of the connection that received this request.
If Open.IsPersistent is TRUE and the SMB2_DHANDLE_FLAG_PERSISTENT bit is not set in the Flags field of the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context, the server SHOULD<344> fail the request with STATUS_OBJECT_NAME_NOT_FOUND.
Open.CreateGuid is not equal to the CreateGuid in the request.
Open.IsDurable is FALSE and Open.IsResilient is FALSE or unimplemented.
Open.Session is not NULL.
Open.Lease is NULL and the SMB2_CREATE_REQUEST_LEASE or SMB2_CREATE_REQUEST_LEASE_V2 create context is present.
Open.IsDurable is TRUE, Open.Lease is NULL, and Open.OplockLevel is not equal to SMB2_OPLOCK_LEVEL_BATCH.
Open.Lease is NOT NULL and the SMB2_CREATE_REQUEST_LEASE or SMB2_CREATE_REQUEST_LEASE_V2 create context is not present.
Open.IsDurable is TRUE and Open.Lease.LeaseState does not contain SMB2_LEASE_HANDLE_CACHING.
The SMB2_CREATE_REQUEST_LEASE_V2 create context is also present in the request, the server supports directory leasing, and Open.Lease.LeaseKey does not match the LeaseKey provided in the SMB2_CREATE_REQUEST_LEASE_V2 create context.
The SMB2_CREATE_REQUEST_LEASE create context is also present in the request, the server supports leasing, and Open.Lease.LeaseKey does not match the LeaseKey provided in the SMB2_CREATE_REQUEST_LEASE create context.
If Open.Lease is not NULL, the server supports leasing, Lease.Version is 1, and the request does not contain the SMB2_CREATE_REQUEST_LEASE create context, or if Lease.Version is 2 and the request does not contain the SMB2_CREATE_REQUEST_LEASE_V2 create context, the server SHOULD<345> fail the request with STATUS_OBJECT_NAME_NOT_FOUND.
If any of the following conditions is TRUE, the server MUST fail the request with STATUS_INVALID_PARAMETER:
The CREATE request also contains the SMB2_CREATE_DURABLE_HANDLE_REQUEST context, the SMB2_CREATE_DURABLE_HANDLE_RECONNECT context, or the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 context.
Open.Lease is not NULL, Open.Lease.FileDeleteOnClose is FALSE, and Open.Lease.FileName does not match the file name specified in the Buffer field of the SMB2 CREATE request.
If Open.IsPersistent is FALSE and the SMB2_DHANDLE_FLAG_PERSISTENT bit is set in the Flags field of the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context, the server SHOULD<346> fail the request with STATUS_INVALID_PARAMETER.
If the SMB2_DHANDLE_FLAG_PERSISTENT bit in the Flags field of the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context is not set, the server MUST ignore the DesiredAccess, ShareAccess, and CreateOptions fields in the request.
If the user represented by Session.SecurityContext is not the same user denoted by Open.DurableOwner, the server MUST fail the request with STATUS_ACCESS_DENIED and proceed as specified in "Failed Open Handling" in section 3.3.5.9.
The server MUST set the Open.Connection to refer to the connection that received this request.
The server MUST set the Open.Session to refer to the session that received this request.
The server MUST set the Open.TreeConnect to refer to the tree connect that received this request, and Open.TreeConnect.OpenCount MUST be increased by 1.
Open.FileId MUST be set to a generated value that uniquely identifies this Open in Session.OpenTable.
The server MUST insert the Open into the Session.OpenTable with the Open.FileId as the new key.
If Open.IsSharedVHDX and Open.IsPersistent are TRUE, the request MUST be processed as specified in [MS-RSVD] section 3.2.5.1 by providing Open.LocalOpen.
The "Successful Open Initialization" and "Oplock Acquisition" phases MUST be skipped, and processing MUST continue as specified in "Response Construction".
In the "Response Construction" phase:
If the server supports directory leasing, Open.Lease is not NULL, and Lease.Version is 2, then the server MUST construct an SMB2_CREATE_RESPONSE_LEASE_V2 create context that follows the syntax specified in section 2.2.14.2.11, and include it in the buffer described by the response CreateContextsLength and CreateContextsOffset fields. This structure MUST have the following values set:
LeaseKey MUST be set to Lease.LeaseKey.
LeaseState MUST be set to Lease.LeaseState.
If Lease.ParentLeaseKey is not empty, ParentLeaseKey MUST be set to Lease.ParentLeaseKey, and the SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET bit MUST be set in the Flags field of the response.
Epoch SHOULD<347> be set to Lease.Epoch.
If the server supports leasing, Open.Lease is not NULL, and Lease.Version is 1, then the server MUST construct an SMB2_CREATE_RESPONSE_LEASE create context that follows the syntax specified in section 2.2.14.2.10, and include it in the buffer described by the response CreateContextsLength and CreateContextsOffset fields. This structure MUST have the following values set:
LeaseKey MUST be set to Lease.LeaseKey.
LeaseState MUST be set to Lease.LeaseState.
If Open.IsPersistent is TRUE, Open.Lease.Breaking is TRUE, and Open.Lease.BreakNotification is not empty, the server MUST send Open.Lease.BreakNotification to the client over an available connection in ConnectionList where Open.ClientGuid matches Connection.ClientGuid. If the server succeeds in sending the notification, the server MUST set Open.Lease.BreakNotification to empty and MUST start the lease break acknowledgment timer as specified in section 3.3.2.5.