Bug 385708

Summary: kio-smb reports internal error instead of asking for login credentials with libsmbclient 4.7
Product: [Frameworks and Libraries] kio-extras Reporter: madcatx
Component: defaultAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: Alois.Steindl, bronsonmathews, bruno, bugzilla, francisd, jaskerx, kde, macca728, nate, rdieter, simonandric5, unnamedpoet
Priority: NOR    
Version: 17.08.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugzilla.samba.org/show_bug.cgi?id=13050
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: libsmbclient 4.7 behavior workaround

Description madcatx 2017-10-13 16:46:39 UTC
Created attachment 108334 [details]
libsmbclient 4.7 behavior workaround

This started to happen when Samba 4.7 made it to Arch Linux stable packages. It is probably an issue with libsmbclient libraries rather than kio-smb plugin itself which I already reported here [1]. Given the lack of any response so far I thought it important to report it here along with a kio-smb workaround that seems to work for me.

[1]: https://bugzilla.samba.org/show_bug.cgi?id=13050
Comment 1 David Edmundson 2017-10-13 16:53:15 UTC
With your workaround does it still behave Ok when you visit a URL that really doesn't exist?
Comment 2 madcatx 2017-10-14 09:08:17 UTC
Non-existing files are not really a problem as you should get an ENOENT. There is something oddly wrong with libsmbclient, for instance, entering a nonexistent URL such as smb://MY_SERVER/nonsense (nonsense being a name of a share here) also seems to return EEXIST. With the workaround in place I get incorrectly asked for login creds, without the workaround I just get an "Internal error: File exists" warning. A URL like this - smb://MY_SERVER/good_share/nonsense - however returns ENOENT and I get the correct warning in Dolphin.

The workaround at least lets me enter the login credentials when the server needs them although it is pretty far from an actual solution.
Comment 3 Nate Graham 2017-10-20 17:01:09 UTC
Any chance you can submit the patch on https://phabricator.kde.org/? Even if it's not ideal, it may be better than nothing, and you may get some good suggestions for improvement there.
Comment 4 Nate Graham 2017-10-20 17:14:47 UTC
*** Bug 385999 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2017-10-20 17:15:50 UTC
*** Bug 385483 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2017-10-20 17:16:47 UTC
*** Bug 384201 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2017-10-20 17:27:33 UTC
Looks like this is pretty widespread for users of rolling release distros who got samba 4.7.0. I don't see any movement on the upstream bug report in a month (boo), so my vote is for accepting this patch, once it's on phabricator.
Comment 8 madcatx 2017-10-20 20:06:21 UTC
I was hoping that either the Samba guys will respond to the bug report or there will be others hitting the same problem before submitting this workaround as an actual patch. Since the latter has happened, the patch is now up: https://phabricator.kde.org/D8387

Can anyone think of a way how to restrict this behavior to the broken version(s) of libsmbclient? There doesn't seem to be a way how to ask libsmbclient for any version information.
Comment 9 Nate Graham 2017-10-20 21:02:26 UTC
Any idea how we can get the Samba folks' attention? Clearly a bug report alone isn't sufficient. Do they have a mailing list or a developer forum or something?
Comment 10 Bruno Friedmann 2017-10-31 14:53:35 UTC
Also seen on openSUSE Tumbleweed as samba 4.7.0 has been incorporated
Comment 11 Bruno Friedmann 2017-10-31 14:59:02 UTC
(In reply to Bruno Friedmann from comment #10)
> Also seen on openSUSE Tumbleweed as samba 4.7.0 has been incorporated

Reported on openSUSE as https://bugzilla.opensuse.org/show_bug.cgi?id=1065868
Hope some samba people from there can help
Comment 12 Nate Graham 2017-11-01 00:22:07 UTC
Git commit a36b797913a844dbb26d5dc1542b3ce304f5f445 by Nathaniel Graham, on behalf of Michal Malý.
Committed on 01/11/2017 at 00:21.
Pushed by ngraham into branch 'master'.

Workaround incorrectly returned EEXIST instead of EPERM regression introduced by libsmbclient 4.7

Summary:
There appears to be an issue with libsmbclient 4.7 that returns nonsensical EEXIST error code when a user has not authenticated themselves to access password-protected shares. This patch attempts to work around the issue by treating EEXIST as another case of "invalid login credentials". The workaround tries to detect broken versions of libsmbclient and enables itself only when such a version is found.

See https://bugzilla.samba.org/show_bug.cgi?id=13050 for upstream bug report.

Reviewers: ngraham, davidedmundson, elvisangelaccio, #frameworks

Reviewed By: ngraham, davidedmundson

Subscribers: cfeck, rdieter, graesslin, z3ntu

Differential Revision: https://phabricator.kde.org/D8387

M  +29   -1    smb/kio_smb.cpp
M  +3    -0    smb/kio_smb.h
M  +6    -1    smb/kio_smb_browse.cpp

https://commits.kde.org/kio-extras/a36b797913a844dbb26d5dc1542b3ce304f5f445
Comment 13 Nate Graham 2017-11-05 02:52:01 UTC
Git commit 5ddb81c5ec7d8907ca4a8be20499fa40e75be861 by Nathaniel Graham, on behalf of Michal Malý.
Committed on 05/11/2017 at 02:51.
Pushed by ngraham into branch 'Applications/17.08'.

Workaround incorrectly returned EEXIST instead of EPERM regression introduced by libsmbclient 4.7

Summary:
There appears to be an issue with libsmbclient 4.7 that returns nonsensical EEXIST error code when a user has not authenticated themselves to access password-protected shares. This patch attempts to work around the issue by treating EEXIST as another case of "invalid login credentials". The workaround tries to detect broken versions of libsmbclient and enables itself only when such a version is found.

See https://bugzilla.samba.org/show_bug.cgi?id=13050 for upstream bug report.

Reviewers: ngraham, davidedmundson, elvisangelaccio, #frameworks

Reviewed By: ngraham, davidedmundson

Subscribers: cfeck, rdieter, graesslin, z3ntu

Differential Revision: https://phabricator.kde.org/D8387

M  +29   -1    smb/kio_smb.cpp
M  +3    -0    smb/kio_smb.h
M  +6    -1    smb/kio_smb_browse.cpp

https://commits.kde.org/kio-extras/5ddb81c5ec7d8907ca4a8be20499fa40e75be861
Comment 14 madcatx 2017-11-05 12:28:59 UTC
Small update, Samba 4.7.1 does not fix the problem (https://www.samba.org/samba/history/samba-4.7.1.html) and per my testing the current workaround is still working.
Comment 15 Nate Graham 2017-12-01 21:16:57 UTC
*** Bug 387485 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2018-01-12 20:47:10 UTC
*** Bug 388791 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2018-02-19 18:26:04 UTC
*** Bug 390551 has been marked as a duplicate of this bug. ***