Bug 15564 - Removal of symlink to directory fails with NT_STATUS_OBJECT_NAME_NOT_FOUND
Summary: Removal of symlink to directory fails with NT_STATUS_OBJECT_NAME_NOT_FOUND
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.19.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Ralph Böhme
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on: 15549
Blocks:
  Show dependency treegraph
 
Reported: 2024-01-30 20:02 UTC by Björn Baumbach
Modified: 2024-01-31 09:53 UTC (History)
0 users

See Also:


Attachments
level 10 logfile (288.29 KB, text/plain)
2024-01-30 20:02 UTC, Björn Baumbach
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Baumbach 2024-01-30 20:02:08 UTC
Created attachment 18239 [details]
level 10 logfile

Since Samba 4.18 the removal of a symlink, which points to a directory, fails with NT_STATUS_OBJECT_NAME_NOT_FOUND. With 4.17.12 it's working.

The share definition on a basic fileserver is:
[share]
        path = /share
        read only = No

The content on the filesystem looks like:
root@dm9:~# ls -l /share
total 4
drwxr-xr-x 2 TEMP\bb TEMP\domain users 4096 Jan 30 20:36 destdir
lrwxrwxrwx 1 TEMP\bb TEMP\domain users    7 Jan 30 20:05 link_to_destdir -> destdir

Failing command via smbclient:
smb: \> ls
  .                                   D        0  Tue Jan 30 20:53:18 2024
  ..                                  D        0  Tue Jan 30 20:53:18 2024
  destdir                             D        0  Tue Jan 30 20:36:42 2024
  link_to_destdir                     D        0  Tue Jan 30 20:36:42 2024

                29801344 blocks of size 1024. 26055728 blocks available
smb: \> rmdir link_to_destdir
NT_STATUS_OBJECT_NAME_NOT_FOUND removing remote directory file \link_to_destdir

The attached logfile line 3504 shows that the smbd tries to chdir "share" instead of "/share" which fails with "No such file or directory". strace shows the same:
chdir("share")                          = -1 ENOENT (No such file or directory)

The issue is the same if the files are not placed in the share root.
Renaming the symlink is working. Symlinks to files can be removed successfully.
Comment 1 Ralph Böhme 2024-01-31 06:48:08 UTC
Can you please check if this is by chance already fixed by the patches from bug 15549.
Comment 2 Björn Baumbach 2024-01-31 09:53:24 UTC
(In reply to Ralph Böhme from comment #1)
Yes, I confirm, that the fix from bug 15549 solves this issue, too.