** Description changed:

+ [Impact]
+ 
+ The current samba package on focal suffers from a bug that manifests
+ itselft when the SMB1 (NT1) protocol is being used. In this scenario,
+ the user will see regular files being presented as directories when
+ using GIO/gvfs to browse the samba share (e.g., via nautilus, or using
+ the "gio" command). Even though the SMB1 protocol is old, it is still
+ used by some NAS devices and therefore this issue can impact a non-
+ trivial number of users.
+ 
+ The fix, which had to be cherry-picked from upstream, is to revert a
+ specific libsmb code that attempts to obtain some POSIX stat(2)
+ information when running on UNIX-like environments. The upstream commit
+ can be found here:
+ 
+   https://gitlab.com/samba-
+ team/devel/samba/-/commit/39c910fd9cba3caf7414274b678b9eee33d7e20b
+ 
+ [Test Case]
+ 
+ In order to reproduce the bug, one can do:
+ 
+ $ lxc launch ubuntu-daily:focal samba-bug1872476
+ $ lxc shell samba-bug1872476
+ 
+ When inside the LXC container, as root:
+ 
+ # apt install samba smbclient gvfs gvfs-backends dbus-x11
+ # sed -i 's/^\[global\]/[global]\n client min protocol = NT1\n client max 
protocol = NT1\n server min protocol = NT1\n server max protocol = NT1/g' 
/etc/samba/smb.conf
+ # cat >> /etc/samba/smb.conf << __EOF__
+ [testshare]
+   path = /testshare
+   readonly = no
+   browsable = yes
+   guest ok = yes
+ __EOF__
+ # mkdir /testshare
+ # cat > /testshare/123.txt << __EOF__
+ Hi, this is a test for samba bug 1872476.
+ This is a regular file, and not a directory.
+ __EOF__
+ # ufw allow samba
+ # eval $(dbus-launch --sh-syntax)
+ # gio mount -a smb://127.0.0.1/testshare
+ # gio info smb://127.0.0.1/testshare/123.txt | grep '^type:'
+ type: directory
+ 
+ As can be seen above, the regular file '123.txt' is mistakenly listed as
+ a directory.
+ 
+ There's a PPA with a proposed fix here:
+ 
+ https://launchpad.net/~sergiodj/+archive/ubuntu/samba-bug1872476-v2
+ 
+ When trying it out, it is important to umount the share and remount it
+ with the new package:
+ 
+ # gio mount -u smb://127.0.0.1/testshare
+ # add-apt-repository ppa:sergiodj/samba-bug1872476-v2
+ # apt update && apt upgrade
+ # gio mount -a smb://127.0.0.1/testshare
+ # gio info smb://127.0.0.1/testshare/123.txt | grep '^type:'
+ type: regular
+ 
+ [Regression Potential]
+ 
+ This change is relatively simple and has been incorporated by upstream
+ and by other distributions, but it touches libsmb, which is a central
+ area of samba.
+ 
+ The POSIX stat(2) call was only made when dealing with the NT1/SMB1
+ version of the samba protocol running on UNIX-like environments, which
+ contributes to reduce the impact of the patch.
+ 
+ We can assume that there is regression potential for users of the
+ NT1/SMB1 protocol on UNIX-like environments that are dealing with
+ different types of files (regular, directory, symbolic links, etc.),
+ since the code that the patch modifies is responsible for obtaining the
+ attributes of a file.  Even though the function uses fallback mechanisms
+ (like resorting to qpathinfo calls) to not depend solely on stat(2), the
+ user might experience some regression when trying to determine the type
+ of a file.
+ 
+ [Original Description]
  System : Xubuntu 20.04 LTS, kernel 5.6.2
  Samba : Version 4.11.6-Ubuntu
  
  problem : latest versions of samba can't mount remote disk if the remote 
protocol is too old. Can be fixed by adding "client min protocol = CORE" under 
[global] section in conf.
  But there is another problem, all files in remote disk are shown as folders, 
so we can't read these files
  
  (screenshot : https://ibb.co/g9FW14c)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1872476

Title:
  Shared files are shown as folders

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1872476/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to