Bug 14711 - Invisible Symlinks
Summary: Invisible Symlinks
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.14.4
Hardware: Other Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-19 16:27 UTC by David Walker
Modified: 2022-01-19 00:58 UTC (History)
0 users

See Also:


Attachments
Test case script (2.48 KB, text/plain)
2021-05-19 16:27 UTC, David Walker
no flags Details
Test case result (3.88 KB, text/x-log)
2021-05-19 16:28 UTC, David Walker
no flags Details
Server's smb.conf (1.45 KB, text/plain)
2021-05-19 16:29 UTC, David Walker
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Walker 2021-05-19 16:27:22 UTC
Created attachment 16616 [details]
Test case script

If the first entry created in a shared directory is a symlink, it is not visible to clients. In fact, if a symlink ever becomes the only entry in a directory, it will disappear. An invisible symlink will reappear if it is renamed (and there is at least one other entry in the directory).

I'll attach a test case and the result of running it. The same server-side files are shared via Samba and NFS, changes are made via the NFS share, and what the client sees via both shares is shown.

I've also included the server's smb.conf. The server is a Raspberry Pi 4b (aarch64) running openSUSE Tumbleweed (20210507 snapshot) and Samba 4.14.4+git.162.18fd73a39a0-1.1. The share is from an XFS file system on the server. The problem has been seen on an x86_64 Tumbleweed laptop, as well as an NVidia Shield.
Comment 1 David Walker 2021-05-19 16:28:36 UTC
Created attachment 16617 [details]
Test case result
Comment 2 David Walker 2021-05-19 16:29:06 UTC
Created attachment 16618 [details]
Server's smb.conf
Comment 3 Jeremy Allison 2021-05-19 19:32:36 UTC
I can't reproduce this with current master code. Is it possible for you to rebuild with master and check ?
Comment 4 David Walker 2021-05-22 05:42:33 UTC
Yup, it looks like the issue has been fixed since 4.14.4. I didn't do a lot of testing, but Master sees a single symlink in a directory that the Tumbleweed distribution of Samba does not. In case Tumbleweed's 4.14.4 differs from the official one, I also tried downloading the "samba-4.14.4" tagged source from GitLab, and it also fails.

So, I guess the next release will likely be OK, but it appears there is a bug in 4.14.4.
Comment 5 Jeremy Allison 2021-05-24 16:37:14 UTC
In master, the following commits may be the fix.

git show 36a074bb1a23df2bc6e4d6c6b6cfd7023e6ea58d
git show 5c3470c0f2937f0a878469f751e868b7e80234d8
git show d590d9130ee28cc0c39d605015f4b5904ba582f5
git show d78964c40b5ca5ee0658c46d492b3dcd6f6b4b94

My money is on the last one. If you can confirm any of these fix the issue for 4.14.x I'll get it back-ported for the next 4.14.x release.
Comment 6 David Walker 2021-05-27 04:10:28 UTC
Sorry for the delay. I had to learn more git than I've needed in the past. I believe 5c3470c0f2937f0a878469f751e868b7e80234d8 is the fix, but to make sure, here's an outline of what I did:

Set up:

  git clone https://gitlab.com/samba-team/samba.git

  ./configure --prefix=/home/dhwalker/NoBackup/Samba/SambaInst --oldincludedir=/home/dhwalker/NoBackup/Samba

  git switch -c try1

Then I tried the first commit you listed:

  git checkout 36a074bb1a23df2bc6e4d6c6b6cfd7023e6ea58d

I used "make" and "make install" to build, then stopped the running smbd and nmbd, and:

  cd /home/dhwalker/NoBackup/Samba/SambaInst
  sudo cp /etc/samba/* etc
  sudo bin/smbpasswd -a dwmedia
  sudo sbin/smbd
  sudo sbin/nmbd

This didn't work: "INTERNAL ERROR: cups_pcap_load_async: reinit_after_fork() failed in pid 4753 (4.14.4)". I can provide more detail, but I suspect it doesn't matter.

I repeated with the second commit you listed, 5c3470c0f2937f0a878469f751e868b7e80234d8, and that one worked (saw a lone symlink in a directory).

I didn't try the other commits you listed, but I can if that'll help.
Comment 7 Jeremy Allison 2021-05-27 22:26:36 UTC
I doubt that ref is the fix:

commit 5c3470c0f2937f0a878469f751e868b7e80234d8
Author: Jeremy Allison <jra@samba.org>
Date:   Mon Apr 19 16:38:00 2021 -0700

    s3: smbd: Prevent fchmod on a symlink.

as this only prevents a client operation.

d590d9130ee28cc0c39d605015f4b5904ba582f5

and

d78964c40b5ca5ee0658c46d492b3dcd6f6b4b94

are much more likely IMHO.
Comment 8 David Walker 2021-05-29 07:51:06 UTC
My apologies! I mistakenly was thinking that the list of commits you gave me were in chronological order. Now that I've checked their timestamps, I see they're in reverse chronological order.

So, d590d9130ee28cc0c39d605015f4b5904ba582f5 works properly, and d78964c40b5ca5ee0658c46d492b3dcd6f6b4b94 does not, so I think d590d9130ee28cc0c39d605015f4b5904ba582f5 is the fix.
Comment 9 Jeremy Allison 2022-01-19 00:58:26 UTC
"Yup, it looks like the issue has been fixed since 4.14.4".