diff options
author | Werner Koch <wk@gnupg.org> | 2008-03-13 09:46:08 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-03-13 09:46:08 +0100 |
commit | 6a78bca874eefb859caf10410e8a0d3e11a49e06 (patch) | |
tree | 2ce6a8f26cc4dc62ee8787d554a386f43942177e /kbx | |
parent | Comment fixes. (diff) | |
download | gnupg2-6a78bca874eefb859caf10410e8a0d3e11a49e06.tar.xz gnupg2-6a78bca874eefb859caf10410e8a0d3e11a49e06.zip |
Fixed an email/DN bug.
Changed pinentry prompts.
Diffstat (limited to 'kbx')
-rw-r--r-- | kbx/ChangeLog | 6 | ||||
-rw-r--r-- | kbx/keybox-blob.c | 34 |
2 files changed, 29 insertions, 11 deletions
diff --git a/kbx/ChangeLog b/kbx/ChangeLog index f7c79ee1a..11dab22c4 100644 --- a/kbx/ChangeLog +++ b/kbx/ChangeLog @@ -1,3 +1,9 @@ +2008-03-13 Werner Koch <wk@g10code.com> + + * keybox-blob.c (x509_email_kludge): Use the same code as in + ..sm/keylist.c so that email parts are not only detected at the + start of the DN. Reported by Yoshiaki Kasahara. + 2007-08-24 Werner Koch <wk@g10code.com> * keybox-init.c (keybox_register_file): Use same_file_p. diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c index b0f227c48..a45c42167 100644 --- a/kbx/keybox-blob.c +++ b/kbx/keybox-blob.c @@ -1,5 +1,5 @@ /* keybox-blob.c - KBX Blob handling - * Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + * Copyright (C) 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -778,34 +778,46 @@ _keybox_create_pgp_blob (KEYBOXBLOB *r_blob, KBNODE keyblock, int as_ephemeral) #ifdef KEYBOX_WITH_X509 -/* return an allocated string with the email address extracted from a - DN */ +/* Return an allocated string with the email address extracted from a + DN. Note hat we use this code also in ../sm/keylist.c. */ static char * x509_email_kludge (const char *name) { - const char *p; + const char *p, *string; unsigned char *buf; int n; - if (strncmp (name, "1.2.840.113549.1.9.1=#", 22)) - return NULL; + string = name; + for (;;) + { + p = strstr (string, "1.2.840.113549.1.9.1=#"); + if (!p) + return NULL; + if (p == name || (p > string+1 && p[-1] == ',' && p[-2] != '\\')) + { + name = p + 22; + break; + } + string = p + 22; + } + + /* This looks pretty much like an email address in the subject's DN we use this to add an additional user ID entry. This way, - openSSL generated keys get a nicer and usable listing */ - name += 22; + OpenSSL generated keys get a nicer and usable listing. */ for (n=0, p=name; hexdigitp (p) && hexdigitp (p+1); p +=2, n++) ; - if (*p != '#' || !n) + if (!n) return NULL; buf = xtrymalloc (n+3); if (!buf) return NULL; /* oops, out of core */ *buf = '<'; - for (n=1, p=name; *p != '#'; p +=2, n++) + for (n=1, p=name; hexdigitp (p); p +=2, n++) buf[n] = xtoi_2 (p); buf[n++] = '>'; buf[n] = 0; - return (char *)buf; + return (char*)buf; } |