[Pkg-owncloud-commits] [owncloud-client] 08/33: Handle empty passwords returning from the keychain read procedure.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Feb 27 19:44:24 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch upstream
in repository owncloud-client.

commit 04647b0d6148e5a4dba180ed36447645fd4d5b28
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Feb 20 16:53:38 2014 +0100

    Handle empty passwords returning from the keychain read procedure.
    
    This is needed if the keychain does not have the an QSettings based
    fallback any more.
---
 src/creds/httpcredentials.cpp | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp
index c2f5eeb..48b2aff 100644
--- a/src/creds/httpcredentials.cpp
+++ b/src/creds/httpcredentials.cpp
@@ -223,24 +223,30 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
     _password = readJob->textData();
     Account *account = qvariant_cast<Account*>(readJob->property("account"));
 
+    if( _user.isEmpty()) {
+        qDebug() << "Strange: User is empty!";
+    }
+
     QKeychain::Error error = job->error();
-    switch (error) {
-    case NoError:
+
+    if( !_password.isEmpty() && error == NoError ) {
+        // All cool, the keychain did not come back with error.
+        // Still, the password can be empty which indicates a problem and
+        // the password dialog has to be opened.
         _ready = true;
-        Q_EMIT fetched();
-        break;
-    default:
-        if (!_user.isEmpty()) {
-            bool ok;
-            QString pwd = queryPassword(&ok);
-            if (ok) {
-                _password = pwd;
-                _ready = true;
-                persist(account);
-            }
-            emit fetched();
+        emit fetched();
+    } else {
+        if( error != NoError ) {
+            qDebug() << "Error while reading password" << job->errorString();
+        }
+        bool ok;
+        QString pwd = queryPassword(&ok);
+        if (ok) {
+            _password = pwd;
+            _ready = true;
+            persist(account);
         }
-        qDebug() << "Error while reading password" << job->errorString();
+        emit fetched();
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list