Commit ef27d6dd authored by Thomas Roessler's avatar Thomas Roessler

browser.h: re-insert the "tagged" component.

pgp support: fix handling of PGP 5 subkeys, algorithm 20.
parent cb5d7ef4
......@@ -30,6 +30,7 @@ struct folder_file
#ifdef USE_IMAP
short notfolder;
#endif
unsigned tagged : 1;
};
struct browser_state
......
......@@ -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");
......
......@@ -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);
......
......@@ -23,15 +23,15 @@
#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);
......
......@@ -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"
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment