Hello community,

here is the log from the commit of package kio-extras5 for openSUSE:Factory 
checked in at 2017-11-04 10:24:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kio-extras5 (Old)
 and      /work/SRC/openSUSE:Factory/.kio-extras5.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kio-extras5"

Sat Nov  4 10:24:00 2017 rev:49 rq:538102 version:17.08.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/kio-extras5/kio-extras5.changes  2017-10-23 
16:30:54.907525020 +0200
+++ /work/SRC/openSUSE:Factory/.kio-extras5.new/kio-extras5.changes     
2017-11-04 10:24:48.284676607 +0100
@@ -1,0 +2,6 @@
+Wed Nov  1 12:36:03 UTC 2017 - [email protected]
+
+- Add workaround-bug-in-libsmbclient-4.7.patch to make browsing
+  samba shares work with libsmbclient 4.7 (boo#1065868, kde#385708)
+
+-------------------------------------------------------------------

New:
----
  workaround-bug-in-libsmbclient-4.7.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kio-extras5.spec ++++++
--- /var/tmp/diff_new_pack.sGDuL4/_old  2017-11-04 10:24:48.820657103 +0100
+++ /var/tmp/diff_new_pack.sGDuL4/_new  2017-11-04 10:24:48.824656957 +0100
@@ -31,6 +31,8 @@
 Source:         kio-extras-%{version}.tar.xz
 Source99:       %{name}-rpmlintrc
 Patch0:         fix-mtp-paste-with-KF5-5.25.diff
+# PATCH-FIX-UPSTREAM
+Patch1:         workaround-bug-in-libsmbclient-4.7.patch
 BuildRequires:  OpenEXR-devel
 BuildRequires:  flac-devel
 BuildRequires:  gperf
@@ -108,6 +110,7 @@
 %prep
 %setup -q -n kio-extras-%{version}
 %patch0 -p1
+%patch1 -p1
 sed -i '/^add_subdirectory( doc )/d' CMakeLists.txt
 
 %build

++++++ workaround-bug-in-libsmbclient-4.7.patch ++++++
>From a36b797913a844dbb26d5dc1542b3ce304f5f445 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Mal=C3=BD?= <[email protected]>
Date: Tue, 31 Oct 2017 18:19:21 -0600
Subject: 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.

BUG: 385708

Reviewers: ngraham, davidedmundson, elvisangelaccio, #frameworks

Reviewed By: ngraham, davidedmundson

Subscribers: cfeck, rdieter, graesslin, z3ntu

Differential Revision: https://phabricator.kde.org/D8387
---
 smb/kio_smb.cpp        | 30 +++++++++++++++++++++++++++++-
 smb/kio_smb.h          |  3 +++
 smb/kio_smb_browse.cpp |  7 ++++++-
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/smb/kio_smb.cpp b/smb/kio_smb.cpp
index 2a2e424..1ea3f99 100644
--- a/smb/kio_smb.cpp
+++ b/smb/kio_smb.cpp
@@ -31,12 +31,40 @@
 #include "kio_smb.h"
 #include "kio_smb_internal.h"
 #include <QCoreApplication>
+#include <QVersionNumber>
 
 Q_LOGGING_CATEGORY(KIO_SMB, "kio_smb")
 
+bool needsEEXISTWorkaround()
+{
+    /* There is an issue with some libsmbclient versions that return EEXIST
+     * return code from smbc_opendir() instead of EPERM when the user
+     * tries to access a resource that requires login authetification.
+     * We are working around the issue by treating EEXIST as a special case
+     * of "invalid/unavailable credentials" if we detect that we are using
+     * the affected versions of libsmbclient
+     *
+     * Upstream bug report: https://bugzilla.samba.org/show_bug.cgi?id=13050
+     */
+    static const QVersionNumber firstBrokenVer{4, 7, 0};
+    static const QVersionNumber lastBrokenVer{9, 9, 9}; /* Adjust accordingly 
when this gets fixed upstream */
+
+    const QVersionNumber currentVer = 
QVersionNumber::fromString(smbc_version());
+    qCDebug(KIO_SMB) << "Using libsmbclient library version" << currentVer;
+
+    if (currentVer >= firstBrokenVer && currentVer <= lastBrokenVer) {
+        qCDebug(KIO_SMB) << "Detected broken libsmbclient version" << 
currentVer;
+        return true;
+    }
+
+    return false;
+}
+
 //===========================================================================
 SMBSlave::SMBSlave(const QByteArray& pool, const QByteArray& app)
-    : SlaveBase( "smb", pool, app ), m_openFd(-1)
+    : SlaveBase( "smb", pool, app ),
+      m_openFd(-1),
+      m_enableEEXISTWorkaround(needsEEXISTWorkaround())
 {
     m_initialized_smbc = false;
 
diff --git a/smb/kio_smb.h b/smb/kio_smb.h
index 77866b1..22fa036 100644
--- a/smb/kio_smb.h
+++ b/smb/kio_smb.h
@@ -278,6 +278,7 @@ private:
     void smbCopy(const QUrl& src, const QUrl &dest, int permissions, 
KIO::JobFlags flags);
     void smbCopyGet(const QUrl& src, const QUrl& dest, int permissions, 
KIO::JobFlags flags);
     void smbCopyPut(const QUrl& src, const QUrl& dest, int permissions, 
KIO::JobFlags flags);
+    bool workaroundEEXIST(const int errNum) const;
 
     void fileSystemFreeSpace(const QUrl &url);
 
@@ -288,6 +289,8 @@ private:
      */
     int m_openFd;
     SMBUrl m_openUrl;
+
+    const bool m_enableEEXISTWorkaround; /* Enables a workaround for some 
broken libsmbclient versions */
 };
 
 //==========================================================================
diff --git a/smb/kio_smb_browse.cpp b/smb/kio_smb_browse.cpp
index 5995eec..47b2b32 100644
--- a/smb/kio_smb_browse.cpp
+++ b/smb/kio_smb_browse.cpp
@@ -473,7 +473,7 @@ void SMBSlave::listDir( const QUrl& kurl )
    }
    else
    {
-       if (errNum == EPERM || errNum == EACCES) {
+       if (errNum == EPERM || errNum == EACCES || workaroundEEXIST(errNum)) {
            if (checkPassword(m_current_url)) {
                redirection( m_current_url );
                finished();
@@ -522,3 +522,8 @@ void SMBSlave::fileSystemFreeSpace(const QUrl& url)
     finished();
 }
 
+bool SMBSlave::workaroundEEXIST(const int errNum) const
+{
+    return (errNum == EEXIST) && m_enableEEXISTWorkaround;
+}
+
-- 
cgit v0.11.2


Reply via email to