[Pkg-owncloud-commits] [qtkeychain] 80/115: KWallet: Return error for non-existant entries
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Mar 15 19:25:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository qtkeychain.
commit b66a182a85b0fee9b4acc746c90eb128c4033012
Author: Frank Osterfeld <osterfeld at kde.org>
Date: Sat Oct 12 19:57:48 2013 +0200
KWallet: Return error for non-existant entries
Before, an empty password was returned, so one couldn't tell
if the entry wasn't available, or the entry contained an empty
password.
Fixes #5
---
keychain_dbus.cpp | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/keychain_dbus.cpp b/keychain_dbus.cpp
index 15e0ee1..da523d4 100644
--- a/keychain_dbus.cpp
+++ b/keychain_dbus.cpp
@@ -319,6 +319,14 @@ void ReadPasswordJobPrivate::kwalletOpenFinished( QDBusPendingCallWatcher* watch
connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletEntryTypeFinished(QDBusPendingCallWatcher*)) );
}
+//Must be in sync with KWallet::EntryType (kwallet.h)
+enum KWalletEntryType {
+ Unknown=0,
+ Password,
+ Stream,
+ Map
+};
+
void ReadPasswordJobPrivate::kwalletEntryTypeFinished( QDBusPendingCallWatcher* watcher ) {
watcher->deleteLater();
if ( watcher->isError() ) {
@@ -328,8 +336,25 @@ void ReadPasswordJobPrivate::kwalletEntryTypeFinished( QDBusPendingCallWatcher*
}
const QDBusPendingReply<int> reply = *watcher;
+ const int value = reply.value();
- dataType = reply.value() == 1/*Password*/ ? Text : Binary;
+ switch ( value ) {
+ case Unknown:
+ q->emitFinishedWithError( EntryNotFound, tr("Entry not found") );
+ return;
+ case Password:
+ dataType = Text;
+ break;
+ case Stream:
+ dataType = Binary;
+ break;
+ case Map:
+ q->emitFinishedWithError( EntryNotFound, tr("Unsupported entry type 'Map'") );
+ return;
+ default:
+ q->emitFinishedWithError( OtherError, tr("Unknown kwallet entry type '%1'").arg( value ) );
+ return;
+ }
const QDBusPendingCall nextReply = dataType == Text
? QDBusPendingCall( iface->readPassword( walletHandle, q->service(), key, q->service() ) )
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git
More information about the Pkg-owncloud-commits
mailing list