]> granicus.if.org Git - mutt/commitdiff
Add the pgp_ignore_subkeys option. Unset it to get the traditional
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 13 Nov 2000 22:19:57 +0000 (22:19 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 13 Nov 2000 22:19:57 +0000 (22:19 +0000)
listing with all the subkeys.  (Experimental, may introduce new bugs.)

gnupgparse.c
init.h
mutt.h

index 0800add8d379aa7df1e24ce48cad8efb2ed8b563..20f8834ae80e98b9ce50772e23a739df6b30a4de 100644 (file)
@@ -153,7 +153,7 @@ static pgp_key_t *parse_pub_line (char *buf, int *is_subkey, pgp_key_t *k)
        else
          return NULL;
        
-       if (!is_uid)
+       if (!(is_uid || (*is_subkey && option (OPTPGPIGNORESUB))))
          k = safe_calloc (sizeof (pgp_key_t), 1);
 
        break;
@@ -194,7 +194,8 @@ static pgp_key_t *parse_pub_line (char *buf, int *is_subkey, pgp_key_t *k)
        
        dprint (2, (debugfile, "key len: %s\n", p));
        
-       k->keylen = atoi (p);   /* fixme: add validation checks */
+       if (!(*is_subkey && option (OPTPGPIGNORESUB)))
+         k->keylen = atoi (p); /* fixme: add validation checks */
        break;
       }
       case 4:                  /* pubkey algo */
@@ -202,8 +203,12 @@ static pgp_key_t *parse_pub_line (char *buf, int *is_subkey, pgp_key_t *k)
        
        dprint (2, (debugfile, "pubkey algorithm: %s\n", p));
        
-       k->numalg = atoi (p);
-       k->algorithm = pgp_pkalgbytype (atoi (p));
+       if (!(*is_subkey && option (OPTPGPIGNORESUB)))
+       {
+         k->numalg = atoi (p);
+         k->algorithm = pgp_pkalgbytype (atoi (p));
+       }
+
        k->flags |= pgp_get_abilities (atoi (p));
        break;
       }
@@ -212,7 +217,7 @@ static pgp_key_t *parse_pub_line (char *buf, int *is_subkey, pgp_key_t *k)
        dprint (2, (debugfile, "key id: %s\n", p));
        
        /* We really should do a check here */
-       k->keyid = safe_strdup (p);
+       mutt_str_replace (&k->keyid, p);
        break;
 
       }
@@ -333,7 +338,6 @@ pgp_key_t *pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
   mutt_wait_filter (thepid);
 
   close (devnull);
-
   return db;
 }
 
diff --git a/init.h b/init.h
index c2b9d78fd93f7d02a9ea58bd1178ce6917ca17d7..3a06d89fa50757d8bed919bd5ea755b548dd362f 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1067,6 +1067,13 @@ struct option_t MuttVars[] = {
   ** \fIpgp-menu\fP, when encryption is not required or signing is
   ** requested as well.
   */
+  { "pgp_ignore_subkeys", DT_BOOL, R_NONE, OPTPGPIGNORESUB, 1},
+  /*
+  ** .pp
+  ** Setting this variable will cause Mutt to ignore OpenPGP subkeys. Instead,
+  ** the principal key will inherit the subkeys' capabilities.  Unset this
+  ** if you want to play interesting key selection games.
+  */
   { "pgp_entry_format", DT_STR,  R_NONE, UL &PgpEntryFormat, UL "%4n %t%f %4l/0x%k %-4a %2c %u" },
   /*
   ** .pp
diff --git a/mutt.h b/mutt.h
index 6327c290a0d81c030bccdd4266b56835a366b8da..e34963945e23378d674b6d8175805ee218262cc9 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -375,6 +375,7 @@ enum
 #ifdef HAVE_PGP
   OPTPGPAUTOSIGN,
   OPTPGPAUTOENCRYPT,
+  OPTPGPIGNORESUB,
   OPTPGPLONGIDS,
   OPTPGPREPLYENCRYPT,
   OPTPGPREPLYSIGN,