[Pkg-gnupg-commit] [gpgme] 300/412: Cpp: Use fpr field for primaryFingerprint

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:27:07 UTC 2016


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

dkg pushed a commit to branch master
in repository gpgme.

commit 40ea1c85773cbe324557c34b3a4282f609fcdaf6
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 24 13:57:49 2016 +0200

    Cpp: Use fpr field for primaryFingerprint
    
    * lang/cpp/src/key.cpp (Key::primaryFingerprint): Return
    fpr value if available.
    
    --
    Should not be necessary but we might have an incomplete
    key without subkeys but the fingerprint already set in
    gpgme's data type.
---
 lang/cpp/src/key.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 68d7685..6f40f66 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -259,11 +259,16 @@ const char *Key::shortKeyID() const
 
 const char *Key::primaryFingerprint() const
 {
-    const char *fpr = key && key->subkeys ? key->subkeys->fpr : 0 ;
-    if (fpr) {
-        return fpr;
-    } else {
-        return keyID();
+    if (!key) {
+        return nullptr;
+    }
+    if (key->fpr) {
+        /* Return what gpgme thinks is the primary fingerprint */
+        return key->fpr;
+    }
+    if (key->subkeys) {
+        /* Return the first subkeys fingerprint */
+        return key->subkeys->fpr;
     }
 }
 

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