3.3.5.9.7 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context

The client is requesting a reconnect to an existing durable or resilient open.

There is no processing done for "Path Name Validation" or "Open Execution" as listed in the section above.

The processing changes involved for this create context are:

  1. If the create request also includes an SMB2_CREATE_DURABLE_HANDLE_REQUEST create context, the server MUST ignore the SMB2_CREATE_DURABLE_HANDLE_REQUEST create context.

  2. If the create request also contains an SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 or SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context, the server SHOULD<331> fail the request with STATUS_INVALID_PARAMETER.

  3. 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, the server SHOULD<332> fail the request with STATUS_OBJECT_NAME_NOT_FOUND and proceed as specified in "Failed Open Handling" in section 3.3.5.9.

  4. If any Open.Lease is not NULL and Open.ClientGuid is not equal to the ClientGuid of the connection that received this request, the server MUST fail the request with STATUS_OBJECT_NAME_NOT_FOUND.

  5. If 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, the server MUST fail the request with STATUS_INVALID_PARAMETER.

  6. 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 the SMB2_CREATE_REQUEST_LEASE_V2 or the SMB2_CREATE_REQUEST_LEASE create context is not present.

    • Open.Lease is NULL and the SMB2_CREATE_REQUEST_LEASE_V2 or the SMB2_CREATE_REQUEST_LEASE create context is present.

    • Open.IsDurable is TRUE, Open.Lease is NULL, and Open.OplockLevel is not equal to SMB2_OPLOCK_LEVEL_BATCH.

    • Open.IsDurable is TRUE and Open.Lease.LeaseState does not contain SMB2_LEASE_HANDLE_CACHING.

    • Open.IsDurable is FALSE and Open.IsResilient is FALSE or unimplemented.

    • Open.Session is not NULL.

    • The SMB2_CREATE_REQUEST_LEASE_V2 create context is also present in the request, Connection.Dialect belongs to the SMB 3.x dialect family, the server supports directory leasing, Open.Lease is not NULL, 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, Connection.Dialect is "2.1" or belongs to the SMB 3.x dialect family, the server supports leasing, Open.Lease is not NULL, and Open.Lease.LeaseKey does not match the LeaseKey provided in the SMB2_CREATE_REQUEST_LEASE create context.

  7. If Open.Lease is not NULL, the server supports leasing and if 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<333> fail the request with STATUS_OBJECT_NAME_NOT_FOUND.

  8. 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.

  9. The server MUST set the Open.Connection to refer to the connection that received this request.

  10. The server MUST set the Open.Session to refer to the session that received this request.

  11. 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.

  12. Open.FileId MUST be set to a generated value that uniquely identifies this Open in Session.OpenTable.

  13. The server MUST insert the open into the Session.OpenTable with the Open.FileId as the new key.

  14. The "Successful Open Initialization" and "Oplock Acquisition" phases MUST be skipped, and processing MUST continue as specified in "Response Construction".

  15. In the "Response Construction" phase:

    The server MAY<334> construct an SMB2_CREATE_DURABLE_HANDLE_RESPONSE create context, as specified in section 2.2.14.2.3, and include it in the buffer described by the response CreateContextsLength and CreateContextsOffset fields.

    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, following 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.

      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, following 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.