[Pkg-owncloud-commits] [owncloud-client] 05/08: [Shib] Ensure only one fetch job can open the browser

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Jun 2 21:55:39 UTC 2014


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

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

commit 7e65c9741e1906a42b4f3c5b7af74e3d65426593
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Mon Jun 2 17:41:32 2014 +0200

    [Shib] Ensure only one fetch job can open the browser
---
 src/creds/shibbolethcredentials.cpp | 13 +++++++++++++
 src/creds/shibbolethcredentials.h   |  1 +
 2 files changed, 14 insertions(+)

diff --git a/src/creds/shibbolethcredentials.cpp b/src/creds/shibbolethcredentials.cpp
index 8d6fa17..55aabc0 100644
--- a/src/creds/shibbolethcredentials.cpp
+++ b/src/creds/shibbolethcredentials.cpp
@@ -88,6 +88,7 @@ ShibbolethCredentials::ShibbolethCredentials()
       _url(),
       _ready(false),
       _stillValid(false),
+      _fetchJobInProgress(false),
       _browser(0)
 {}
 
@@ -178,10 +179,16 @@ bool ShibbolethCredentials::ready() const
 
 void ShibbolethCredentials::fetch(Account *account)
 {
+
+    if(_fetchJobInProgress) {
+        return;
+    }
+
     if (_user.isEmpty()) {
         _user = account->credentialSetting(QLatin1String(userC)).toString();
     }
     if (_ready) {
+        _fetchJobInProgress = false;
         Q_EMIT fetched();
     } else {
         if (account) {
@@ -194,6 +201,7 @@ void ShibbolethCredentials::fetch(Account *account)
         job->setProperty("account", QVariant::fromValue(account));
         connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
         job->start();
+        _fetchJobInProgress = true;
     }
 }
 
@@ -264,6 +272,7 @@ void ShibbolethCredentials::slotUserFetched(const QString &user)
 
     _stillValid = true;
     _ready = true;
+    _fetchJobInProgress = false;
     Q_EMIT fetched();
 }
 
@@ -271,12 +280,14 @@ void ShibbolethCredentials::slotUserFetched(const QString &user)
 void ShibbolethCredentials::slotBrowserRejected()
 {
     _ready = false;
+    _fetchJobInProgress = false;
     Q_EMIT fetched();
 }
 
 void ShibbolethCredentials::invalidateAndFetch(Account* account)
 {
     _ready = false;
+    _fetchJobInProgress = true;
 
     // delete the credentials, then in the slot fetch them again (which will trigger browser)
     DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
@@ -293,6 +304,7 @@ void ShibbolethCredentials::slotInvalidateAndFetchInvalidateDone(QKeychain::Job*
 
     connect (this, SIGNAL(fetched()),
              this, SLOT(onFetched()));
+    _fetchJobInProgress = false;
     // small hack to support the ShibbolethRefresher hack
     // we already rand fetch() with a valid account object,
     // and hence know the url on refresh
@@ -323,6 +335,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
 
         _ready = true;
         _stillValid = true;
+        _fetchJobInProgress = false;
         Q_EMIT fetched();
     } else {
         showLoginWindow(account);
diff --git a/src/creds/shibbolethcredentials.h b/src/creds/shibbolethcredentials.h
index 19a435c..fe23ab2 100644
--- a/src/creds/shibbolethcredentials.h
+++ b/src/creds/shibbolethcredentials.h
@@ -82,6 +82,7 @@ private:
 
     bool _ready;
     bool _stillValid;
+    bool _fetchJobInProgress;
     QPointer<ShibbolethWebView> _browser;
     QNetworkCookie _shibCookie;
     QString _user;

-- 
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