Paste P441

KIO-SMB
ActivePublic

Authored by chinmoyr on Jul 24 2019, 12:50 PM.
diff --git a/smb/CMakeLists.txt b/smb/CMakeLists.txt
index 54cfa6f5..097274cf 100644
--- a/smb/CMakeLists.txt
+++ b/smb/CMakeLists.txt
@@ -23,6 +23,8 @@ set(kio_smb_PART_SRCS
include_directories(${SAMBA_INCLUDE_DIR})
+qt5_add_dbus_interface(kio_smb_PART_SRCS org.kde.kio.MountServiceManager.xml mountserviced_interface)
+
add_library(kio_smb MODULE ${kio_smb_PART_SRCS})
target_link_libraries(kio_smb
diff --git a/smb/kio_smb_auth.cpp b/smb/kio_smb_auth.cpp
index 17fbbf81..ee3ae1f7 100644
--- a/smb/kio_smb_auth.cpp
+++ b/smb/kio_smb_auth.cpp
@@ -37,6 +37,9 @@
#include <klocalizedstring.h>
#include <stdlib.h>
+#include "mountserviced_interface.h"
+#include <QDBusConnection>
+
// call for libsmbclient
//==========================================================================
void auth_smbc_get_data(SMBCCTX * context,
@@ -67,6 +70,7 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
char *password, int pwmaxlen)
//--------------------------------------------------------------------------
{
+
//check this to see if we "really" need to authenticate...
SMBUrlType t = m_current_url.getType();
if( t == SMBURLTYPE_ENTIRE_NETWORK )
@@ -95,6 +99,9 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
info.password = s_password;
info.verifyPath = true;
+ org::kde::kio::MountServiceManager kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/mountservicemanager"), QDBusConnection::sessionBus());
+ auto reply = kded.mountURL(info.url.toString());
+ qCDebug(KIO_SMB) << "kded reply:" << reply.error();
qCDebug(KIO_SMB) << "libsmb-auth-callback URL:" << info.url;
if ( !checkCachedAuthentication( info ) )
chinmoyr created this paste.Jul 24 2019, 12:50 PM
chinmoyr created this object in space S1 KDE Community.