Compartilhar via


3.3.5.4 Receiving an SMB_COM_DELETE_DIRECTORY Request

Upon receipt of an SMB_COM_DELETE_DIRECTORY Request (section 2.2.4.2.1) from the client, the server MUST verify the following:

  • The TID in the SMB_Header.TID field MUST be a valid TID for this SMB connection, as defined in section 3.3.5.2.

  • The pathname in the SMB_Data.Bytes.DirectoryName field MUST represent a valid directory within the share indicated by the TID.

  • The UID in the SMB_Header.TID field MUST be valid, as defined in section 3.3.5.2 and MUST represent the security context of a user with permission to delete the directory. If the user does not have permission to delete the directory, the server MUST return an error response with STATUS_ACCESS_DENIED (ERRDOS/ERRnoaccess) and MUST increase Server.Statistics.sts0_permerrors by 1.

  • The specified directory MUST NOT be the root directory of the share (which cannot be deleted by the client).

  • The specified directory MUST be empty.

If any of the preceding conditions is not met, the server MUST return an error message with the appropriate status code, as listed in section 2.2.4.2.2. Otherwise, the server MUST attempt to delete the directory. If the deletion fails, the server MUST return an error message with a status code indicating the cause of the failure.<242> If the directory is not empty, deletion MUST fail with STATUS_DIRECTORY_NOT_EMPTY (ERRDOS/ERRnoaccess).

If the deletion succeeds, the server MUST perform a lookup in Server.Connection.SearchOpenTable for Server.SearchOpens with Server.SearchOpen.TIDs that match SMB_Header.TID and SHOULD<243> close any such Server.SearchOpen that represents a search on the deleted directory, as determined by a comparison of Server.SearchOpen.PathName and SMB_Data.Bytes.DirectoryName. The server MUST construct an SMB_COM_DELETE_DIRECTORY Response (section 2.2.4.2.2) message and MUST set SMB_Header.Status to indicate success.

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