/*
* Copyright (C) 1996,1997 Michael R. Elkins <me@cs.hmc.edu>
- * Copyright (c) 1998 Thomas Roessler <roessler@guug.de>
+ * 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
int did_main_key;
PGPUID *u;
+ dprint (5, (debugfile, "ki_getkeybyaddr: looking for %s <%s>.",
+ a->personal, a->mailbox));
+
+
for ( ; k ; k = k->next)
{
- if(k->flags & (KEYFLAG_REVOKED | KEYFLAG_EXPIRED | KEYFLAG_DISABLED))
+ dprint (5, (debugfile, " looking at key: %s\n",
+ pgp_keyid (k)));
+
+ if(k->flags & (KEYFLAG_REVOKED | KEYFLAG_EXPIRED | KEYFLAG_DISABLED))
+ {
+ dprint (5, (debugfile, " key disabled/revoked/expired\n"));
continue;
+ }
if(abilities && !(k->flags & abilities))
+ {
+ dprint (5, (debugfile, " insufficient abilities: Has %x, want %x\n",
+ k->flags, abilities));
continue;
+ }
q = k->address;
did_main_key = 0;
{
u = (PGPUID *) q->data;
r = rfc822_parse_adrlist(NULL, u->addr);
+
for(p = r; p && weak_association; p = p->next)
{
for(; a ; a = a->next)
{
-
+ dprint (5, (debugfile, "ki_getkeybystr: matching \"%s\" against key %s, \"%s\": ",
+ p, pgp_keyid (k), ((PGPUID *)a->data)->addr));
if (!*p || mutt_strcasecmp (p, pgp_keyid(k)) == 0 ||
(!mutt_strncasecmp(p, "0x", 2) && !mutt_strcasecmp(p+2, pgp_keyid(k))) ||
(option(OPTPGPLONGIDS) && !mutt_strncasecmp(p, "0x", 2) &&
!mutt_strcasecmp(p+2, k->keyid+8)) ||
mutt_stristr(((PGPUID *)a->data)->addr,p))
{
+ dprint (5, (debugfile, "match.\n"));
t = mutt_new_list ();
t->data = (void *)k;
t->next = l;
l = t;
break;
}
+ else
+ dprint (5, (debugfile, "no match.\n"));
}
if(!did_main_key && k->flags & KEYFLAG_SUBKEY && k->mainkey)
/*
- * Copyright (C) 1997 Thomas Roessler <roessler@guug.de>
+ * Copyright (C) 1997-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.
*/
}
p->keyid = safe_strdup((char *)scratch);
-
return p;
}
{
if(!buff || l < 2)
return NULL;
+
+ dprint (5, (debugfile, " version: %d ", buff[1]));
switch(buff[1])
{
case PT_SUBKEY:
case PT_SUBSECKEY:
{
+ switch (pt)
+ {
+ case PT_SECKEY: dprint (5, (debugfile, "PT_SECKEY: ")); break;
+ case PT_PUBKEY: dprint (5, (debugfile, "PT_PUBKEY: ")); break;
+ case PT_SUBKEY: dprint (5, (debugfile, "PT_SUBKEY: ")); break;
+ case PT_SUBSECKEY: dprint (5, (debugfile, "PT_SUBSECKEY: ")); break;
+ }
+
if(p)
end = &(p->next);
if(!(*end = p = pgp_parse_keyinfo(buff, l)))
break;
+
+ dprint (5, (debugfile, " key-id: %s ", p->keyid));
addr = &p->address;
case PT_SIG:
{
+ dprint (5, (debugfile, "PT_SIG\n"));
pgp_parse_sig(buff, l, p);
break;
}
case PT_TRUST:
{
+ dprint (5, (debugfile, "PT_TRUST: "));
if(last_pt == PT_SECKEY || last_pt == PT_PUBKEY ||
last_pt == PT_SUBKEY || last_pt == PT_SUBSECKEY)
{
if(buff[1] & 0x20)
+ {
+ dprint (5, (debugfile, " disabling %s\n", p->keyid));
p->flags |= KEYFLAG_DISABLED;
+ }
}
else if(last_pt == PT_NAME)
+ {
uid->trust = buff[1];
+ dprint (5, (debugfile, " setting trust for \"%s\" to %d.\n",
+ uid->addr, uid->trust));
+ }
break;
}
case PT_NAME:
{
char *chr;
+
+ dprint (5, (debugfile, "PT_NAME: "));
if(!addr) break;
chr = safe_malloc(l);
memcpy(chr, buff + 1, l - 1);
chr[l-1] = '\0';
+
+ dprint (5, (debugfile, "\"%s\"\n", chr));
+
mutt_decode_utf8_string(chr, chs);
*addr = mutt_new_list();
(*addr)->data = safe_malloc(sizeof(PGPUID));
}
}
fclose(fp);
+
+#ifdef DEBUG
+ if (debuglevel >= 4)
+ {
+ KEYINFO *dbp;
+ LIST *lp;
+
+ fprintf (debugfile, "\n\npgp_read_keyring: START KEYRING DUMP.\n");
+
+ for (dbp = db; dbp; dbp = dbp->next)
+ {
+ fprintf (debugfile, "%s [len=%d, flags=%d]\n", dbp->keyid, dbp->keylen, dbp->flags);
+ for (lp = dbp->address; lp; lp=lp->next)
+ {
+ fprintf (debugfile, " %s [%d]\n", ((PGPUID *)lp->data)->addr,
+ ((PGPUID *)lp->data)->trust);
+ }
+ }
+
+ fprintf (debugfile, "\nEND KEYRING DUMP.\n\n");
+ }
+#endif
+
return db;
}