diff options
Diffstat (limited to 'g10/keyring.c')
-rw-r--r-- | g10/keyring.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/g10/keyring.c b/g10/keyring.c index f1281e9..9b7b5fd 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -777,7 +777,7 @@ prepare_search (KEYRING_HANDLE hd) /* A map of the all characters valid used for word_match() - * Valid characters are in in this table converted to uppercase. + * Valid characters are in this table converted to uppercase. * because the upper 128 bytes have special meaning, we assume * that they are all valid. * Note: We must use numerical values here in case that this program @@ -928,13 +928,27 @@ compare_name (int mode, const char *name, const char *uid, size_t uidlen) else if ( mode == KEYDB_SEARCH_MODE_MAIL || mode == KEYDB_SEARCH_MODE_MAILSUB || mode == KEYDB_SEARCH_MODE_MAILEND) { + int have_angles = 1; for (i=0, s= uid; i < uidlen && *s != '<'; s++, i++) ; + if (i == uidlen) + { + /* The UID is a plain addr-spec (cf. RFC2822 section 4.3). */ + have_angles = 0; + s = uid; + i = 0; + } if (i < uidlen) { - /* skip opening delim and one char and look for the closing one*/ - s++; i++; - for (se=s+1, i++; i < uidlen && *se != '>'; se++, i++) - ; + if (have_angles) + { + /* skip opening delim and one char and look for the closing one*/ + s++; i++; + for (se=s+1, i++; i < uidlen && *se != '>'; se++, i++) + ; + } + else + se = s + uidlen; + if (i < uidlen) { i = se - s; if (mode == KEYDB_SEARCH_MODE_MAIL) { |