diff options
author | Werner Koch <[email protected]> | 2001-12-14 20:48:07 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2001-12-14 20:48:07 +0000 |
commit | 134d401a4ea111b423660b81c062c49d1d6bd449 (patch) | |
tree | bea2388bc7226317ff7443cfc90a63d99485ba4c /kbx/keybox-search.c | |
parent | * verify.c (gpgsm_verify): Add hash debug helpers (diff) | |
download | gnupg-134d401a4ea111b423660b81c062c49d1d6bd449.tar.gz gnupg-134d401a4ea111b423660b81c062c49d1d6bd449.zip |
* keybox-blob.c (x509_email_kludge): New.
(_keybox_create_x509_blob): Insert an extra email address if the
subject's DN has an email part.
* keybox-defs.h: Added the xtoi_2 and digitp macros.
Diffstat (limited to 'kbx/keybox-search.c')
-rw-r--r-- | kbx/keybox-search.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c index e168d2b97..376bc23ae 100644 --- a/kbx/keybox-search.c +++ b/kbx/keybox-search.c @@ -219,6 +219,9 @@ blob_cmp_mail (KEYBOXBLOB blob, const char *name, size_t namelen) if (pos + uidinfolen*nuids > length) return 0; /* out of bounds */ + if (namelen < 1) + return 0; + for (idx=1 ;idx < nuids; idx++) { size_t mypos = pos; @@ -230,12 +233,11 @@ blob_cmp_mail (KEYBOXBLOB blob, const char *name, size_t namelen) return 0; /* error: better stop here out of bounds */ if (len < 2 || buffer[off] != '<') continue; /* empty name or trailing 0 not stored */ - len--; /* remove the null */ - if ( len < 3 || buffer[off+len-1] != '>') + len--; /* one back */ + if ( len < 3 || buffer[off+len] != '>') continue; /* not a prober email address */ - off++; len--; /* skip the leading angle bracket */ - len--; /* don't compare the trailing one */ - if (len == namelen && !memcmp (buffer+off, name, len)) + len--; + if (len == namelen && !memcmp (buffer+off+1, name, len)) return 1; /* found */ } return 0; /* not found */ @@ -349,6 +351,8 @@ has_mail (KEYBOXBLOB blob, const char *name) return 0; namelen = strlen (name); + if (namelen && name[namelen-1] == '>') + namelen--; return blob_cmp_mail (blob, name, namelen); } |