[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kio
From: Michael Leupold <lemma () confuego ! org>
Date: 2009-04-17 16:28:44
Message-ID: 1239985724.124142.3680.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 955432 by mleupold:
Generate a new (private) KPasswdServer interface class for talking to kpasswdserver.
M +7 -1 CMakeLists.txt
A kio/kpasswdserver.cpp [License: LGPL (v2)]
A kio/kpasswdserver_p.h [License: LGPL (v2)]
A kio/kpasswdserverloop.cpp kio/passwdserverloop.cpp#955431 [License: \
LGPL (v2)] A kio/kpasswdserverloop_p.h kio/passwdserverloop_p.h#955431 \
[License: LGPL (v2)] A kio/org.kde.KPasswdServer.xml
D kio/passwdserverloop.cpp
D kio/passwdserverloop_p.h
M +19 -154 kio/slavebase.cpp
--- trunk/KDE/kdelibs/kio/CMakeLists.txt #955431:955432
@@ -125,11 +125,17 @@
kio/thumbsequencecreator.cpp
kio/udsentry.cpp
kio/hostinfo.cpp
- kio/passwdserverloop.cpp
+ kio/kpasswdserver.cpp
+ kio/kpasswdserverloop.cpp
)
qt4_add_dbus_adaptor(kiocore_STAT_SRCS kio/org.kde.kio.FileUndoManager.xml \
fileundomanager_p.h KIO::FileUndoManagerPrivate fileundomanager_adaptor \
KIOFileUndoManagerAdaptor)
+set_source_files_properties(kio/org.kde.KPasswdServer.xml
+ PROPERTIES INCLUDE kio/authinfo.h
+)
+qt4_add_dbus_interface(kiocore_STAT_SRCS kio/org.kde.KPasswdServer.xml \
kpasswdserver_interface) +
if(UNIX)
set(kiocore_STAT_SRCS ${kiocore_STAT_SRCS}
kio/kautomount.cpp
--- trunk/KDE/kdelibs/kio/kio/slavebase.cpp #955431:955432
@@ -37,7 +37,6 @@
#include <QtCore/QFile>
#include <QtCore/QList>
#include <QtCore/QDateTime>
-#include <QtDBus/QtDBus>
#include <kapplication.h>
#include <kcrash.h>
@@ -52,7 +51,7 @@
#include "connection.h"
#include "ioslave_defaults.h"
#include "slaveinterface.h"
-#include "passwdserverloop_p.h"
+#include "kpasswdserver_p.h"
#ifndef NDEBUG
#ifdef HAVE_BACKTRACE
@@ -72,10 +71,6 @@
#define KIO_DATA QByteArray data; QDataStream stream( &data, QIODevice::WriteOnly ); \
stream #define KIO_FILESIZE_T(x) quint64(x)
-#define KPASSWDSERVER_SERVICE "org.kde.kded"
-#define KPASSWDSERVER_PATH "/modules/kpasswdserver"
-#define KPASSWDSERVER_INTERFACE "org.kde.KPasswdServer"
-
namespace KIO {
class SlaveBasePrivate {
@@ -827,88 +822,24 @@
{
const long windowId = metaData("window-id").toLong();
const unsigned long userTimestamp = metaData("user-timestamp").toULong();
-
- kDebug(7019) << "window-id=" << windowId;
-
- QDBusConnection conn(QDBusConnection::sessionBus());
- QDBusMessage pscall(QDBusMessage::createMethodCall(KPASSWDSERVER_SERVICE,
- KPASSWDSERVER_PATH,
- KPASSWDSERVER_INTERFACE,
- "queryAuthInfoAsync"));
- QDBusArgument arg;
- arg << info;
- pscall << QVariant::fromValue(arg);
+ QString errorMessage;
if (metaData("no-auth-prompt").toLower() == "true") {
- pscall << QString(QLatin1String("<NoAuthPrompt>"));
+ errorMessage = QLatin1String("<NoAuthPrompt>");
} else {
- pscall << errorMsg;
+ errorMessage = errorMsg;
}
- pscall << qlonglong(windowId) << SlaveBasePrivate::s_seqNr
- << qlonglong(userTimestamp);
- // create the loop to wait for a result before sending the request
- // because the result signal has to be connected before. Else we might
- // actually miss a result signal.
- PasswdServerLoop loop;
- conn.connect(KPASSWDSERVER_SERVICE, KPASSWDSERVER_PATH, KPASSWDSERVER_INTERFACE,
- "queryAuthInfoAsyncResult", &loop,
- SLOT(slotQueryResult(qlonglong, qlonglong, const KIO::AuthInfo&)));
-
- QDBusReply<qlonglong> reply = conn.call(pscall, QDBus::Block);
- if (!reply.isValid())
- {
-
- // backward compatibility for old kpasswdserver
- // TODO: this should be removed when it's no longer needed (probably 4.5)
- if (reply.error().type() == QDBusError::UnknownMethod) {
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
- stream << info;
- QDBusMessage pscall2(QDBusMessage::createMethodCall(KPASSWDSERVER_SERVICE,
- KPASSWDSERVER_PATH,
- \
KPASSWDSERVER_INTERFACE,
- "queryAuthInfo"));
- pscall2 << data;
- if (metaData("no-auth-prompt").toLower() == "true") {
- pscall2 << QString(QLatin1String("<NoAuthPrompt>"));
- } else {
- pscall2 << errorMsg;
- }
- pscall2 << qlonglong(windowId) << SlaveBasePrivate::s_seqNr << \
qlonglong(userTimestamp);
- QDBusMessage reply2 = conn.call(pscall2, QDBus::Block, INT_MAX);
-
- if (reply2.type() == QDBusMessage::ReplyMessage) {
- AuthInfo authResult;
- QDataStream stream2(reply2.arguments().at(0).toByteArray());
- stream2 >> authResult;
- SlaveBasePrivate::s_seqNr = reply2.arguments().at(1).toLongLong();
- if (!authResult.isModified()) {
- return false;
- }
-
- info = authResult;
- return true;
- }
- }
-
- kWarning(7019) << "Can't communicate with kded_kpasswdserver (for \
queryAuthInfo)!";
- kDebug(7019) << reply.error().name() << reply.error().message();
- return false;
+ KPasswdServer srv;
+ qlonglong seqNr = srv.queryAuthInfo(info, errorMessage, windowId,
+ SlaveBasePrivate::s_seqNr, userTimestamp);
+ if (seqNr > 0) {
+ SlaveBasePrivate::s_seqNr = seqNr;
+ if (info.isModified()) {
+ return true;
+ }
}
- if (!loop.waitForResult(reply.value())) {
- kWarning(7019) << "kded_kpasswdserver died while waiting for reply!";
- return false;
- }
- SlaveBasePrivate::s_seqNr = loop.seqNr();
- if (!loop.authInfo().isModified())
- return false;
-
- info = loop.authInfo();
-
- kDebug(7019) << "username=" << info.username << "password=[hidden]";
-
- return true;
+ return false;
}
int SlaveBase::messageBox( MessageBoxType type, const QString &text, const QString \
&caption, @@ -1240,71 +1171,13 @@
long windowId = metaData("window-id").toLong();
unsigned long userTimestamp = metaData("user-timestamp").toULong();
- kDebug(7019) << "window =" << windowId << "url =" << info.url;
-
- QDBusConnection conn(QDBusConnection::sessionBus());
- QDBusMessage pscall(QDBusMessage::createMethodCall(KPASSWDSERVER_SERVICE,
- KPASSWDSERVER_PATH,
- KPASSWDSERVER_INTERFACE,
- "checkAuthInfoAsync"));
- QDBusArgument arg;
- arg << info;
- pscall << QVariant::fromValue(arg) << qlonglong(windowId)
- << qlonglong(userTimestamp);
-
- // create the loop to wait for a result before sending the request
- // because the result signal has to be connected before. Else we might
- // actually miss a result signal.
- PasswdServerLoop loop;
- conn.connect(KPASSWDSERVER_SERVICE, KPASSWDSERVER_PATH, KPASSWDSERVER_INTERFACE,
- "checkAuthInfoAsyncResult", &loop,
- SLOT(slotQueryResult(qlonglong, qlonglong, const KIO::AuthInfo&)));
-
- QDBusReply<qlonglong> reply = conn.call(pscall, QDBus::Block);
- if (!reply.isValid()) {
-
- // backwards compatibility for old kpasswdserver
- // TODO: this should be removed when it's no longer needed (probably 4.5)
- if (reply.error().type() == QDBusError::UnknownMethod) {
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
- stream << info;
- QDBusMessage pscall2(QDBusMessage::createMethodCall(KPASSWDSERVER_SERVICE,
- KPASSWDSERVER_PATH,
- \
KPASSWDSERVER_INTERFACE,
- "checkAuthInfo"));
- pscall2 << data << qlonglong(windowId) << qlonglong(userTimestamp);
- QDBusReply<QByteArray> reply2 = conn.call(pscall2, QDBus::Block, INT_MAX);
-
- if (reply2.isValid()) {
- AuthInfo authResult;
- QDataStream stream2(reply2.value());
- stream2 >> authResult;
- if (!authResult.isModified()) {
- return false;
- }
-
- info = authResult;
- return true;
- }
- }
-
- kWarning(7019) << "Can't communicate with kded_kpasswdserver (for \
checkAuthInfo)!";
- kDebug(7019) << reply.error().name() << reply.error().message();
- return false;
+ KPasswdServer srv;
+ qlonglong seqNr = srv.checkAuthInfo(info, windowId, userTimestamp);
+ if (seqNr > 0 && info.isModified()) {
+ return true;
}
- if (!loop.waitForResult(reply.value())) {
- kWarning(7019) << "kded_kpasswdserver died while waiting for reply!";
- return false;
- }
-
- if (!loop.authInfo().isModified())
- {
- return false;
- }
- info = loop.authInfo();
- return true;
+ return false;
}
void SlaveBase::dispatchOpenCommand( int command, const QByteArray &data )
@@ -1341,15 +1214,7 @@
bool SlaveBase::cacheAuthentication( const AuthInfo& info )
{
- QByteArray params;
- qlonglong windowId = metaData("window-id").toLongLong();
-
- QDataStream stream(¶ms, QIODevice::WriteOnly);
- stream << info;
-
- QDBusInterface(KPASSWDSERVER_SERVICE, KPASSWDSERVER_PATH, \
KPASSWDSERVER_INTERFACE).
- call(QDBus::Block, "addAuthInfo", params, windowId);
-
+ KPasswdServer().addAuthInfo(info, metaData("window-id").toLongLong());
return true;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic