次の方法で共有


3.3.5.45 Receiving an SMB_COM_TREE_CONNECT_ANDX Request

When the server receives an SMB_COM_TREE_CONNECT_ANDX Request (section 2.2.4.55.1), it MUST attempt to connect to the share indicated in the Path field. The server MUST provide <server name, share name> parsed from the Path field to invoke the event Server Normalizes a ServerName ([MS-SRVS] section 3.1.6.8) and to get the updated server name. The server MUST use <updated server name, share name> to look up the Share in Server.ShareTable. If the share is not found, the server MUST send an error response with a status of STATUS_BAD_NETWORK_NAME (ERRSRV/ERRinvnetname).

Server.Paused with a value of TRUE indicates that all shares can only be accessed by an administrator. Under these conditions, if an SMB_COM_TREE_CONNECT Request (section 2.2.4.50.1) is received from a user that is not an administrator, the server MUST send an error response with a status of STATUS_SHARING_PAUSED (ERRDOS/ERRpaused).<307>

If the server global variable Server.ShareLevelAuthentication is FALSE, the Password field in the request MUST be ignored, and the UID field in the header MUST be used to look up the Server.Session.UserSecurityContext to determine access rights to the share. If the user is not granted access in Share.FileSecurity, the server MAY fail the request with STATUS_ACCESS_DENIED.<308>

If Server.ShareLevelAuthentication is TRUE, PasswordLength bytes of the Password field MUST be passed to the authentication subsystem as a share-level password. If authentication fails, the server MUST send an error response with a status of STATUS_LOGON_FAILURE (ERRDOS/ERRnoaccess).

The server MUST check the validity of the SMB_Data.Bytes.Service field in the request. If the value does not match any of those listed in section 2.2.4.55.1, the server MUST fail the request with a value of STATUS_BAD_DEVICE_TYPE (ERRSRV/ERRinvdevice).

The server MUST invoke the Server Notifies Current Uses of a Share ([MS-SRVS] section 3.1.6.15) event with the tuple <ServerName, ShareName> to get the total number of current uses of the share. If the number of current uses is equal to or greater than Share.MaxUses, the server MUST fail the request with STATUS_REQUEST_NOT_ACCEPTED. If the Tree Connect is successful, the server MUST allocate a TreeConnect object and insert it into Server.Connection.TreeConnectTable with the following default values:

  • A new TID MUST be generated to uniquely identify this tree connect in Server.Connection.TreeConnectTable.

  • Session MUST be set to the session found on the UID lookup.

  • Share MUST be set to the share found on the lookup in the Server.ShareTable.

  • OpenCount MUST be set to zero.

  • CreationTime MUST be set to current time.

  • Share.CurrentUses MUST be increased by 1.

The server MUST register TreeConnect by invoking the Server Registers a New Treeconnect ([MS-SRVS] section 3.1.6.6) event and MUST assign the return value to Server.TreeConnect.TreeGlobalId.

The TID MUST be returned in the SMB_Header.TID field of the response.

The SMB_Parameters.Words.OptionalSupport field of the response MUST be set from Server.Share.OptionalSupport:

  • If Server.Share.OptionalSupport indicates support for exclusive search attributes in directory search operations, the server MUST set the SMB_SUPPORT_SEARCH_BITS (0x01) bit in the OptionalSupport field of the response.

  • If Server.Share.OptionalSupport indicates that the share is in a DFS namespace, the server MUST set the SMB_SHARE_IS_IN_DFS (0x02) bit in the OptionalSupport field of the response.

The SMB_Data.Bytes.Service field of the response MUST be set from Server.Share.Type.

If the TREE_CONNECT_ANDX_DISCONNECT_TID flag is set in the SMB_Parameter.Words.Flags field, continue the processing for the Opens and open searches, as specified in section 3.3.5.41. If this operation fails, no error is sent to the client.

If the Tree Connect is successful, a complete SMB_COM_TREE_CONNECT_ANDX Response (section 2.2.4.55.2) is sent. Otherwise, an error response message MUST be sent.

The response is sent to the client as specified in section 3.3.4.1.