Shared files are shown as folders
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
samba (Ubuntu) |
Fix Released
|
High
|
Sergio Durigan Junior | ||
Focal |
Fix Released
|
High
|
Sergio Durigan Junior |
Bug Description
[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:/
[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\
# 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.
# gio info smb://127.
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:/
When trying it out, it is important to umount the share and remount it with the new package:
# gio mount -u smb://127.
# add-apt-repository ppa:sergiodj/samba-bug1872476-v2
# apt update && apt upgrade
# gio mount -a smb://127.
# gio info smb://127.
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:/
Related branches
- Rafael David Tinoco (community): Approve
- Canonical Server: Pending requested
- Canonical Server Core Reviewers: Pending requested
-
Diff: 120 lines (+98/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/0023-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch (+88/-0)
debian/patches/series (+1/-0)
CVE References
Changed in samba (Ubuntu): | |
assignee: | nobody → Sergio Durigan Junior (sergiodj) |
Changed in samba (Ubuntu): | |
importance: | Undecided → High |
tags: | added: rls-ff-incoming |
Changed in samba (Ubuntu Focal): | |
assignee: | nobody → Sergio Durigan Junior (sergiodj) |
status: | New → In Progress |
importance: | Undecided → High |
description: | updated |
Changed in samba (Ubuntu Focal): | |
status: | Confirmed → Fix Released |
Changed in samba (Ubuntu Focal): | |
status: | Confirmed → Triaged |
Thank you for taking the time to file a bug report.
Could you please describe detailed steps in order to reproduce this issue ?
Something like:
1) Configure smb.conf like this ""
2) Restart smb service
3) Try to access remote shared folder using smbfs://xxxx/yyyy
4) If it is authenticated or not
5) The other side OS version and configuration
and/or any other information, that might help us reproducing the issue, would be great!
Since there is not enough information in your report to begin triage or to
differentiate between a local configuration problem and a bug in Ubuntu, I
am marking this bug as "Incomplete". We would be grateful if you would:
provide a more complete description of the problem, explain why you
believe this is a bug in Ubuntu rather than a problem specific to your
system, and then change the bug status back to "New".
For local configuration issues, you can find assistance here: www.ubuntu. com/support/ community
http://