共用方式為


3.3.5.6 Receiving an SMB2 LOGOFF Request

When the server receives a request with an SMB2 header with a Command value equal to SMB2 LOGOFF, message handling MUST proceed as follows.

The server MUST locate the session being logged off, as specified in section 3.3.5.2.9.

For each Open in Session.OpenTable, the server MUST perform the following:

  • If Open.IsResilient is TRUE, the server MUST do the following:

    • The server MUST set Open.Session, Open.Connection, and Open.TreeConnect to NULL.

    • The server MUST set Open.ResilientOpenTimeout to the current time plus Open.ResiliencyTimeOut.

    • The server SHOULD<294> start or reset the Resilient Open Scavenger Timer, as specified in section 3.3.2.4, under the following conditions:

      • If the Resilient Open Scavenger Timer is not already active.

      • If the Resilient Open Scavenger Timer is active and ResilientOpenScavengerExpiryTime is greater than Open.ResilientOpenTimeOut.

        In both of the preceding cases, the server MUST set the timer to expire at Open.ResilientOpenTimeOut and MUST set ResilientOpenScavengerExpiryTime to Open.ResilientOpenTimeOut.

  • If Open.IsDurable is TRUE, the server MUST do the following:

    • The server MUST set Open.Session, Open.Connection, and Open.TreeConnect to NULL.

    • The server MUST set Open.DurableOpenScavengerTimeOut to the current time plus Open.DurableOpenTimeOut.

    • The server MUST start the Durable Open Scavenger Timer, as specified in section 3.3.2.2.

  • Otherwise the server MUST close the Open as specified in section 3.3.4.17.

Any tree connects in Session.TreeConnectTable of the old session MUST be deregistered by invoking the event specified in [MS-SRVS] section 3.1.6.7, providing the tuple <TreeConnect.Share.ServerName, TreeConnect.Share.Name> and TreeConnect.TreeGlobalId as input parameters, and each of them MUST be freed. For each deregistered TreeConnect, TreeConnect.Share.CurrentUses MUST be decreased by 1.

If Connection.Dialect belongs to the SMB 3.x dialect family, the server MUST remove the session from each Channel.Connection.SessionTable in Session.ChannelList. All channels in Session.ChannelList MUST be removed and freed.

The server MUST remove this session from the GlobalSessionTable and also from the Connection.SessionTable, and deregister the session by invoking the event specified in [MS-SRVS] section 3.1.6.3, providing Session.SessionGlobalId as input parameter. ServerStatistics.sts0_sopens MUST be decreased by 1.

The server MUST construct an SMB2 LOGOFF Response with a status code of STATUS_SUCCESS, following the syntax specified in section 2.2.8, and send it to the client. The session itself is then freed.

The status code returned by this operation MUST be one of those defined in [MS-ERREF]. Common status codes returned by this operation include:

  • STATUS_SUCCESS

  • STATUS_USER_SESSION_DELETED

  • STATUS_INVALID_PARAMETER

  • STATUS_NETWORK_SESSION_EXPIRED

  • STATUS_ACCESS_DENIED