[Pkg-gnupg-commit] [gpgme] 14/132: cpp: Ensure that hasSecret is correct after update

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 26 01:00:47 UTC 2017


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

dkg pushed a commit to branch experimental
in repository gpgme.

commit da5343a9d2c8c0ca6431162aac4bd5c73b4ae6dd
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Dec 16 19:09:13 2016 +0100

    cpp: Ensure that hasSecret is correct after update
    
    * lang/cpp/src/key.cpp (Key::update): Check for
    a secret key first before listing public keys.
    
    --
    This is a performance delay but the update should
    only be called in a non gui thread anyway. The information
    if we have the secret key for this key is important to provide
    after update.
---
 lang/cpp/src/key.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index d621a81..4f7ec54 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -341,7 +341,12 @@ void Key::update()
                         KeyListMode::Validate |
                         KeyListMode::WithTofu);
     Error err;
-    auto newKey = ctx->key(primaryFingerprint(), err, hasSecret());
+    auto newKey = ctx->key(primaryFingerprint(), err, true);
+    // Not secret so we get the information from the pubring.
+    if (newKey.isNull())
+      {
+        newKey = ctx->key(primaryFingerprint(), err, false);
+      }
     delete ctx;
     if (err) {
         return;

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



More information about the Pkg-gnupg-commit mailing list