[git] GnuPG - branch, master, updated. gnupg-2.1.9-155-g178af9c

by Neal H. Walfield cvs at cvs.gnupg.org
Fri Nov 20 13:01:14 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  178af9c3f56d385fe28a9e5e8bde0ab34c0b260e (commit)
       via  f8a65ac96b27a0963892892ce6e93b37b8df1ad7 (commit)
      from  46e128d44a0456dc603bc9e25a4c5d8da903b078 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 178af9c3f56d385fe28a9e5e8bde0ab34c0b260e
Author: Neal H. Walfield <neal at g10code.com>
Date:   Fri Nov 20 13:00:19 2015 +0100

    gpg: Fail if the search description passed to --gen-revoke is ambiguous.
    
    * g10/revoke.c (gen_revoke): Error out if the search description is
    ambiguous.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/g10/revoke.c b/g10/revoke.c
index 0ed2604..8599d17 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -630,6 +630,47 @@ gen_revoke (const char *uname)
       goto leave;
     }
 
+  rc = keydb_search (kdbhd, &desc, 1, NULL);
+  if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
+    /* Not ambiguous.  */
+    {
+    }
+  else if (rc == 0)
+    /* Ambiguous.  */
+    {
+      char *info;
+
+      log_error (_("'%s' matches multiple secret keys:\n"), uname);
+
+      info = format_seckey_info (keyblock->pkt->pkt.public_key);
+      log_error ("  %s\n", info);
+      xfree (info);
+      release_kbnode (keyblock);
+
+      rc = keydb_get_keyblock (kdbhd, &keyblock);
+      while (! rc)
+        {
+          info = format_seckey_info (keyblock->pkt->pkt.public_key);
+          log_error ("  %s\n", info);
+          xfree (info);
+          release_kbnode (keyblock);
+          keyblock = NULL;
+
+          rc = keydb_search (kdbhd, &desc, 1, NULL);
+          if (! rc)
+            rc = keydb_get_keyblock (kdbhd, &keyblock);
+        }
+
+      rc = GPG_ERR_AMBIGUOUS_NAME;
+
+      goto leave;
+    }
+  else
+    {
+      log_error (_("error searching the keyring: %s\n"), gpg_strerror (rc));
+      goto leave;
+    }
+
   /* Get the keyid from the keyblock.  */
   node = find_kbnode (keyblock, PKT_PUBLIC_KEY);
   if (!node)

commit f8a65ac96b27a0963892892ce6e93b37b8df1ad7
Author: Neal H. Walfield <neal at g10code.com>
Date:   Fri Nov 20 12:52:04 2015 +0100

    gpg: Refactor print_seckey_info.
    
    * g10/keylist.c (print_seckey_info): Break formatting functionality
    into...
    (format_seckey_info): ... this new function.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/g10/keylist.c b/g10/keylist.c
index 9b2d83f..031612c 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -163,20 +163,31 @@ secret_key_list (ctrl_t ctrl, strlist_t list)
     list_one (ctrl, list, 1, 0);
 }
 
-void
-print_seckey_info (PKT_public_key *pk)
+char *
+format_seckey_info (PKT_public_key *pk)
 {
   u32 keyid[2];
   char *p;
   char pkstrbuf[PUBKEY_STRING_SIZE];
+  char *info;
 
   keyid_from_pk (pk, keyid);
   p = get_user_id_native (keyid);
 
-  tty_printf ("\nsec  %s/%s %s %s\n",
-              pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
-	      keystr (keyid), datestr_from_pk (pk), p);
+  info = xtryasprintf ("sec  %s/%s %s %s",
+                       pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
+                       keystr (keyid), datestr_from_pk (pk), p);
+
+  xfree (p);
 
+  return info;
+}
+
+void
+print_seckey_info (PKT_public_key *pk)
+{
+  char *p = format_seckey_info (pk);
+  tty_printf ("\n%s\n", p);
   xfree (p);
 }
 
diff --git a/g10/main.h b/g10/main.h
index be4be29..0c2d1a9 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -387,6 +387,7 @@ void show_keyserver_url(PKT_signature *sig,int indent,int mode);
 void show_notation(PKT_signature *sig,int indent,int mode,int which);
 void dump_attribs (const PKT_user_id *uid, PKT_public_key *pk);
 void set_attrib_fd(int fd);
+char *format_seckey_info (PKT_public_key *pk);
 void print_seckey_info (PKT_public_key *pk);
 void print_pubkey_info (estream_t fp, PKT_public_key *pk);
 void print_card_key_info (estream_t fp, KBNODE keyblock);

-----------------------------------------------------------------------

Summary of changes:
 g10/keylist.c | 21 ++++++++++++++++-----
 g10/main.h    |  1 +
 g10/revoke.c  | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list