]> granicus.if.org Git - mutt/commitdiff
browser.h: re-insert the "tagged" component.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 9 Feb 1999 23:04:28 +0000 (23:04 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 9 Feb 1999 23:04:28 +0000 (23:04 +0000)
pgp support: fix handling of PGP 5 subkeys, algorithm 20.

browser.h
gnupgparse.c
main.c
pgp.h
pgpkey.c
pgppubring.c

index b19fb5b4731ef8cc5592993668c6782d899d6119..3fd9e756a99689ff91b2eb4032972e66cb9c168f 100644 (file)
--- a/browser.h
+++ b/browser.h
@@ -30,6 +30,7 @@ struct folder_file
 #ifdef USE_IMAP
   short notfolder;
 #endif
+  unsigned tagged : 1;
 };
 
 struct browser_state
index 4b1923683e0b20ea80450a739fe7731f51497595..d4900a6ee8306fc28530c6273f4fed10c7a6bb40 100644 (file)
@@ -225,8 +225,7 @@ pgp_key_t *gpg_get_candidates (struct pgp_vinfo * pgp, pgp_ring_t keyring,
   k = NULL;
   while (fgets (buf, sizeof (buf) - 1, fp))
   {
-    kk = parse_pub_line (buf, &is_sub, k);
-    if (!kk)
+    if (!(kk = parse_pub_line (buf, &is_sub, k)))
       continue;
 
     /* Only append kk to the list if it's new. */
@@ -235,16 +234,22 @@ pgp_key_t *gpg_get_candidates (struct pgp_vinfo * pgp, pgp_ring_t keyring,
       if (k)
        kend = &k->next;
       *kend = k = kk;
-      
+
       if (is_sub)
       {
-       k->flags |= KEYFLAG_SUBKEY;
-       k->parent = mainkey;
+       pgp_uid_t **l;
+
+       k->flags  |= KEYFLAG_SUBKEY;
+       k->parent  = mainkey;
+       for (l = &k->address; *l; l = &(*l)->next)
+         ;
+       *l = pgp_copy_uids (mainkey->address, k);
       }
       else
        mainkey = k;
     }
   }
+
   if (ferror (fp))
     mutt_perror ("fgets");
 
diff --git a/main.c b/main.c
index 1c989536bba42f4622d2f722d36a8fa388db9ce8..de78b2c6f57b45e7dbea6306838880844ec7d22b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -48,6 +48,7 @@ under certain conditions; type `mutt -vv' for details.\n");
 
 const char Copyright[] = N_("\
 Copyright (C) 1996-9 Michael R. Elkins <me@cs.hmc.edu>\n\
+Copyright (C) 1996-9 Brandon Long <blong@fiction.net>\n\
 Copyright (C) 1997-9 Thomas Roessler <roessler@guug.de>\n\
 Copyright (C) 1998-9 Werner Koch <wk@isil.d.shuttle.de>\n\
 \n\
@@ -130,7 +131,7 @@ static void show_version (void)
   struct utsname uts;
 
   printf ("Mutt %s (%s)\n", MUTT_VERSION, ReleaseDate);
-  puts (_(Notice));
+  puts (Notice);
 
   uname (&uts);
 
diff --git a/pgp.h b/pgp.h
index e1040f8c6bfc989d67b15231821ace2624b15a22..ae135c1cde2b731ce0c34edf1fbfa24c836096bc 100644 (file)
--- a/pgp.h
+++ b/pgp.h
 #define PGPSIGN    2
 #define PGPKEY     4
 
-#define KEYFLAG_CANSIGN (1 << 0)
-#define KEYFLAG_CANENCRYPT (1 << 1)
-#define KEYFLAG_EXPIRED (1 << 8)
-#define KEYFLAG_REVOKED (1 << 9)
-#define KEYFLAG_DISABLED (1 << 10)
-#define KEYFLAG_SUBKEY (1 << 11)
-#define KEYFLAG_CRITICAL (1 << 12)
-#define KEYFLAG_PREFER_ENCRYPTION (1 << 13)
-#define KEYFLAG_PREFER_SIGNING (1 << 14)
+#define KEYFLAG_CANSIGN                (1 <<  0)
+#define KEYFLAG_CANENCRYPT             (1 <<  1)
+#define KEYFLAG_EXPIRED                (1 <<  8)
+#define KEYFLAG_REVOKED                (1 <<  9)
+#define KEYFLAG_DISABLED               (1 << 10)
+#define KEYFLAG_SUBKEY                         (1 << 11)
+#define KEYFLAG_CRITICAL               (1 << 12)
+#define KEYFLAG_PREFER_ENCRYPTION      (1 << 13)
+#define KEYFLAG_PREFER_SIGNING                 (1 << 14)
 
 #define KEYFLAG_CANTUSE (KEYFLAG_DISABLED|KEYFLAG_REVOKED|KEYFLAG_EXPIRED)
 #define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE|KEYFLAG_CRITICAL)
@@ -42,7 +42,7 @@ typedef struct pgp_keyinfo
 {
   char *keyid;
   struct pgp_uid *address;
-  short flags;
+  int flags;
   short keylen;
   unsigned long gen_time;
   const char *algorithm;
@@ -197,6 +197,8 @@ pgp_key_t *pgp_getkeybyaddr (struct pgp_vinfo *pgp, ADDRESS *, short, pgp_ring_t
 pgp_key_t *pgp_getkeybystr (struct pgp_vinfo *pgp, char *, short, pgp_ring_t);
 pgp_key_t *pgp_remove_key (pgp_key_t **, pgp_key_t *);
 
+pgp_uid_t *pgp_copy_uids (pgp_uid_t *, pgp_key_t *);
+
 short pgp_canencrypt (unsigned char);
 short pgp_cansign (unsigned char);
 short pgp_get_abilities (unsigned char);
index 07d583d84d1144af3ea1a5dcb3a77dce3cc8f2a7..5c184f879292b041f3df75aba67b8b0238cd780c 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -2,19 +2,22 @@
  * Copyright (C) 1996,1997 Michael R. Elkins <me@cs.hmc.edu>
  * Copyright (c) 1998,1999 Thomas Roessler <roessler@guug.de>
  * 
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
+ *     This program is free software; you can redistribute it
+ *     and/or modify it under the terms of the GNU General Public
+ *     License as published by the Free Software Foundation; either
+ *     version 2 of the License, or (at your option) any later
+ *     version.
  * 
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
+ *     This program is distributed in the hope that it will be
+ *     useful, but WITHOUT ANY WARRANTY; without even the implied
+ *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *     PURPOSE.  See the GNU General Public License for more
+ *     details.
  * 
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *     You should have received a copy of the GNU General Public
+ *     License along with this program; if not, write to the Free
+ *     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
+ *     02139, USA.
  */
 
 #include "mutt.h"
index ff878e1b681c767c0e6f5bd506d187d0eec6c1d5..39cd6358b1cfe242788fa7b4cd4e98674e6775fd 100644 (file)
@@ -183,7 +183,6 @@ short pgp_cansign (unsigned char type)
   {
   case 1:
   case 3:
-  case 16:
   case 17:
   case 20:
     return 1;
@@ -408,6 +407,23 @@ void pgp_free_uid (pgp_uid_t ** upp)
   *upp = NULL;
 }
 
+pgp_uid_t *pgp_copy_uids (pgp_uid_t *up, pgp_key_t *parent)
+{
+  pgp_uid_t *l = NULL;
+  pgp_uid_t **lp = &l;
+
+  for (; up; up = up->next)
+  {
+    *lp = safe_calloc (1, sizeof (pgp_uid_t));
+    (*lp)->trust  = up->trust;
+    (*lp)->addr   = safe_strdup (up->addr);
+    (*lp)->parent = parent;
+    lp = &(*lp)->next;
+  }
+
+  return l;
+}
+
 static void _pgp_free_key (pgp_key_t ** kpp)
 {
   pgp_key_t *kp;
@@ -895,7 +911,11 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp)
        {
          p->flags |= KEYFLAG_SUBKEY;
          if (p != root)
-           p->parent = root;
+         {
+           p->parent  = root;
+           p->address = pgp_copy_uids (root->address, p);
+           while (*addr) addr = &(*addr)->next;
+         }
        }
        break;
       }
@@ -906,7 +926,7 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp)
        pgp_parse_sig (buff, l, p);
        break;
       }
-      
+
       case PT_TRUST:
       {
        dprint (5, (debugfile, "PT_TRUST: "));
@@ -943,7 +963,7 @@ static pgp_key_t *pgp_parse_keyblock (FILE * fp)
        dprint (5, (debugfile, "\"%s\"\n", chr));
 
        mutt_decode_utf8_string (chr, chs);
-       *addr = uid = safe_calloc (sizeof (pgp_uid_t), 1); /* XXX */
+       *addr = uid = safe_calloc (1, sizeof (pgp_uid_t)); /* XXX */
        uid->addr = chr;
        uid->parent = p;
        uid->trust = 0;