summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2017-05-10 20:01:38 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2017-05-10 20:06:35 +0200
commitd39d7aa14725bc031c1e1b588b7dafa9198111bd (patch)
treebef97c67775e53ed879364b320c05ae71d45c1fb /net-misc/smb4k
parentdev-python/reno: 2.2.1 bup (diff)
downloadgentoo-d39d7aa14725bc031c1e1b588b7dafa9198111bd.tar.gz
gentoo-d39d7aa14725bc031c1e1b588b7dafa9198111bd.tar.bz2
gentoo-d39d7aa14725bc031c1e1b588b7dafa9198111bd.zip
net-misc/smb4k: Security revbump
Fixes CVE-2017-8849 Gentoo-bug: 618106 Package-Manager: Portage-2.3.5, Repoman-2.3.1
Diffstat (limited to 'net-misc/smb4k')
-rw-r--r--net-misc/smb4k/files/smb4k-1.2.3-CVE-2017-8849.patch365
-rw-r--r--net-misc/smb4k/files/smb4k-2.0.0-CVE-2017-8849.patch361
-rw-r--r--net-misc/smb4k/smb4k-1.2.3-r1.ebuild29
-rw-r--r--net-misc/smb4k/smb4k-2.0.0-r1.ebuild50
4 files changed, 805 insertions, 0 deletions
diff --git a/net-misc/smb4k/files/smb4k-1.2.3-CVE-2017-8849.patch b/net-misc/smb4k/files/smb4k-1.2.3-CVE-2017-8849.patch
new file mode 100644
index 000000000000..b4f619ffb673
--- /dev/null
+++ b/net-misc/smb4k/files/smb4k-1.2.3-CVE-2017-8849.patch
@@ -0,0 +1,365 @@
+From 71554140bdaede27b95dbe4c9b5a028a83c83cce Mon Sep 17 00:00:00 2001
+From: Alexander Reinholdt <alexander.reinholdt@kdemail.net>
+Date: Wed, 10 May 2017 10:23:34 +0200
+Subject: Find the mount/umount commands in the helper
+
+Instead of trusting what we get passed in
+CVE-2017-8849
+---
+ core/smb4kglobal.cpp | 65 +++++++++++++++++++++++++++++++++++-
+ core/smb4kglobal.h | 16 ++++++++-
+ core/smb4kmounter_p.cpp | 78 ++++----------------------------------------
+ helpers/CMakeLists.txt | 6 +++-
+ helpers/smb4kmounthelper.cpp | 51 +++++++++++++++++++++++++++--
+ 5 files changed, 139 insertions(+), 77 deletions(-)
+
+diff --git a/core/smb4kglobal.cpp b/core/smb4kglobal.cpp
+index 172016f..818a78a 100644
+--- a/core/smb4kglobal.cpp
++++ b/core/smb4kglobal.cpp
+@@ -2,7 +2,7 @@
+ smb4kglobal - This is the global namespace for Smb4K.
+ -------------------
+ begin : Sa Apr 2 2005
+- copyright : (C) 2005-2014 by Alexander Reinholdt
++ copyright : (C) 2005-2017 by Alexander Reinholdt
+ email : alexander.reinholdt@kdemail.net
+ ***************************************************************************/
+
+@@ -851,3 +851,66 @@ QStringList Smb4KGlobal::whitelistedMountArguments()
+ #endif
+
+
++const QString Smb4KGlobal::findMountExecutable()
++{
++ QString mount;
++ QStringList paths;
++ paths << "/bin";
++ paths << "/sbin";
++ paths << "/usr/bin";
++ paths << "/usr/sbin";
++ paths << "/usr/local/bin";
++ paths << "/usr/local/sbin";
++
++ for (int i = 0; i < paths.size(); ++i)
++ {
++#if defined(Q_OS_LINUX)
++ mount = KGlobal::dirs()->findExe("mount.cifs", paths.at(i));
++#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++ mount = KGlobal::dirs()->findExe("mount_smbfs", paths.at(i));
++#endif
++
++ if (!mount.isEmpty())
++ {
++ break;
++ }
++ else
++ {
++ continue;
++ }
++ }
++
++ return mount;
++}
++
++
++const QString Smb4KGlobal::findUmountExecutable()
++{
++ // Find the umount program.
++ QString umount;
++ QStringList paths;
++ paths << "/bin";
++ paths << "/sbin";
++ paths << "/usr/bin";
++ paths << "/usr/sbin";
++ paths << "/usr/local/bin";
++ paths << "/usr/local/sbin";
++
++ for ( int i = 0; i < paths.size(); ++i )
++ {
++ umount = KGlobal::dirs()->findExe("umount", paths.at(i));
++
++ if (!umount.isEmpty())
++ {
++ break;
++ }
++ else
++ {
++ continue;
++ }
++ }
++
++ return umount;
++}
++
++
+diff --git a/core/smb4kglobal.h b/core/smb4kglobal.h
+index db1805b..0ef377d 100644
+--- a/core/smb4kglobal.h
++++ b/core/smb4kglobal.h
+@@ -2,7 +2,7 @@
+ smb4kglobal - This is the global namespace for Smb4K.
+ -------------------
+ begin : Sa Apr 2 2005
+- copyright : (C) 2005-2014 by Alexander Reinholdt
++ copyright : (C) 2005-2017 by Alexander Reinholdt
+ email : alexander.reinholdt@kdemail.net
+ ***************************************************************************/
+
+@@ -455,6 +455,20 @@ namespace Smb4KGlobal
+ */
+ KDE_EXPORT QStringList whitelistedMountArguments();
+ #endif
++
++ /**
++ * Find the mount executable on the system.
++ *
++ * @returns the path of the mount executable.
++ */
++ KDE_EXPORT const QString findMountExecutable();
++
++ /**
++ * Find the umount executable on the system.
++ *
++ * @returns the path of the umount executable.
++ */
++ KDE_EXPORT const QString findUmountExecutable();
+ };
+
+ #endif
+diff --git a/core/smb4kmounter_p.cpp b/core/smb4kmounter_p.cpp
+index 63a87ed..342052a 100644
+--- a/core/smb4kmounter_p.cpp
++++ b/core/smb4kmounter_p.cpp
+@@ -207,30 +207,7 @@ bool Smb4KMountJob::createMountAction(Smb4KShare *share, Action *action)
+ //
+ bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
+ {
+- // Find the mount program.
+- QString mount;
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- for (int i = 0; i < paths.size(); ++i)
+- {
+- mount = KGlobal::dirs()->findExe("mount.cifs", paths.at(i));
+-
+- if (!mount.isEmpty())
+- {
+- map.insert("mh_command", mount);
+- break;
+- }
+- else
+- {
+- continue;
+- }
+- }
++ const QString mount = findMountExecutable();
+
+ if (mount.isEmpty())
+ {
+@@ -242,6 +219,8 @@ bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
+ // Do nothing
+ }
+
++ map.insert("mh_command", mount);
++
+ // Mount arguments.
+ QMap<QString, QString> global_options = globalSambaOptions();
+ Smb4KCustomOptions *options = Smb4KCustomOptionsManager::self()->findOptions(share);
+@@ -729,30 +708,7 @@ bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
+ //
+ bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
+ {
+- // Find the mount program.
+- QString mount;
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- for (int i = 0; i < paths.size(); ++i)
+- {
+- mount = KGlobal::dirs()->findExe("mount_smbfs", paths.at(i));
+-
+- if (!mount.isEmpty())
+- {
+- map.insert("mh_command", mount);
+- break;
+- }
+- else
+- {
+- continue;
+- }
+- }
++ const QString mount = findMountExecutable();
+
+ if (mount.isEmpty())
+ {
+@@ -764,6 +720,8 @@ bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
+ // Do nothing
+ }
+
++ map.insert("mh_command", mount);
++
+ // Mount arguments.
+ QMap<QString, QString> global_options = globalSambaOptions();
+ Smb4KCustomOptions *options = Smb4KCustomOptionsManager::self()->findOptions(share);
+@@ -1253,29 +1211,7 @@ bool Smb4KUnmountJob::createUnmountAction(Smb4KShare *share, Action *action)
+ // Do nothing
+ }
+
+- // Find the umount program.
+- QString umount;
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- for ( int i = 0; i < paths.size(); ++i )
+- {
+- umount = KGlobal::dirs()->findExe("umount", paths.at(i));
+-
+- if (!umount.isEmpty())
+- {
+- break;
+- }
+- else
+- {
+- continue;
+- }
+- }
++ const QString umount = findUmountExecutable();
+
+ if (umount.isEmpty() && !m_silent)
+ {
+diff --git a/helpers/CMakeLists.txt b/helpers/CMakeLists.txt
+index e9e670b..cd4228d 100644
+--- a/helpers/CMakeLists.txt
++++ b/helpers/CMakeLists.txt
+@@ -1,7 +1,11 @@
++include_directories(
++ ${CMAKE_SOURCE_DIR}/core
++ ${CMAKE_BINARY_DIR}/core )
++
+ set( smb4kmounthelper_SRCS smb4kmounthelper.cpp )
+
+ kde4_add_executable( mounthelper ${smb4kmounthelper_SRCS} )
+-target_link_libraries( mounthelper ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} )
++target_link_libraries( mounthelper smb4kcore ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} )
+ install( TARGETS mounthelper DESTINATION ${LIBEXEC_INSTALL_DIR} )
+
+ kde4_install_auth_helper_files( mounthelper net.sourceforge.smb4k.mounthelper root )
+diff --git a/helpers/smb4kmounthelper.cpp b/helpers/smb4kmounthelper.cpp
+index a2f2fed..7959020 100644
+--- a/helpers/smb4kmounthelper.cpp
++++ b/helpers/smb4kmounthelper.cpp
+@@ -29,6 +29,7 @@
+
+ // application specific includes
+ #include "smb4kmounthelper.h"
++#include "core/smb4kglobal.h"
+
+ // Qt includes
+ #include <QProcessEnvironment>
+@@ -43,12 +44,35 @@
+ #include <kmountpoint.h>
+ #include <kurl.h>
+
++using namespace Smb4KGlobal;
++
+ KDE4_AUTH_HELPER_MAIN( "net.sourceforge.smb4k.mounthelper", Smb4KMountHelper )
+
+
+ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ {
+ ActionReply reply;
++
++ //
++ // Get the mount executable
++ //
++ const QString mount = findMountExecutable();
++
++ //
++ // Check the executable
++ //
++ if (mount != args["mh_command"].toString())
++ {
++ // Something weird is going on, bail out.
++ reply.setErrorCode(ActionReply::HelperError);
++ reply.setErrorDescription(i18n("Wrong executable passed. Bailing out."));
++ return reply;
++ }
++ else
++ {
++ // Do nothing
++ }
++
+ // The mountpoint is a unique and can be used to
+ // find the share.
+ reply.addData("mh_mountpoint", args["mh_mountpoint"]);
+@@ -75,12 +99,12 @@ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ // Set the mount command here.
+ QStringList command;
+ #if defined(Q_OS_LINUX)
+- command << args["mh_command"].toString();
++ command << mount;
+ command << args["mh_unc"].toString();
+ command << args["mh_mountpoint"].toString();
+ command << args["mh_options"].toStringList();
+ #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
+- command << args["mh_command"].toString();
++ command << mount;
+ command << args["mh_options"].toStringList();
+ command << args["mh_unc"].toString();
+ command << args["mh_mountpoint"].toString();
+@@ -161,6 +185,27 @@ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ ActionReply Smb4KMountHelper::unmount(const QVariantMap &args)
+ {
+ ActionReply reply;
++
++ //
++ // Get the umount executable
++ //
++ const QString umount = findUmountExecutable();
++
++ //
++ // Check the executable
++ //
++ if (umount != args["mh_command"].toString())
++ {
++ // Something weird is going on, bail out.
++ reply.setErrorCode(ActionReply::HelperError);
++ reply.setErrorDescription(i18n("Wrong executable passed. Bailing out."));
++ return reply;
++ }
++ else
++ {
++ // Do nothing
++ }
++
+ // The mountpoint is a unique and can be used to
+ // find the share.
+ reply.addData("mh_mountpoint", args["mh_mountpoint"]);
+@@ -208,7 +253,7 @@ ActionReply Smb4KMountHelper::unmount(const QVariantMap &args)
+
+ // Set the umount command here.
+ QStringList command;
+- command << args["mh_command"].toString();
++ command << umount;
+ command << args["mh_options"].toStringList();
+ command << args["mh_mountpoint"].toString();
+
+--
+cgit v0.11.2
diff --git a/net-misc/smb4k/files/smb4k-2.0.0-CVE-2017-8849.patch b/net-misc/smb4k/files/smb4k-2.0.0-CVE-2017-8849.patch
new file mode 100644
index 000000000000..caef19445c53
--- /dev/null
+++ b/net-misc/smb4k/files/smb4k-2.0.0-CVE-2017-8849.patch
@@ -0,0 +1,361 @@
+From a90289b0962663bc1d247bbbd31b9e65b2ca000e Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Wed, 10 May 2017 10:21:02 +0200
+Subject: Find the mount/umount commands in the helper
+
+Instead of trusting what we get passed in
+
+CVE-2017-8849
+---
+ core/smb4kglobal.cpp | 32 +++++++++++++++++++
+ core/smb4kglobal.h | 14 +++++++++
+ core/smb4kmounter.cpp | 42 +++----------------------
+ helpers/CMakeLists.txt | 7 +++++
+ helpers/smb4kmounthelper.cpp | 75 ++++++++++++++++++++++++++++++++++++++++----
+ helpers/smb4kmounthelper.h | 2 +-
+ 6 files changed, 127 insertions(+), 45 deletions(-)
+
+diff --git a/core/smb4kglobal.cpp b/core/smb4kglobal.cpp
+index 765203d..cfa7ba5 100644
+--- a/core/smb4kglobal.cpp
++++ b/core/smb4kglobal.cpp
+@@ -864,3 +864,35 @@ QStringList Smb4KGlobal::whitelistedMountArguments()
+ #endif
+
+
++const QString Smb4KGlobal::findMountExecutable()
++{
++ QStringList paths;
++ paths << "/bin";
++ paths << "/sbin";
++ paths << "/usr/bin";
++ paths << "/usr/sbin";
++ paths << "/usr/local/bin";
++ paths << "/usr/local/sbin";
++
++#if defined(Q_OS_LINUX)
++ return QStandardPaths::findExecutable("mount.cifs", paths);
++#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++ return QStandardPaths::findExecutable("mount_smbfs", paths);
++#else
++ return QString();
++#endif
++}
++
++
++const QString Smb4KGlobal::findUmountExecutable()
++{
++ QStringList paths;
++ paths << "/bin";
++ paths << "/sbin";
++ paths << "/usr/bin";
++ paths << "/usr/sbin";
++ paths << "/usr/local/bin";
++ paths << "/usr/local/sbin";
++
++ return QStandardPaths::findExecutable("umount", paths);
++}
+diff --git a/core/smb4kglobal.h b/core/smb4kglobal.h
+index 63b6294..f29e342 100644
+--- a/core/smb4kglobal.h
++++ b/core/smb4kglobal.h
+@@ -454,6 +454,20 @@ namespace Smb4KGlobal
+ */
+ Q_DECL_EXPORT QStringList whitelistedMountArguments();
+ #endif
++
++ /**
++ * Find the mount executable on the system.
++ *
++ * @returns the path of the mount executable.
++ */
++ Q_DECL_EXPORT const QString findMountExecutable();
++
++ /**
++ * Find the umount executable on the system.
++ *
++ * @returns the path of the umount executable.
++ */
++ Q_DECL_EXPORT const QString findUmountExecutable();
+ };
+
+ #endif
+diff --git a/core/smb4kmounter.cpp b/core/smb4kmounter.cpp
+index 91f3863..0bc71aa 100644
+--- a/core/smb4kmounter.cpp
++++ b/core/smb4kmounter.cpp
+@@ -1104,16 +1104,7 @@ void Smb4KMounter::timerEvent(QTimerEvent *)
+ bool Smb4KMounter::fillMountActionArgs(Smb4KShare *share, QVariantMap& map)
+ {
+ // Find the mount program.
+- QString mount;
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- mount = QStandardPaths::findExecutable("mount.cifs", paths);
++ const QString mount = findMountExecutable();
+
+ if (!mount.isEmpty())
+ {
+@@ -1645,16 +1636,7 @@ bool Smb4KMounter::fillMountActionArgs(Smb4KShare *share, QVariantMap& map)
+ bool Smb4KMounter::fillMountActionArgs(Smb4KShare *share, QVariantMap& map)
+ {
+ // Find the mount program.
+- QString mount;
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- mount = QStandardPaths::findExecutable("mount_smbfs", paths);
++ const QString mount = findMountExecutable();
+
+ if (!mount.isEmpty())
+ {
+@@ -1823,15 +1805,7 @@ bool Smb4KMounter::fillUnmountActionArgs(Smb4KShare *share, bool force, bool sil
+ //
+ // The umount program
+ //
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- QString umount = QStandardPaths::findExecutable("umount", paths);
++ const QString umount = findUmountExecutable();
+
+ if (umount.isEmpty() && !silent)
+ {
+@@ -1884,15 +1858,7 @@ bool Smb4KMounter::fillUnmountActionArgs(Smb4KShare *share, bool force, bool sil
+ //
+ // The umount program
+ //
+- QStringList paths;
+- paths << "/bin";
+- paths << "/sbin";
+- paths << "/usr/bin";
+- paths << "/usr/sbin";
+- paths << "/usr/local/bin";
+- paths << "/usr/local/sbin";
+-
+- QString umount = QStandardPaths::findExecutable("umount", paths);
++ const QString umount = findUmountExecutable();
+
+ if (umount.isEmpty() && !silent)
+ {
+diff --git a/helpers/CMakeLists.txt b/helpers/CMakeLists.txt
+index 77bb3a5..015c8b6 100644
+--- a/helpers/CMakeLists.txt
++++ b/helpers/CMakeLists.txt
+@@ -1,8 +1,15 @@
++include_directories(
++ ${CMAKE_CURRENT_SOURCE_DIR}
++ ${CMAKE_CURRENT_BINARY_DIR}
++ ${CMAKE_SOURCE_DIR}/core
++ ${CMAKE_BINARY_DIR}/core)
++
+ set(smb4kmounthelper_SRCS smb4kmounthelper.cpp)
+
+ add_executable(mounthelper ${smb4kmounthelper_SRCS})
+
+ target_link_libraries(mounthelper
++ smb4kcore
+ Qt5::Core
+ KF5::Auth
+ KF5::CoreAddons
+diff --git a/helpers/smb4kmounthelper.cpp b/helpers/smb4kmounthelper.cpp
+index 641530e..0a1e215 100644
+--- a/helpers/smb4kmounthelper.cpp
++++ b/helpers/smb4kmounthelper.cpp
+@@ -2,7 +2,7 @@
+ The helper that mounts and unmounts shares.
+ -------------------
+ begin : Sa Okt 16 2010
+- copyright : (C) 2010-2016 by Alexander Reinholdt
++ copyright : (C) 2010-2017 by Alexander Reinholdt
+ email : alexander.reinholdt@kdemail.net
+ ***************************************************************************/
+
+@@ -29,6 +29,7 @@
+
+ // application specific includes
+ #include "smb4kmounthelper.h"
++#include "../core/smb4kglobal.h"
+
+ // Qt includes
+ #include <QProcessEnvironment>
+@@ -42,14 +43,24 @@
+ #include <KI18n/KLocalizedString>
+ #include <KIOCore/KMountPoint>
+
++using namespace Smb4KGlobal;
++
+ KAUTH_HELPER_MAIN("org.kde.smb4k.mounthelper", Smb4KMountHelper);
+
+
+ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ {
++ //
++ // The action reply
++ //
+ ActionReply reply;
+
+ //
++ // Get the mount executable
++ //
++ const QString mount = findMountExecutable();
++
++ //
+ // Iterate through the entries.
+ //
+ QMapIterator<QString, QVariant> it(args);
+@@ -61,6 +72,20 @@ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ QVariantMap entry = it.value().toMap();
+
+ //
++ // Check the executable
++ //
++ if (mount != entry["mh_command"].toString())
++ {
++ // Something weird is going on, bail out.
++ reply.setType(ActionReply::HelperErrorType);
++ return reply;
++ }
++ else
++ {
++ // Do nothing
++ }
++
++ //
+ // The process
+ //
+ KProcess proc(this);
+@@ -87,12 +112,12 @@ ActionReply Smb4KMountHelper::mount(const QVariantMap &args)
+ //
+ QStringList command;
+ #if defined(Q_OS_LINUX)
+- command << entry["mh_command"].toString();
++ command << mount;
+ command << entry["mh_unc"].toString();
+ command << entry["mh_mountpoint"].toString();
+ command << entry["mh_options"].toStringList();
+ #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
+- command << entry["mh_command"].toString();
++ command << mount;
+ command << entry["mh_options"].toStringList();
+ command << entry["mh_unc"].toString();
+ command << entry["mh_mountpoint"].toString();
+@@ -208,6 +233,11 @@ ActionReply Smb4KMountHelper::unmountOneByOne(const QVariantMap& args)
+ ActionReply reply;
+
+ //
++ // Get the mount executable
++ //
++ const QString umount = findUmountExecutable();
++
++ //
+ // Iterate through the entries.
+ //
+ QMapIterator<QString, QVariant> it(args);
+@@ -217,6 +247,20 @@ ActionReply Smb4KMountHelper::unmountOneByOne(const QVariantMap& args)
+ it.next();
+ QString index = it.key();
+ QVariantMap entry = it.value().toMap();
++
++ //
++ // Check the executable
++ //
++ if (umount != entry["mh_command"].toString())
++ {
++ // Something weird is going on, bail out.
++ reply.setType(ActionReply::HelperErrorType);
++ return reply;
++ }
++ else
++ {
++ // Do nothing
++ }
+
+ //
+ // Check if the mountpoint is valid and the filesystem is correct.
+@@ -261,7 +305,7 @@ ActionReply Smb4KMountHelper::unmountOneByOne(const QVariantMap& args)
+ // The command
+ //
+ QStringList command;
+- command << entry["mh_command"].toString();
++ command << umount;
+ command << entry["mh_options"].toStringList();
+ command << entry["mh_mountpoint"].toString();
+
+@@ -342,6 +386,11 @@ ActionReply Smb4KMountHelper::unmountAtOnce(const QVariantMap& args)
+ ActionReply reply;
+
+ //
++ // Get the mount executable
++ //
++ const QString umount = findUmountExecutable();
++
++ //
+ // Check the mountpoints and put the valid ones into a string list
+ //
+ QStringList validMountPoints;
+@@ -351,7 +400,7 @@ ActionReply Smb4KMountHelper::unmountAtOnce(const QVariantMap& args)
+ {
+ it.next();
+ QVariantMap entry = it.value().toMap();
+-
++
+ bool mountPointOk = false;
+ KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::BasicInfoNeeded|KMountPoint::NeedMountOptions);
+
+@@ -399,9 +448,23 @@ ActionReply Smb4KMountHelper::unmountAtOnce(const QVariantMap& args)
+
+ if (!validMountPoints.isEmpty())
+ {
++ //
++ // Check the executable
++ //
++ if (umount != args.first().toMap().value("mh_command").toString())
++ {
++ // Something weird is going on, bail output
++ reply.setType(ActionReply::HelperErrorType);
++ return reply;
++ }
++ else
++ {
++ // Do nothing
++ }
++
+ // The command
+ QStringList command;
+- command << args.first().toMap().value("mh_command").toString();
++ command << umount;
+ command << args.first().toMap().value("mh_options").toStringList();
+ command << validMountPoints;
+
+diff --git a/helpers/smb4kmounthelper.h b/helpers/smb4kmounthelper.h
+index f3bc573..4b735af 100644
+--- a/helpers/smb4kmounthelper.h
++++ b/helpers/smb4kmounthelper.h
+@@ -2,7 +2,7 @@
+ The helper that mounts and unmounts shares.
+ -------------------
+ begin : Sa Okt 16 2010
+- copyright : (C) 2010-2016 by Alexander Reinholdt
++ copyright : (C) 2010-2017 by Alexander Reinholdt
+ email : alexander.reinholdt@kdemail.net
+ ***************************************************************************/
+
+--
+cgit v0.11.2
diff --git a/net-misc/smb4k/smb4k-1.2.3-r1.ebuild b/net-misc/smb4k/smb4k-1.2.3-r1.ebuild
new file mode 100644
index 000000000000..68e6be08235e
--- /dev/null
+++ b/net-misc/smb4k/smb4k-1.2.3-r1.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DECLARATIVE_REQUIRED="always"
+KDE_LINGUAS="bg bs ca ca@valencia cs da de en_GB eo es et fi fr ga gl hu is it
+ja ko lt mai mr nb nds nl nn pl pt pt_BR ro ru sk sv tr ug uk zh_CN zh_TW"
+KDE_HANDBOOK="optional"
+KDE_DOC_DIRS="doc doc-translations/%lingua_${PN}"
+inherit kde4-base
+
+DESCRIPTION="The advanced network neighborhood browser by KDE"
+HOMEPAGE="https://sourceforge.net/projects/smb4k/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="4"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug"
+
+RDEPEND="net-fs/samba[cups]"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+"
+
+DOCS=( AUTHORS BUGS ChangeLog README )
+
+PATCHES=( "${FILESDIR}/${P}-CVE-2017-8849.patch" )
diff --git a/net-misc/smb4k/smb4k-2.0.0-r1.ebuild b/net-misc/smb4k/smb4k-2.0.0-r1.ebuild
new file mode 100644
index 000000000000..421211547496
--- /dev/null
+++ b/net-misc/smb4k/smb4k-2.0.0-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_HANDBOOK="forceoptional"
+inherit kde5
+
+DESCRIPTION="Advanced network neighborhood browser"
+HOMEPAGE="https://sourceforge.net/p/smb4k/home/Home/"
+[[ ${PV} != 9999 ]] && SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
+
+[[ ${PV} != 9999 ]] && KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2"
+IUSE=""
+
+DEPEND="
+ $(add_frameworks_dep kauth)
+ $(add_frameworks_dep kcompletion)
+ $(add_frameworks_dep kconfig)
+ $(add_frameworks_dep kconfigwidgets)
+ $(add_frameworks_dep kcoreaddons)
+ $(add_frameworks_dep kdbusaddons)
+ $(add_frameworks_dep ki18n)
+ $(add_frameworks_dep kiconthemes)
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep kjobwidgets)
+ $(add_frameworks_dep knotifications)
+ $(add_frameworks_dep kparts)
+ $(add_frameworks_dep kwallet)
+ $(add_frameworks_dep kwidgetsaddons)
+ $(add_frameworks_dep kwindowsystem)
+ $(add_frameworks_dep kxmlgui)
+ $(add_frameworks_dep solid)
+ $(add_qt_dep qtdeclarative)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtnetwork)
+ $(add_qt_dep qtprintsupport)
+ $(add_qt_dep qttest)
+ $(add_qt_dep qtwidgets)
+"
+RDEPEND="${DEPEND}
+ !net-misc/smb4k:4
+ >=net-fs/samba-3.4.2[cups]
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.9.90-po2.patch
+ "${FILESDIR}"/${P}-CVE-2017-8849.patch
+)