188.8.131.52 Receiving an SMB_COM_DELETE_DIRECTORY Request
The TID in the SMB_Header.TID field MUST be a valid TID for this SMB connection, as defined in section 184.108.40.206.
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 220.127.116.11 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 18.104.22.168.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.<241> 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<242> 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 22.214.171.124.2) message and MUST set SMB_Header.Status to indicate success.
The response MUST be sent to the client as specified in section 126.96.36.199.