directory with a symlink pointing to non-existing file

Jeremy Allison jra at
Thu Oct 21 17:23:04 UTC 2021

On Thu, Oct 21, 2021 at 10:05:47AM -0700, Jeremy Allison via samba-technical wrote:
>On Thu, Oct 21, 2021 at 06:35:35PM +0200, Pavel Filipensky via samba-technical wrote:
>>if on local linux file system there is a directory with only one file - a
>>symlink pointing to a non-existing file then:
>>- from SMB point of view the directory is *empty*, such symlink is not shown
>>- but SMB does allow to delete such *empty* directory, it gives
>>This is seen with samba 4.10 and 4.13. Could there be a difference with the
>>latest samba?
>>setting those smb.conf params has no effect:
>>allow insecure wide links = yes
>>unix extensions = no
>>follow symlinks = yes
>>wide links = yes
>Can you try setting the share parameter:
>delete veto files = yes
>I think this will allow a dangling symlink
>to be removed when a directory is deleted
>(at least in 4.15.0).

Ah, just checked - it doesn't work due
to the check in can_delete_directory_fsp()
due to this code:

1930                 if (S_ISLNK(smb_dname_full->st.st_ex_mode)) {
1931                         TALLOC_FREE(talloced);
1932                         TALLOC_FREE(fullname);
1933                         TALLOC_FREE(smb_dname_full);
1934                         DBG_DEBUG("got name %s - can't delete\n", dname);
1935                         status = NT_STATUS_DIRECTORY_NOT_EMPTY;
1936                         break;
1937                 }

if dname had matches a veto file parameter then
it would allow deletion, but not if it's a non
vetoed pathname.

More information about the samba-technical mailing list