[Pkg-owncloud-commits] [owncloud-client] 102/219: Account: Fix cert save/restore from settings. #2160

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:15 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 f348eabf19b27f22475220734211bb2fd53dac8f
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Thu Sep 4 14:38:35 2014 +0200

    Account: Fix cert save/restore from settings. #2160
    
    (cherry picked from commit cc1121ef008d85f2142c6a2887e3ee196061e97f)
---
 src/mirall/account.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mirall/account.cpp b/src/mirall/account.cpp
index fc154b9..af31331 100644
--- a/src/mirall/account.cpp
+++ b/src/mirall/account.cpp
@@ -39,6 +39,7 @@ static const char urlC[] = "url";
 static const char authTypeC[] = "authType";
 static const char userC[] = "user";
 static const char httpUserC[] = "http_user";
+static const char caCertsKeyC[] = "CaCertificates";
 
 AccountManager *AccountManager::_instance = 0;
 
@@ -102,15 +103,15 @@ void Account::save()
     }
     settings->sync();
 
-    // ### TODO port away from MirallConfigFile
-    MirallConfigFile cfg;
+    // Save accepted certificates.
+    settings->beginGroup(QLatin1String("General"));
     qDebug() << "Saving " << approvedCerts().count() << " unknown certs.";
     QByteArray certs;
     Q_FOREACH( const QSslCertificate& cert, approvedCerts() ) {
         certs += cert.toPem() + '\n';
     }
     if (!certs.isEmpty()) {
-        cfg.setCaCerts( certs );
+        settings->setValue( QLatin1String(caCertsKeyC), certs );
     }
 }
 
@@ -176,7 +177,7 @@ Account* Account::restore()
 
         // now the cert, it is in the general group
         settings->beginGroup(QLatin1String("General"));
-        acc->setApprovedCerts(QSslCertificate::fromData(settings->value(QLatin1String("CaCertificates")).toByteArray()));
+        acc->setApprovedCerts(QSslCertificate::fromData(settings->value(caCertsKeyC).toByteArray()));
         acc->setMigrated(migratedCreds);
         return acc;
     }

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