`rmdir` implementation within smbclient

Anoop C S anoopcs at autistici.org
Thu Aug 2 10:36:16 UTC 2018

Hi all,

We have the following bug report which I looked at recently:

https://bugzilla.samba.org/show_bug.cgi?id=13204 - rmdir on non-empty
directory fails silently

If fsp->initial_delete_on_close is set during a create/open of a
directory we attempt to delete it while closing the fnum based on
whether it is empty or not. But as of now it is not set as we have
this check(directory emptiness) early while opening the directory with
FILE_DELETE_ON_CLOSE set as create option. As a result we never attempt
to delete the directory while closing the fnum and rmdir
return success as we could close the directory.

Does the protocol say that we don't set FILE_DELETE_ON_CLOSE if the
directory is non-empty? If not why are we doing so?

If the current logic is as per protocol how do we move about fixing the
bug? Is it OK if we modify `rmdir` implementation to add explicit check
for directory emptiness?

Anoop C S.

More information about the samba-technical mailing list