1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Fix regression in gpg's mail address parsing.

Since 2009-12-08 gpg was not able to find email addresses indicated
by a leading '<'.  This happened when I merged the user id
classification code of gpgsm and gpg.
This commit is contained in:
Werner Koch 2011-04-25 23:56:47 +02:00
parent 4caa768f1d
commit 5da12674ea
20 changed files with 62 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2011-04-25 Werner Koch <wk@g10code.com>
* userids.c (classify_user_id): Add arg OPENPGP_HACK to fix
regression from 2009-12-08.
2011-04-01 Werner Koch <wk@g10code.com>
* sysutils.c (get_uint_nonce): New.

View File

@ -61,7 +61,7 @@
*/
gpg_error_t
classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc)
classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
{
const char *s;
int hexprefix = 0;
@ -95,6 +95,11 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc)
case '<': /* An email address. */
mode = KEYDB_SEARCH_MODE_MAIL;
/* FIXME: The keyring code in g10 assumes that the mail name is
prefixed with an '<'. However the keybox code used for sm/
assumes it has been removed. For now we use this simple hack
to overcome the problem. */
if (!openpgp_hack)
s++;
desc->u.name = s;
break;

View File

@ -22,7 +22,8 @@
#include "../kbx/keybox-search-desc.h"
gpg_error_t classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc);
gpg_error_t classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc,
int openpgp_hack);
#endif /*GNUPG_COMMON_USERIDS_H*/

View File

@ -1,3 +1,9 @@
2011-04-25 Werner Koch <wk@g10code.com>
* ks-engine-hkp.c (ks_hkp_search): Mark classify_user_id for use
with OpenPGP.
(ks_hkp_get): Ditto.
2011-04-12 Werner Koch <wk@g10code.com>
* ks-engine-hkp.c (ks_hkp_search, ks_hkp_get, ks_hkp_put): Factor

View File

@ -654,7 +654,7 @@ ks_hkp_search (ctrl_t ctrl, parsed_uri_t uri, const char *pattern,
Note that HKP keyservers like the 0x to be present when searching
by keyid. We need to re-format the fingerprint and keyids so to
remove the gpg specific force-use-of-this-key flag ("!"). */
err = classify_user_id (pattern, &desc);
err = classify_user_id (pattern, &desc, 1);
if (err)
return err;
switch (desc.mode)
@ -772,7 +772,7 @@ ks_hkp_get (ctrl_t ctrl, parsed_uri_t uri, const char *keyspec, estream_t *r_fp)
Note that HKP keyservers like the 0x to be present when searching
by keyid. We need to re-format the fingerprint and keyids so to
remove the gpg specific force-use-of-this-key flag ("!"). */
err = classify_user_id (keyspec, &desc);
err = classify_user_id (keyspec, &desc, 1);
if (err)
return err;
switch (desc.mode)

View File

@ -1,3 +1,13 @@
2011-04-25 Werner Koch <wk@g10code.com>
* delkey.c (do_delete_key): Mark classify_user_id for use with
OpenPGP.
* trustdb.c (register_trusted_key): Ditto.
* revoke.c (gen_revoke): Ditto.
* keyserver.c (keyserver_export, keyidlist, keyserver_export): Ditto.
* getkey.c (key_byname): Ditto.
* export.c (do_export_stream): Ditto.
2011-04-20 Marcus Brinkmann <mb@g10code.com>
* keylist.c (list_keyblock_colon): Use get_ownertrust_info, not

View File

@ -63,7 +63,7 @@ do_delete_key( const char *username, int secret, int force, int *r_sec_avail )
*r_sec_avail = 0;
/* Search the userid */
rc = classify_user_id (username, &desc);
rc = classify_user_id (username, &desc, 1);
exactmatch = (desc.mode == KEYDB_SEARCH_MODE_FPR
|| desc.mode == KEYDB_SEARCH_MODE_FPR16
|| desc.mode == KEYDB_SEARCH_MODE_FPR20);

View File

@ -752,7 +752,7 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
for (ndesc=0, sl=users; sl; sl = sl->next)
{
if (!(err=classify_user_id (sl->d, desc+ndesc)))
if (!(err=classify_user_id (sl->d, desc+ndesc, 1)))
ndesc++;
else
log_error (_("key \"%s\" not found: %s\n"),

View File

@ -617,7 +617,7 @@ key_byname (GETKEY_CTX *retctx, strlist_t namelist,
{
gpg_error_t err;
err = classify_user_id (r->d, &ctx->items[n]);
err = classify_user_id (r->d, &ctx->items[n], 1);
if (ctx->items[n].exact)
ctx->exact = 1;

View File

@ -626,7 +626,7 @@ parse_keyrec(char *keystring)
if((tok=strsep(&keystring,":"))==NULL)
return ret;
err = classify_user_id (tok, &work->desc);
err = classify_user_id (tok, &work->desc, 1);
if (err || (work->desc.mode != KEYDB_SEARCH_MODE_SHORT_KID
&& work->desc.mode != KEYDB_SEARCH_MODE_LONG_KID
&& work->desc.mode != KEYDB_SEARCH_MODE_FPR16
@ -996,7 +996,7 @@ keyserver_export (ctrl_t ctrl, strlist_t users)
/* Weed out descriptors that we don't support sending */
for(;users;users=users->next)
{
err = classify_user_id (users->d, &desc);
err = classify_user_id (users->d, &desc, 1);
if (err || (desc.mode != KEYDB_SEARCH_MODE_SHORT_KID
&& desc.mode != KEYDB_SEARCH_MODE_LONG_KID
&& desc.mode != KEYDB_SEARCH_MODE_FPR16
@ -1031,7 +1031,7 @@ keyserver_import (ctrl_t ctrl, strlist_t users)
for(;users;users=users->next)
{
err = classify_user_id (users->d, &desc[count]);
err = classify_user_id (users->d, &desc[count], 1);
if (err || (desc[count].mode != KEYDB_SEARCH_MODE_SHORT_KID
&& desc[count].mode != KEYDB_SEARCH_MODE_LONG_KID
&& desc[count].mode != KEYDB_SEARCH_MODE_FPR16
@ -1125,7 +1125,7 @@ keyidlist(strlist_t users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3)
for (ndesc=0, sl=users; sl; sl = sl->next)
{
gpg_error_t err;
if (!(err = classify_user_id (sl->d, desc+ndesc)))
if (!(err = classify_user_id (sl->d, desc+ndesc, 1)))
ndesc++;
else
log_error (_("key \"%s\" not found: %s\n"),

View File

@ -220,7 +220,7 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
afx = new_armor_context ();
kdbhd = keydb_new ();
rc = classify_user_id (uname, &desc);
rc = classify_user_id (uname, &desc, 1);
if (!rc)
rc = keydb_search (kdbhd, &desc, 1);
if (rc) {
@ -463,7 +463,7 @@ gen_revoke (const char *uname)
/* Search the userid; we don't want the whole getkey stuff here. */
kdbhd = keydb_new ();
rc = classify_user_id (uname, &desc);
rc = classify_user_id (uname, &desc, 1);
if (!rc)
rc = keydb_search (kdbhd, &desc, 1);
if (rc)

View File

@ -217,7 +217,7 @@ register_trusted_key( const char *string )
gpg_error_t err;
KEYDB_SEARCH_DESC desc;
err = classify_user_id (string, &desc);
err = classify_user_id (string, &desc, 1);
if (err || desc.mode != KEYDB_SEARCH_MODE_LONG_KID )
{
log_error(_("`%s' is not a valid long keyID\n"), string );

View File

@ -1,3 +1,14 @@
2011-04-25 Werner Koch <wk@g10code.com>
* certlist.c (gpgsm_add_to_certlist): Mark classify_user_id for
use with non-OpenPGP.
(gpgsm_find_cert): Ditto.
* sign.c (get_default_signer): Ditto.
* keylist.c (list_internal_keys): Ditto.
* import.c (reimport_one): Ditto.
* export.c (gpgsm_export): Ditto.
* delete.c (delete_one): Ditto.
2011-03-10 Werner Koch <wk@g10code.com>
* minip12.c (oid_pkcs5PBKDF2, oid_pkcs5PBES2, oid_aes128_CBC): New.

View File

@ -301,7 +301,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret,
KEYDB_HANDLE kh = NULL;
ksba_cert_t cert = NULL;
rc = classify_user_id (name, &desc);
rc = classify_user_id (name, &desc, 0);
if (!rc)
{
kh = keydb_new (0);
@ -480,7 +480,7 @@ gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert)
KEYDB_HANDLE kh = NULL;
*r_cert = NULL;
rc = classify_user_id (name, &desc);
rc = classify_user_id (name, &desc, 0);
if (!rc)
{
kh = keydb_new (0);

View File

@ -45,7 +45,7 @@ delete_one (ctrl_t ctrl, const char *username)
int duplicates = 0;
int is_ephem = 0;
rc = classify_user_id (username, &desc);
rc = classify_user_id (username, &desc, 0);
if (rc)
{
log_error (_("certificate `%s' not found: %s\n"),

View File

@ -178,7 +178,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream)
{
for (ndesc=0, sl=names; sl; sl = sl->next)
{
rc = classify_user_id (sl->d, desc+ndesc);
rc = classify_user_id (sl->d, desc+ndesc, 0);
if (rc)
{
log_error ("key `%s' not found: %s\n",
@ -348,7 +348,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream)
goto leave;
}
err = classify_user_id (name, desc);
err = classify_user_id (name, desc, 0);
if (err)
{
log_error ("key `%s' not found: %s\n",

View File

@ -433,7 +433,7 @@ reimport_one (ctrl_t ctrl, struct stats_s *stats, int in_fd)
stats->count++;
err = classify_user_id (line, &desc);
err = classify_user_id (line, &desc, 0);
if (err)
{
print_import_problem (ctrl, NULL, 0);

View File

@ -1205,7 +1205,7 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names)
{
for (ndesc=0, sl=names; sl; sl = sl->next)
{
rc = classify_user_id (sl->d, desc+ndesc);
rc = classify_user_id (sl->d, desc+ndesc, 0);
if (rc)
{
log_error ("key `%s' not found: %s\n",

View File

@ -1345,7 +1345,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp,
{
for (ndesc=0, sl=names; sl; sl = sl->next)
{
rc = classify_user_id (sl->d, desc+ndesc);
rc = classify_user_id (sl->d, desc+ndesc, 0);
if (rc)
{
log_error ("key `%s' not found: %s\n",

View File

@ -211,7 +211,7 @@ get_default_signer (ctrl_t ctrl)
return cert;
}
rc = classify_user_id (opt.local_user, &desc);
rc = classify_user_id (opt.local_user, &desc, 0);
if (rc)
{
log_error ("failed to find default signer: %s\n", gpg_strerror (rc));