smbc_opendir returns EEXIST if login credentials are incorrect, breaking SMB shares in Kodi

Bug #1801227 reported by roothorick
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
High
Karl Stenerud

Bug Description

[Impact]

A regression in Samba causes the wrong error message to be returned on an unsuccessful login, returning EEXIST instead of EACCESS or EPERM.

[Tese Case]

# lxc launch ubuntu:bionic tester && lxc exec tester bash
# apt update && apt dist-upgrade -y && apt install -y samba gvfs libglib2.0-bin gvfs-bin gvfs-backends dbus-x11 &&
echo "
[global]
workgroup = WORKGROUP
security = user
map to guest = bad user
[test]
    path = /tmp
    browseable = yes
    read only = yes
    valid users = someone
" >/etc/samba/smb.conf &&
service smbd restart
# su - -c "dbus-launch gio mount -a smb://localhost/test" ubuntu
gio: smb://localhost/test/: Failed to mount Windows share: File exists

[Regression Potential]

The change reverts a regression in the closing order in certain cases from a previous version of samba, and should not cause further regressions in the fix.

[Original Description]

Target to milestone
​ Bionic Remove
Triaged

High

  Karl Stenerud

Target to milestone
Also affects project (?) Also affects distribution/package Nominate for series
Edit
Bug Description

In Kodi, try to add a smb:// URL for a share that doesn't allow guest logins and you'll get a cryptic "File Exists" error. It never asks for login credentials. From online searching, this is most likely due to a bug in libsmbclient where smbc_opendir will return EEXIST instead of a more appropriate error code if invalid login credentials were provided.

This was fixed in Samba 4.8:

https://github.com/samba-team/samba/commit/7470b9b18af282a742929d3fc90f4be5520428a1

But 18.04 is shipping 4.7.

Trying to add a share where the hostname doesn't resolve results in some cryptic messages as well, but that may or may not be a different bug.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: libsmbclient 2:4.7.6+dfsg~ubuntu-0ubuntu2.2
ProcVersionSignature: Ubuntu 4.15.0-38.41-generic 4.15.18
Uname: Linux 4.15.0-38-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Thu Nov 1 21:15:29 2018
InstallationDate: Installed on 2018-09-12 (51 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
RelatedPackageVersions:
 nautilus 1:3.26.4-0~ubuntu18.04.2
 gvfs 1.36.1-0ubuntu1.1
SambaClientRegression: Yes
SourcePackage: samba
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
roothorick (8-roothorick-gmail-com) wrote :
Revision history for this message
roothorick (8-roothorick-gmail-com) wrote :

Found a workaround: Enter the username and password as part of the URL when adding the source. That is:

smb://<username>:<password>@<host>/<folder>/

This isn't really acceptable, as it means the password is plainly visible onscreen as you're setting up the share.

Revision history for this message
Robie Basak (racb) wrote :

Thank you for reporting this bug and helping to make Ubuntu better.

Cosmic is on 4.8 so this presumably affects Bionic only.

tags: added: server-next
Changed in samba (Ubuntu):
status: New → Fix Released
Changed in samba (Ubuntu Bionic):
status: New → Triaged
importance: Undecided → High
tags: added: bitesize
Changed in samba (Ubuntu Bionic):
assignee: nobody → Karl Stenerud (kstenerud)
description: updated
description: updated
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Ben, or anyone else affected,

Accepted samba into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/samba/2:4.7.6+dfsg~ubuntu-0ubuntu2.6 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in samba (Ubuntu Bionic):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Karl Stenerud (kstenerud) wrote :

Verified fixed

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Which package version has been used for verification?

Changed in samba (Ubuntu Bionic):
status: Fix Committed → Incomplete
Revision history for this message
Karl Stenerud (kstenerud) wrote :

samba 2:4.7.6+dfsg~ubuntu-0ubuntu2.6 (https://launchpad.net/ubuntu/+source/samba/2:4.7.6+dfsg~ubuntu-0ubuntu2.6) in the proposed pocket was used for verification.

Follow the testing steps in https://code.launchpad.net/~kstenerud/ubuntu/+source/samba/+git/samba/+merge/359602 except instead of adding the PPA, add the sources list entry:

deb http://archive.ubuntu.com/ubuntu bionic-proposed main

Changed in samba (Ubuntu Bionic):
status: Incomplete → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for samba has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package samba - 2:4.7.6+dfsg~ubuntu-0ubuntu2.6

---------------
samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.6) bionic; urgency=medium

  * d/p/auth-fail-eexist.diff: smbc_opendir should not return EEXIST with
    invalid login credentials. Thanks to David Mulder. (LP: #1801227)

 -- Karl Stenerud <email address hidden> Fri, 23 Nov 2018 15:58:41 +0100

Changed in samba (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.