[Pkg-owncloud-commits] [owncloud-client] 29/33: Avoid re-entrency in HTTPCredidential::fetch
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Feb 27 19:44:25 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 e468ea2d6891cc95da2a1e4fefb76a8651da4ef2
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Wed Feb 26 13:07:42 2014 +0100
Avoid re-entrency in HTTPCredidential::fetch
It is likely to re-enter if there is two jobs that asks for a password.
Example:
1. log out
2. restart the application
3. enter a wrong password
4. enter a wrong password again a few times
5. enter the correct password
6. it should must not prompt for the password again.
Because of the re-entrency, it was still prompting for the password several
times after the right password had been entered
---
src/creds/httpcredentials.cpp | 10 +++++++++-
src/creds/httpcredentials.h | 1 +
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp
index 48b2aff..22db507 100644
--- a/src/creds/httpcredentials.cpp
+++ b/src/creds/httpcredentials.cpp
@@ -100,7 +100,8 @@ HttpCredentials::HttpCredentials()
HttpCredentials::HttpCredentials(const QString& user, const QString& password)
: _user(user),
_password(password),
- _ready(true)
+ _ready(true),
+ _fetchJobInProgress(false)
{
}
@@ -183,6 +184,10 @@ void HttpCredentials::fetch(Account *account)
return;
}
+ if (_fetchJobInProgress) {
+ return;
+ }
+
fetchUser(account);
QSettings *settings = account->settingsWithGroup(Theme::instance()->appName());
@@ -207,6 +212,7 @@ void HttpCredentials::fetch(Account *account)
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
job->setProperty("account", QVariant::fromValue(account));
job->start();
+ _fetchJobInProgress = true;
}
}
bool HttpCredentials::stillValid(QNetworkReply *reply)
@@ -234,6 +240,7 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
// Still, the password can be empty which indicates a problem and
// the password dialog has to be opened.
_ready = true;
+ _fetchJobInProgress = false;
emit fetched();
} else {
if( error != NoError ) {
@@ -241,6 +248,7 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
}
bool ok;
QString pwd = queryPassword(&ok);
+ _fetchJobInProgress = false;
if (ok) {
_password = pwd;
_ready = true;
diff --git a/src/creds/httpcredentials.h b/src/creds/httpcredentials.h
index 1de04d0..5231283 100644
--- a/src/creds/httpcredentials.h
+++ b/src/creds/httpcredentials.h
@@ -62,6 +62,7 @@ private:
QString _user;
QString _password;
bool _ready;
+ bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible
};
} // ns Mirall
--
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