[git] GnuPG - branch, master, updated. gnupg-2.1.3-36-g64e809b

by Werner Koch cvs at cvs.gnupg.org
Fri May 8 16:10:20 CEST 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  64e809b791645f343feb69112baba8e2700e454b (commit)
       via  3c439c0447f8a7468a61bbdc4c9a101ef2451dcb (commit)
       via  b772e459fa91cdc7facd95227ebc0faba20a7003 (commit)
       via  d95beb85dfa413a9f61c7026607574e9bf608ab0 (commit)
      from  436f2060721e997479a9dd5be8dfc73627dd49c9 (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 64e809b791645f343feb69112baba8e2700e454b
Author: Werner Koch <wk at gnupg.org>
Date:   Fri May 8 16:08:57 2015 +0200

    gpg: New command --quick-adduid.
    
    * g10/keygen.c (ask_user_id): Factor some code out to ...
    (uid_already_in_keyblock): new.
    (generate_user_id): Add arg UIDSTR.  Fix leaked P.
    * g10/keyedit.c (menu_adduid): Add new arg uidstring.  Adjust caller.
    (keyedit_quick_adduid): New.
    * g10/gpg.c (aQuickAddUid): New.
    (opts):  Add command --quick-adduid.
    (main): Implement that.
    --
    
    GnuPG-bug-id: 1956
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/doc/gpg.texi b/doc/gpg.texi
index 2e72309..887a624 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -568,7 +568,7 @@ This section explains the main commands for key management
 @ifset gpgtwoone
 @item --quick-gen-key @code{user-id}
 @opindex quick-gen-key
-This is simple command to generate a standard key with one user id.
+This is a simple command to generate a standard key with one user id.
 In contrast to @option{--gen-key} the key is generated directly
 without the need to answer a bunch of prompts.  Unless the option
 @option{--yes} is given, the key creation will be canceled if the
@@ -945,6 +945,16 @@ Its intended use is to help unattended key signing by utilizing a list
 of verified fingerprints.
 @end ifset
 
+ at ifset gpgtwoone
+ at item --quick-adduid  @var{user-id} @var{new-user-id}
+ at opindex quick-adduid
+This command adds a new user id to an existing key.  In contrast to
+the interactive sub-command @code{adduid} of @option{--edit-key} the
+ at var{new-user-id} is added verbatim with only leading and trailing
+white space removed, it is expected to be UTF-8 encoded, and no checks
+on its form are applied.
+ at end ifset
+
 @item --passwd @var{user_id}
 @opindex passwd
 Change the passphrase of the secret key belonging to the certificate
diff --git a/g10/gpg.c b/g10/gpg.c
index 13d6884..5a8a662 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -116,6 +116,7 @@ enum cmd_and_opt_values
     aLSignKey,
     aQuickSignKey,
     aQuickLSignKey,
+    aQuickAddUid,
     aListConfig,
     aListGcryptConfig,
     aGPGConfList,
@@ -414,6 +415,8 @@ static ARGPARSE_OPTS opts[] = {
               N_("generate a new key pair")),
   ARGPARSE_c (aQuickKeygen, "quick-gen-key" ,
               N_("quickly generate a new key pair")),
+  ARGPARSE_c (aQuickAddUid,  "quick-adduid",
+              N_("quickly add a new user-id")),
   ARGPARSE_c (aFullKeygen,  "full-gen-key" ,
               N_("full featured key pair generation")),
   ARGPARSE_c (aGenRevoke, "gen-revoke",N_("generate a revocation certificate")),
@@ -2327,6 +2330,7 @@ main (int argc, char **argv)
 	  case aLSignKey:
 	  case aStore:
 	  case aQuickKeygen:
+	  case aQuickAddUid:
 	  case aExportOwnerTrust:
 	  case aImportOwnerTrust:
           case aRebuildKeydbCaches:
@@ -3604,6 +3608,7 @@ main (int argc, char **argv)
       case aDeleteSecretKeys:
       case aDeleteSecretAndPublicKeys:
       case aQuickKeygen:
+      case aQuickAddUid:
       case aFullKeygen:
       case aKeygen:
       case aImport:
@@ -3924,6 +3929,18 @@ main (int argc, char **argv)
 	}
 	break;
 
+      case aQuickAddUid:
+        {
+          const char *uid, *newuid;
+
+          if (argc != 2)
+            wrong_args ("--quick-adduid USER-ID NEW-USER-ID");
+          uid = *argv++; argc--;
+          newuid = *argv++; argc--;
+          keyedit_quick_adduid (ctrl, uid, newuid);
+        }
+	break;
+
       case aFastImport:
         opt.import_options |= IMPORT_FAST;
       case aImport:
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 804eff1..be15b09 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1,7 +1,6 @@
-/* keyedit.c - keyedit stuff
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- *               2008, 2009, 2010 Free Software Foundation, Inc.
- * Copyright (C) 2013, 2014 Werner Koch
+/* keyedit.c - Edit properties of a key
+ * Copyright (C) 1998-2010 Free Software Foundation, Inc.
+ * Copyright (C) 1998-2015 Werner Koch
  *
  * This file is part of GnuPG.
  *
@@ -59,7 +58,8 @@ static void show_key_with_all_names (estream_t fp,
                                      int nowarn);
 static void show_key_and_fingerprint (KBNODE keyblock);
 static void subkey_expire_warning (kbnode_t keyblock);
-static int menu_adduid (KBNODE keyblock, int photo, const char *photo_name);
+static int menu_adduid (KBNODE keyblock, int photo, const char *photo_name,
+                        const char *uidstr);
 static void menu_deluid (KBNODE pub_keyblock);
 static int menu_delsig (KBNODE pub_keyblock);
 static int menu_clean (KBNODE keyblock, int self_only);
@@ -1757,7 +1757,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
 	  photo = 1;
 	  /* fall through */
 	case cmdADDUID:
-	  if (menu_adduid (keyblock, photo, arg_string))
+	  if (menu_adduid (keyblock, photo, arg_string, NULL))
 	    {
 	      update_trust = 1;
 	      redisplay = 1;
@@ -2288,6 +2288,93 @@ leave:
 }
 
 
+/* Unattended adding of a new keyid.  USERNAME specifies the
+   key. NEWUID is the new user id to add to the key.  */
+void
+keyedit_quick_adduid (ctrl_t ctrl, const char *username, const char *newuid)
+{
+  gpg_error_t err;
+  KEYDB_HANDLE kdbhd = NULL;
+  KEYDB_SEARCH_DESC desc;
+  kbnode_t keyblock = NULL;
+  kbnode_t node;
+  char *uidstring = NULL;
+
+  uidstring = xstrdup (newuid);
+  trim_spaces (uidstring);
+  if (!*uidstring)
+    {
+      log_error ("%s\n", gpg_strerror (GPG_ERR_INV_USER_ID));
+      goto leave;
+    }
+
+#ifdef HAVE_W32_SYSTEM
+  /* See keyedit_menu for why we need this.  */
+  check_trustdb_stale ();
+#endif
+
+  /* Search the key; we don't want the whole getkey stuff here.  */
+  kdbhd = keydb_new ();
+  err = classify_user_id (username, &desc, 1);
+  if (!err)
+    err = keydb_search (kdbhd, &desc, 1, NULL);
+  if (!err)
+    {
+      err = keydb_get_keyblock (kdbhd, &keyblock);
+      if (err)
+        {
+          log_error (_("error reading keyblock: %s\n"), gpg_strerror (err));
+          goto leave;
+        }
+      /* Now with the keyblock retrieved, search again to detect an
+         ambiguous specification.  We need to save the found state so
+         that we can do an update later.  */
+      keydb_push_found_state (kdbhd);
+      err = keydb_search (kdbhd, &desc, 1, NULL);
+      if (!err)
+        err = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
+      else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
+        err = 0;
+      keydb_pop_found_state (kdbhd);
+
+      if (!err)
+        {
+          /* We require the secret primary key to add a UID.  */
+          node = find_kbnode (keyblock, PKT_PUBLIC_KEY);
+          if (!node)
+            BUG ();
+          err = agent_probe_secret_key (ctrl, node->pkt->pkt.public_key);
+        }
+    }
+  if (err)
+    {
+      log_error (_("secret key \"%s\" not found: %s\n"),
+                 username, gpg_strerror (err));
+      goto leave;
+    }
+
+  fix_keyblock (&keyblock);
+
+  if (menu_adduid (keyblock, 0, NULL, uidstring))
+    {
+      err = keydb_update_keyblock (kdbhd, keyblock);
+      if (err)
+        {
+          log_error (_("update failed: %s\n"), gpg_strerror (err));
+          goto leave;
+        }
+
+      if (update_trust)
+        revalidation_mark ();
+    }
+
+ leave:
+  xfree (uidstring);
+  release_kbnode (keyblock);
+  keydb_release (kdbhd);
+}
+
+
 /* Unattended key signing function.  If the key specifified by FPR is
    availabale and FPR is the primary fingerprint all user ids of the
    user ids of the key are signed using the default signing key.  If
@@ -3225,11 +3312,15 @@ subkey_expire_warning (kbnode_t keyblock)
 
 
 /*
- * Ask for a new user id, add the self-signature and update the keyblock.
- * Return true if there is a new user id
+ * Ask for a new user id, add the self-signature, and update the
+ * keyblock.  If UIDSTRING is not NULL the user ID is generated
+ * unattended using that string.  UIDSTRING is expected to be utf-8
+ * encoded and white space trimmed.  Returns true if there is a new
+ * user id.
  */
 static int
-menu_adduid (KBNODE pub_keyblock, int photo, const char *photo_name)
+menu_adduid (kbnode_t pub_keyblock, int photo, const char *photo_name,
+             const char *uidstring)
 {
   PKT_user_id *uid;
   PKT_public_key *pk = NULL;
@@ -3239,6 +3330,9 @@ menu_adduid (KBNODE pub_keyblock, int photo, const char *photo_name)
   KBNODE pub_where = NULL;
   gpg_error_t err;
 
+  if (photo && uidstring)
+    return 0;  /* Not allowed.  */
+
   for (node = pub_keyblock; node; pub_where = node, node = node->next)
     {
       if (node->pkt->pkttype == PKT_PUBLIC_KEY)
@@ -3291,9 +3385,13 @@ menu_adduid (KBNODE pub_keyblock, int photo, const char *photo_name)
       uid = generate_photo_id (pk, photo_name);
     }
   else
-    uid = generate_user_id (pub_keyblock);
+    uid = generate_user_id (pub_keyblock, uidstring);
   if (!uid)
-    return 0;
+    {
+      if (uidstring)
+        log_error ("%s", _("Such a user ID already exists on this key!\n"));
+      return 0;
+    }
 
   err = make_keysig_packet (&sig, pk, uid, NULL, pk, 0x13, 0, 0, 0,
                             keygen_add_std_prefs, pk, NULL);
diff --git a/g10/keygen.c b/g10/keygen.c
index ccd01f9..fa5907d 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2446,6 +2446,24 @@ uid_from_string (const char *string)
 }
 
 
+/* Return true if the user id UID already exists in the keyblock.  */
+static int
+uid_already_in_keyblock (kbnode_t keyblock, const char *uid)
+{
+  PKT_user_id *uidpkt = uid_from_string (uid);
+  kbnode_t node;
+  int result = 0;
+
+  for (node=keyblock; node && !result; node=node->next)
+    if (!is_deleted_kbnode (node)
+        && node->pkt->pkttype == PKT_USER_ID
+        && !cmp_user_ids (uidpkt, node->pkt->pkt.user_id))
+      result = 1;
+  free_user_id (uidpkt);
+  return result;
+}
+
+
 /* Ask for a user ID.  With a MODE of 1 an extra help prompt is
    printed for use during a new key creation.  If KEYBLOCK is not NULL
    the function prevents the creation of an already existing user
@@ -2583,17 +2601,11 @@ ask_user_id (int mode, int full, KBNODE keyblock)
 
         if (!fail && keyblock)
           {
-            PKT_user_id *uidpkt = uid_from_string (uid);
-            KBNODE node;
-
-            for (node=keyblock; node && !fail; node=node->next)
-              if (!is_deleted_kbnode (node)
-                  && node->pkt->pkttype == PKT_USER_ID
-                  && !cmp_user_ids (uidpkt, node->pkt->pkt.user_id))
-		fail = 1;
-            if (fail)
-              tty_printf (_("Such a user ID already exists on this key!\n"));
-            free_user_id (uidpkt);
+            if (uid_already_in_keyblock (keyblock, uid))
+              {
+                tty_printf (_("Such a user ID already exists on this key!\n"));
+                fail = 1;
+              }
           }
 
 	for(;;) {
@@ -2767,16 +2779,32 @@ do_create (int algo, unsigned int nbits, const char *curve, KBNODE pub_root,
 
 /* Generate a new user id packet or return NULL if canceled.  If
    KEYBLOCK is not NULL the function prevents the creation of an
-   already existing user ID.  */
+   already existing user ID.  If UIDSTR is not NULL the user is not
+   asked but UIDSTR is used to create the user id packet; if the user
+   id already exists NULL is returned.  UIDSTR is expected to be utf-8
+   encoded and should have already been checked for a valid length
+   etc.  */
 PKT_user_id *
-generate_user_id (KBNODE keyblock)
+generate_user_id (KBNODE keyblock, const char *uidstr)
 {
+  PKT_user_id *uid;
   char *p;
 
-  p = ask_user_id (1, 1, keyblock);
-  if (!p)
-    return NULL;  /* Canceled. */
-  return uid_from_string (p);
+  if (uidstr)
+    {
+      if (uid_already_in_keyblock (keyblock, uidstr))
+        return NULL;  /* Already exists.  */
+      uid = uid_from_string (uidstr);
+    }
+  else
+    {
+      p = ask_user_id (1, 1, keyblock);
+      if (!p)
+        return NULL;  /* Canceled. */
+      uid = uid_from_string (p);
+      xfree (p);
+    }
+  return uid;
 }
 
 
diff --git a/g10/main.h b/g10/main.h
index 01eeb7f..a89f711 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -247,6 +247,8 @@ gpg_error_t delete_keys (strlist_t names, int secret, int allow_both);
 void keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
 		   strlist_t commands, int quiet, int seckey_check );
 void keyedit_passwd (ctrl_t ctrl, const char *username);
+void keyedit_quick_adduid (ctrl_t ctrl, const char *username,
+                           const char *newuid);
 void keyedit_quick_sign (ctrl_t ctrl, const char *fpr,
                          strlist_t uids, strlist_t locusr, int local);
 void show_basic_key_info (KBNODE keyblock);
diff --git a/g10/packet.h b/g10/packet.h
index ba43638..523178b 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -544,6 +544,6 @@ int update_keysig_packet( PKT_signature **ret_sig,
                       void *opaque   );
 
 /*-- keygen.c --*/
-PKT_user_id *generate_user_id (KBNODE keyblock);
+PKT_user_id *generate_user_id (kbnode_t keyblock, const char *uidstr);
 
 #endif /*G10_PACKET_H*/

commit 3c439c0447f8a7468a61bbdc4c9a101ef2451dcb
Author: Werner Koch <wk at gnupg.org>
Date:   Fri May 8 15:51:11 2015 +0200

    gpg: Add push/pop found state feature to keydb.
    
    * g10/keydb.c (keydb_handle): Add field saved_found.
    (keydb_new): Init new field.
    (keydb_push_found_state, keydb_pop_found_state): New.
    * g10/keyring.c (kyring_handle): Add field saved_found.
    (keyring_push_found_state, keyring_pop_found_state): New.
    --
    
    We have the same feature in gpgsm.  It is very useful to check for an
    unambiguous user id with a follow up update of the keyblock.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keydb.c b/g10/keydb.c
index 040ca65..2d1e07c 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1,7 +1,6 @@
 /* keydb.c - key database dispatcher
- * Copyright (C) 2001, 2002, 2003, 2004, 2005,
- *               2008, 2009, 2011, 2013 Free Software Foundation, Inc.
- * Coyrright (C) 2013 Werner Koch
+ * Copyright (C) 2001-2013 Free Software Foundation, Inc.
+ * Coyrright (C) 2001-2015 Werner Koch
  *
  * This file is part of GnuPG.
  *
@@ -67,6 +66,7 @@ struct keydb_handle
 {
   int locked;
   int found;
+  int saved_found;
   unsigned long skipped_long_blobs;
   int no_caching;
   int current;
@@ -542,6 +542,7 @@ keydb_new (void)
 
   hd = xmalloc_clear (sizeof *hd);
   hd->found = -1;
+  hd->saved_found = -1;
 
   assert (used_resources <= MAX_KEYDB_RESOURCES);
   for (i=j=0; i < used_resources; i++)
@@ -741,6 +742,64 @@ unlock_all (KEYDB_HANDLE hd)
 }
 
 
+

+/* Push the last found state if any.  */
+void
+keydb_push_found_state (KEYDB_HANDLE hd)
+{
+  if (!hd)
+    return;
+
+  if (hd->found < 0 || hd->found >= hd->used)
+    {
+      hd->saved_found = -1;
+      return;
+    }
+
+  switch (hd->active[hd->found].type)
+    {
+    case KEYDB_RESOURCE_TYPE_NONE:
+      break;
+    case KEYDB_RESOURCE_TYPE_KEYRING:
+      keyring_push_found_state (hd->active[hd->found].u.kr);
+      break;
+    case KEYDB_RESOURCE_TYPE_KEYBOX:
+      keybox_push_found_state (hd->active[hd->found].u.kb);
+      break;
+    }
+
+  hd->saved_found = hd->found;
+  hd->found = -1;
+}
+
+
+/* Pop the last found state.  */
+void
+keydb_pop_found_state (KEYDB_HANDLE hd)
+{
+  if (!hd)
+    return;
+
+  hd->found = hd->saved_found;
+  hd->saved_found = -1;
+  if (hd->found < 0 || hd->found >= hd->used)
+    return;
+
+  switch (hd->active[hd->found].type)
+    {
+    case KEYDB_RESOURCE_TYPE_NONE:
+      break;
+    case KEYDB_RESOURCE_TYPE_KEYRING:
+      keyring_pop_found_state (hd->active[hd->found].u.kr);
+      break;
+    case KEYDB_RESOURCE_TYPE_KEYBOX:
+      keybox_pop_found_state (hd->active[hd->found].u.kb);
+      break;
+    }
+}
+
+
+

 static gpg_error_t
 parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no,
                       const u32 *sigstatus, kbnode_t *r_keyblock)
diff --git a/g10/keydb.h b/g10/keydb.h
index 11a10e9..0e3816f 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -136,6 +136,8 @@ gpg_error_t keydb_add_resource (const char *url, unsigned int flags);
 KEYDB_HANDLE keydb_new (void);
 void keydb_release (KEYDB_HANDLE hd);
 void keydb_disable_caching (KEYDB_HANDLE hd);
+void keydb_push_found_state (KEYDB_HANDLE hd);
+void keydb_pop_found_state (KEYDB_HANDLE hd);
 const char *keydb_get_resource_name (KEYDB_HANDLE hd);
 gpg_error_t keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb);
 gpg_error_t keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb);
diff --git a/g10/keyring.c b/g10/keyring.c
index ee76e8a..a5178ac 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -1,5 +1,6 @@
 /* keyring.c - keyring file handling
- * Copyright (C) 2001, 2004, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 1998-2010 Free Software Foundation, Inc.
+ * Copyright (C) 1997-2015 Werner Koch
  *
  * This file is part of GnuPG.
  *
@@ -83,7 +84,7 @@ struct keyring_handle
     size_t pk_no;
     size_t uid_no;
     unsigned int n_packets; /*used for delete and update*/
-  } found;
+  } found, saved_found;
   struct {
     char *name;
     char *pattern;
@@ -279,6 +280,25 @@ keyring_release (KEYRING_HANDLE hd)
 }
 
 
+/* Save the current found state in HD for later retrieval by
+   keybox_pop_found_state.  Only one state may be saved.  */
+void
+keyring_push_found_state (KEYRING_HANDLE hd)
+{
+  hd->saved_found = hd->found;
+  hd->found.kr = NULL;
+}
+
+
+/* Restore the saved found state in HD.  */
+void
+keyring_pop_found_state (KEYRING_HANDLE hd)
+{
+  hd->found = hd->saved_found;
+  hd->saved_found.kr = NULL;
+}
+
+
 const char *
 keyring_get_resource_name (KEYRING_HANDLE hd)
 {
diff --git a/g10/keyring.h b/g10/keyring.h
index f83c2cb..1469b70 100644
--- a/g10/keyring.h
+++ b/g10/keyring.h
@@ -29,6 +29,8 @@ int keyring_is_writable (void *token);
 
 KEYRING_HANDLE keyring_new (void *token);
 void keyring_release (KEYRING_HANDLE hd);
+void keyring_push_found_state (KEYRING_HANDLE hd);
+void keyring_pop_found_state (KEYRING_HANDLE hd);
 const char *keyring_get_resource_name (KEYRING_HANDLE hd);
 int keyring_lock (KEYRING_HANDLE hd, int yes);
 int keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb);

commit b772e459fa91cdc7facd95227ebc0faba20a7003
Author: Werner Koch <wk at gnupg.org>
Date:   Fri May 8 12:05:52 2015 +0200

    gpg: Minor code merging in keyedit.
    
    * g10/keyedit.c (fix_keyblock): Rename to fix_key_signature_order.
    (fix_keyblock): New.  Call fix_key_signature_order and other fix
    functions.
    (keyedit_menu): Factor code out to new fix_keyblock.
    (keyedit_quick_sign): Ditto.  Check for primary fpr before calling
    fix_keyblock.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keyedit.c b/g10/keyedit.c
index 3577bd3..804eff1 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1181,7 +1181,7 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
  * Note:  This function does not work if there is more than one user ID.
  */
 static int
-fix_keyblock (KBNODE keyblock)
+fix_key_signature_order (KBNODE keyblock)
 {
   KBNODE node, last, subkey;
   int fixed = 0;
@@ -1221,6 +1221,27 @@ fix_keyblock (KBNODE keyblock)
 }
 
 
+/* Fix various problems in the keyblock.  Returns true if the keyblock
+   was changed.  Note that a pointer to the keyblock must be given and
+   the function may change it (i.e. replacing the first node).  */
+static int
+fix_keyblock (kbnode_t *keyblockp)
+{
+  int changed = 0;
+
+  if (fix_key_signature_order (*keyblockp))
+    changed++;
+  if (collapse_uids (keyblockp))
+    changed++;
+  reorder_keyblock (*keyblockp);
+  /* If we modified the keyblock, make sure the flags are right. */
+  if (changed)
+    merge_keys_and_selfsig (*keyblockp);
+
+  return changed;
+}
+
+
 static int
 parse_sign_type (const char *str, int *localsig, int *nonrevokesig,
 		 int *trustsig)
@@ -1482,15 +1503,9 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
       log_error (_("key \"%s\" not found: %s\n"), username, gpg_strerror (err));
       goto leave;
     }
-  if (fix_keyblock (keyblock))
-    modified++;
-  if (collapse_uids (&keyblock))
+
+  if (fix_keyblock (&keyblock))
     modified++;
-  reorder_keyblock (keyblock);
-  /* We modified the keyblock, so let's make sure the flags are
-     right. */
-  if (modified)
-    merge_keys_and_selfsig (keyblock);
 
   /* See whether we have a matching secret key.  */
   if (seckey_check)
@@ -2316,11 +2331,6 @@ keyedit_quick_sign (ctrl_t ctrl, const char *fpr, strlist_t uids,
       log_error (_("key \"%s\" not found: %s\n"), fpr, gpg_strerror (err));
       goto leave;
     }
-  if (fix_keyblock (keyblock))
-    modified++;
-  if (collapse_uids (&keyblock))
-    modified++;
-  reorder_keyblock (keyblock);
 
   /* Check that the primary fingerprint has been given. */
   {
@@ -2349,9 +2359,8 @@ keyedit_quick_sign (ctrl_t ctrl, const char *fpr, strlist_t uids,
       }
   }
 
-  /* If we modified the keyblock, make sure the flags are right. */
-  if (modified)
-    merge_keys_and_selfsig (keyblock);
+  if (fix_keyblock (&keyblock))
+    modified++;
 
   /* Give some info in verbose.  */
   if (opt.verbose)

commit d95beb85dfa413a9f61c7026607574e9bf608ab0
Author: Werner Koch <wk at gnupg.org>
Date:   Fri May 8 08:55:57 2015 +0200

    Typo fixes
    
    --

diff --git a/agent/findkey.c b/agent/findkey.c
index 80771c5..699291d 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -47,7 +47,7 @@ struct try_unprotect_arg_s
   const unsigned char *protected_key;
   unsigned char *unprotected_key;
   int change_required; /* Set by the callback to indicate that the
-                          user should chnage the passphrase.  */
+                          user should change the passphrase.  */
 };
 
 
@@ -469,6 +469,8 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
       assert (arg.unprotected_key);
       if (arg.change_required)
         {
+          /* The callback told as that the user should change their
+             passphrase.  Present the dialog to do.  */
           size_t canlen, erroff;
           gcry_sexp_t s_skey;
 
@@ -499,6 +501,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
         }
       else
         {
+          /* Passphrase is fine.  */
           agent_put_cache (hexgrip, cache_mode, pi->pin,
                            lookup_ttl? lookup_ttl (hexgrip) : 0);
           agent_store_cache_hit (hexgrip);

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

Summary of changes:
 agent/findkey.c |   5 +-
 doc/gpg.texi    |  12 ++++-
 g10/gpg.c       |  17 ++++++
 g10/keydb.c     |  65 ++++++++++++++++++++--
 g10/keydb.h     |   2 +
 g10/keyedit.c   | 163 ++++++++++++++++++++++++++++++++++++++++++++++----------
 g10/keygen.c    |  62 +++++++++++++++------
 g10/keyring.c   |  24 ++++++++-
 g10/keyring.h   |   2 +
 g10/main.h      |   2 +
 g10/packet.h    |   2 +-
 11 files changed, 303 insertions(+), 53 deletions(-)


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




More information about the Gnupg-commits mailing list