From 46130378aea5fff80803409c2573e2ea31472cb9 Mon Sep 17 00:00:00 2001 From: Robert Xu Date: Sat, 13 Aug 2011 12:58:51 -0400 Subject: add dbus-1-tqt and libdbus-1-tqt-0; add unmodified tdelibs from kdelibs3 --- opensuse/tdelibs/kwalletd-try-open.diff | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 opensuse/tdelibs/kwalletd-try-open.diff (limited to 'opensuse/tdelibs/kwalletd-try-open.diff') diff --git a/opensuse/tdelibs/kwalletd-try-open.diff b/opensuse/tdelibs/kwalletd-try-open.diff new file mode 100644 index 000000000..547f8192d --- /dev/null +++ b/opensuse/tdelibs/kwalletd-try-open.diff @@ -0,0 +1,81 @@ +Index: kio/misc/kwalletd/kwalletd.cpp +=================================================================== +--- kio/misc/kwalletd/kwalletd.cpp.orig ++++ kio/misc/kwalletd/kwalletd.cpp +@@ -355,6 +355,44 @@ int KWalletD::doTransactionOpen(const QC + return rc; + } + ++int KWalletD::tryOpen(const QString& wallet, const QCString& password) ++{ ++ if (isOpen(wallet)) ++ return 0; ++ ++ if (_tryOpenBlocked.isActive()) { ++ kdDebug() << "tryOpen is active.." << endl; ++ return -1; ++ } ++ ++ if (!KWallet::Backend::exists(wallet)) ++ return -2; ++ ++ KWallet::Backend *b = new KWallet::Backend(wallet, false /*isPath*/); ++ int rc = b->open(QByteArray().duplicate(password, strlen(password))); ++ if (rc == 0) { ++ _wallets.insert(rc = generateHandle(), b); ++ _passwords[wallet] = password; ++ b->ref(); ++ _tryOpenBlocked.stop(); ++ QByteArray data; ++ QDataStream ds(data, IO_WriteOnly); ++ ds << wallet; ++ emitDCOPSignal("walletOpened(QString)", data); ++ } ++ else { ++ delete b; ++ // make sure that we're not bombed with a dictionary attack ++ _tryOpenBlocked.start (30 * 1000, true /*single shot*/); ++ if (++_failed > 5) { ++ _failed = 0; ++ QTimer::singleShot(0, this, SLOT(notifyFailures())); ++ } ++ ++ rc = -1; ++ } ++ return rc; ++} + + int KWalletD::internalOpen(const QCString& appid, const QString& wallet, bool isPath, WId w, bool modal) { + int rc = -1; +Index: kio/misc/kwalletd/kwalletd.h +=================================================================== +--- kio/misc/kwalletd/kwalletd.h.orig ++++ kio/misc/kwalletd/kwalletd.h +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include "kwalletbackend.h" + +@@ -51,8 +52,10 @@ class KWalletD : public KDEDModule { + + // Open and unlock the wallet + virtual int open(const QString& wallet, uint wId); +- ++ // Open and unlock the wallet ++ virtual int tryOpen(const QString& wallet, const QCString& passwd); + // Open and unlock the wallet with this path ++ + virtual int openPath(const QString& path, uint wId); + + // Asynchronous open - must give the object to return the handle +@@ -186,6 +189,7 @@ class KWalletD : public KDEDModule { + int _idleTime; + QMap _implicitAllowMap, _implicitDenyMap; + KTimeout *_timeouts; ++ QTimer _tryOpenBlocked; + + QPtrList _transactions; + QGuardedPtr< QWidget > activeDialog; -- cgit v1.2.1