[Pkg-owncloud-commits] [qtkeychain] 11/115: always overwrite entries, remove flag to control that

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Mar 15 19:25:42 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 653bf190f070988c2a8830252822b1846cbc6c90
Author: Frank Osterfeld <frank.osterfeld at kdab.com>
Date:   Fri Oct 28 09:32:08 2011 +0200

    always overwrite entries, remove flag to control that
---
 keychain.cpp     |  8 ++++----
 keychain.h       | 14 ++------------
 keychain_mac.cpp |  7 +------
 keychain_p.h     |  1 -
 testclient.cpp   |  2 +-
 5 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/keychain.cpp b/keychain.cpp
index ded13da..caf3e37 100644
--- a/keychain.cpp
+++ b/keychain.cpp
@@ -32,13 +32,13 @@ QString Keychain::errorString() const {
     return d->errorString;
 }
 
-void Keychain::writePassword( const QString &key, const QString &password, OverwriteMode om ) {
-    writeEntry( key, password.toUtf8(), om );
+void Keychain::writePassword( const QString &key, const QString &password ) {
+    writeEntry( key, password.toUtf8() );
 }
 
-void Keychain::writeEntry( const QString& key, const QByteArray& ba, OverwriteMode om ) {
+void Keychain::writeEntry( const QString& key, const QByteArray& ba ) {
     QString err;
-    const Error ret = d->writeEntryImpl( key, ba, om, &err );
+    const Error ret = d->writeEntryImpl( key, ba, &err );
     d->error = ret;
     d->errorString = err;
 }
diff --git a/keychain.h b/keychain.h
index 3e6abf0..70d071c 100644
--- a/keychain.h
+++ b/keychain.h
@@ -51,14 +51,6 @@ public:
     };
 
     /**
-     * Overwrite mode when writing passwords to the keychain
-     */
-    enum OverwriteMode {
-        DoNotOverwrite, /**< Do not overwrite existing entries */
-        ForceOverwrite  /**< Replace old data by new one */
-    };
-
-    /**
      * The service name used as identifier.
      */
     QString service() const;
@@ -82,8 +74,7 @@ public:
      * @param om Whether to overwrite existing passwords
      */
     void writePassword( const QString& key,
-                        const QString& password,
-                        OverwriteMode om=DoNotOverwrite );
+                        const QString& password );
 
     /**
      * Stores @p data in the keychain, for a given @p key.
@@ -94,8 +85,7 @@ public:
      * @param om Whether to overwrite existing passwords
      */
     void writeEntry( const QString& key,
-                     const QByteArray& data,
-                     OverwriteMode om=DoNotOverwrite );
+                     const QByteArray& data );
 
     /**
      * Reads the password for a given @p key from the keychain.
diff --git a/keychain_mac.cpp b/keychain_mac.cpp
index f81e066..e1c1fc5 100644
--- a/keychain_mac.cpp
+++ b/keychain_mac.cpp
@@ -82,7 +82,6 @@ Keychain::Error Keychain::Private::readEntryImpl( QByteArray* pw,
 
 Keychain::Error Keychain::Private::writeEntryImpl( const QString& account,
                                                    const QByteArray& data,
-                                                   Keychain::OverwriteMode ov,
                                                    QString* err ) {
     Q_ASSERT( err );
     err->clear();
@@ -101,15 +100,11 @@ Keychain::Error Keychain::Private::writeEntryImpl( const QString& account,
         switch ( ret ) {
         case errSecDuplicateItem:
         {
-            if ( ov == Keychain::DoNotOverwrite ) {
-                *err = tr("Entry already exists");
-                return EntryAlreadyExists;
-            }
             Error derr = deleteEntryImpl( account, err );
             if ( derr != NoError )
                 return CouldNotDeleteEntry;
             else
-                return writeEntryImpl( account, data, ov, err );
+                return writeEntryImpl( account, data, err );
         }
         default:
             *err = strForStatus( ret );
diff --git a/keychain_p.h b/keychain_p.h
index 2e84931..4abb0a1 100644
--- a/keychain_p.h
+++ b/keychain_p.h
@@ -21,7 +21,6 @@ public:
 
     Keychain::Error writeEntryImpl( const QString& account,
                                     const QByteArray& data,
-                                    Keychain::OverwriteMode,
                                     QString* errorString );
     Keychain::Error deleteEntryImpl( const QString& account,
                                      QString* errorString );
diff --git a/testclient.cpp b/testclient.cpp
index 15d310f..0507a2d 100644
--- a/testclient.cpp
+++ b/testclient.cpp
@@ -40,7 +40,7 @@ int main( int argc, char** argv ) {
         if ( ++it != args.constEnd() )
             return printUsage();
         Keychain k( QLatin1String("qtkeychain-testclient") );
-        k.writePassword( acc, pass, Keychain::ForceOverwrite );
+        k.writePassword( acc, pass );
         if ( k.error() ) {
             std::cerr << "Storing password failed: " << qPrintable(k.errorString()) << std::endl;
             return 1;

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