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 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.IsReplayEligible is TRUE and 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 perform the following:

    • If Open.FileAttributes includes FILE_ATTRIBUTE_DIRECTORY or the underlying object store does not grant durability, the server MUST skip the rest of the processing in this section.

    • If the underlying object store grants durability, the server MUST perform the following:

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

      • The server MUST set Open.IsReplayEligible to TRUE if TreeConnect.Share.Type is STYPE_DISKTREE and any of the following conditions are satisfied:

        • Open.IsPersistent is TRUE.

        • Open.FileAttributes does not include FILE_ATTRIBUTE_DIRECTORY and Open.GrantedAccess includes FILE_READ_DATA, FILE_EXECUTE, FILE_WRITE_DATA, FILE_APPEND_DATA, or DELETE access.

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 set Open.Connection to the connection that received this request.

If Open.IsDurable is TRUE, the server SHOULD<340> 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 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.

  • If SMB2_FLAGS_REPLAY_OPERATION bit is set in the SMB2 header, Timeout field MUST be set to Open.DurableOpenTimeout.

  • Otherwise, the server MUST perform the following:

    • If the Timeout value in the request is not zero, the Timeout value in the response SHOULD<341> 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<342> be set to an implementation-specific value.

    • Open.DurableOpenTimeout MUST be set to the Timeout value in the response.