3.3.5.9.10 Handling the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 Create Context

This section applies only to servers that implement the SMB 3.x dialect family.

If the create request also includes an SMB2_CREATE_DURABLE_HANDLE_REQUEST create context, or an SMB2_CREATE_DURABLE_HANDLE_RECONNECT or SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context, the server MUST fail the create request with STATUS_INVALID_PARAMETER.

If RequestedOplockLevel in the create request is not set to SMB2_OPLOCK_LEVEL_BATCH, and if the create request does not include a SMB2_CREATE_REQUEST_LEASE or SMB2_CREATE_REQUEST_LEASE_V2 create context with a LeaseState field that includes SMB2_LEASE_HANDLE_CACHING, and if any of the following conditions is TRUE, the server MUST ignore this create context and skip this section:

  • The SMB2_DHANDLE_FLAG_PERSISTENT bit is set in the Flags field of this create context and TreeConnect.Share.IsCA is FALSE.

  • The SMB2_DHANDLE_FLAG_PERSISTENT bit is not set in the Flags field of this create context.

If the create request also includes the SMB2_CREATE_APP_INSTANCE_ID create context, the server MUST process the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 create context only after processing the SMB2_CREATE_APP_INSTANCE_ID create context.

The server MUST locate the Open in GlobalOpenTable where Open.CreateGuid matches the CreateGuid in the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 create context, and Open.ClientGuid matches the ClientGuid of the connection that received this request.

If an Open is not found, the server MUST continue the create process specified in the "Open Execution" Phase, and perform the following additional steps:

  • The server MUST set Open.CreateGuid to the CreateGuid in SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2.

  • In the "Successful Open Initialization" phase, the server MUST set Open.IsDurable to TRUE. The server MUST also set Open.DurableOwner to a security descriptor accessible only by the user represented by Open.Session.SecurityContext. If the SMB2_DHANDLE_FLAG_PERSISTENT bit is set in the Flags field of the request, TreeConnect.Share.IsCA is TRUE, and Connection.ServerCapabilities includes SMB2_GLOBAL_CAP_PERSISTENT_HANDLES, the server MUST set Open.IsPersistent to TRUE.

If an Open is found and the SMB2_FLAGS_REPLAY_OPERATION bit is not set in the SMB2 header, the server MUST fail the request with STATUS_DUPLICATE_OBJECTID.

If an Open is found and the SMB2_FLAGS_REPLAY_OPERATION bit is set in the SMB2 header, the server MUST perform the following: 

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

  • The server MUST construct an SMB2_CREATE_DURABLE_HANDLE_RESPONSE_V2 create context as follows:

    • The Timeout field MUST be set to Open.DurableOpenTimeout.

    • If Open.IsPersistent is TRUE, the server MUST set the SMB2_DHANDLE_FLAG_PERSISTENT bit in the Flags field.

    • The Buffer specified by the response MUST include the CreateContextsLength and CreateContextsOffset fields.

The server MUST skip the construction of the SMB2_CREATE_DURABLE_HANDLE_RESPONSE_V2 create context if the SMB2_DHANDLE_FLAG_PERSISTENT bit is not set in the Flags field of the request and if neither of the following conditions is met:

  • Open.OplockLevel is equal to SMB2_OPLOCK_LEVEL_BATCH.

  • Open.Lease.LeaseState has the SMB2_LEASE_HANDLE_CACHING bit set.

The server MUST construct an SMB2_CREATE_DURABLE_HANDLE_RESPONSE_V2 response create context, with the following values set, as specified in section 2.2.14.2.12.

  • If the Timeout value in the request is not zero, the Timeout value in the response SHOULD<281> be set to whichever is smaller, the Timeout value in the request or 300 seconds.

  • If the Timeout value in the request is zero, the Timeout value in the response SHOULD<282> be set to an implementation-specific value

  • Open.DurableOpenTimeout SHOULD<283> be set to the Timeout value in the response

  • If Open.IsPersistent is TRUE, the server MUST set the SMB2_DHANDLE_FLAG_PERSISTENT bit in the Flags field.

  • The buffer specified by the response MUST include the CreateContextLength and CreateContextOffset fields.

Show: