diff options
author | Werner Koch <wk@gnupg.org> | 2021-04-26 15:32:51 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2021-04-26 15:32:51 +0200 |
commit | 4fcfac6feb2a6c2b14883ba406afc917e8d4be42 (patch) | |
tree | ec4d6b9397db49f89da6a8f4d8af14857794852c /g10 | |
parent | gpg: Do not use import-clean for LDAP keyserver imports. (diff) | |
download | gnupg2-4fcfac6feb2a6c2b14883ba406afc917e8d4be42.tar.xz gnupg2-4fcfac6feb2a6c2b14883ba406afc917e8d4be42.zip |
gpg: Fix mailbox based search via AKL keyserver method.
* g10/keyserver.c (keyserver_import_name): Rename to ...
(keyserver_import_mbox): this. And use mail search mode.
* g10/getkey.c (get_pubkey_byname): Change the two callers.
--
In contrast to a search via keyserver_import_ntds the older
keyserver_import_name used a full match of the provided name despite
that it is only called with an addr-spec (mbox). Due to the mode the
pattern send to dirmngr was prefixed with a '=' and thus dirmngr used
an exact search;. This did only work for provided user ids like
"foo@example.org" but not for "<foo@example.org>" or
"Foo <foo@xample.org>". The old code dates back to 2010.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r-- | g10/getkey.c | 4 | ||||
-rw-r--r-- | g10/gpgv.c | 2 | ||||
-rw-r--r-- | g10/keyserver-internal.h | 4 | ||||
-rw-r--r-- | g10/keyserver.c | 12 | ||||
-rw-r--r-- | g10/test-stubs.c | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/g10/getkey.c b/g10/getkey.c index 48b2b602d..9c5a00555 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1227,7 +1227,7 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode, } else { - rc = keyserver_import_name (ctrl, name, &fpr, &fpr_len, + rc = keyserver_import_mbox (ctrl, name, &fpr, &fpr_len, opt.keyserver); } glo_ctrl.in_auto_key_retrieve--; @@ -1258,7 +1258,7 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode, } else { - rc = keyserver_import_name (ctrl, name, + rc = keyserver_import_mbox (ctrl, name, &fpr, &fpr_len, keyserver); } glo_ctrl.in_auto_key_retrieve--; diff --git a/g10/gpgv.c b/g10/gpgv.c index 4c5cccb4e..03551e7db 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -473,7 +473,7 @@ keyserver_import_wkd (ctrl_t ctrl, const char *name, unsigned int flags, } int -keyserver_import_name (const char *name,struct keyserver_spec *spec) +keyserver_import_mbox (const char *name,struct keyserver_spec *spec) { (void)name; (void)spec; diff --git a/g10/keyserver-internal.h b/g10/keyserver-internal.h index 4b507b227..66d56d8de 100644 --- a/g10/keyserver-internal.h +++ b/g10/keyserver-internal.h @@ -56,8 +56,8 @@ gpg_error_t keyserver_import_wkd (ctrl_t ctrl, const char *name, unsigned char **fpr, size_t *fpr_len); int keyserver_import_ntds (ctrl_t ctrl, const char *name, unsigned char **fpr,size_t *fpr_len); -int keyserver_import_name (ctrl_t ctrl, - const char *name,unsigned char **fpr,size_t *fpr_len, +int keyserver_import_mbox (ctrl_t ctrl, const char *mbox, + unsigned char **fpr,size_t *fpr_len, struct keyserver_spec *keyserver); int keyserver_import_ldap (ctrl_t ctrl, const char *name, unsigned char **fpr,size_t *fpr_len); diff --git a/g10/keyserver.c b/g10/keyserver.c index 48033ab8d..c56021691 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -1122,18 +1122,16 @@ keyserver_any_configured (ctrl_t ctrl) } -/* Import all keys that exactly match NAME */ +/* Import all keys that exactly match MBOX */ int -keyserver_import_name (ctrl_t ctrl, const char *name, +keyserver_import_mbox (ctrl_t ctrl, const char *mbox, unsigned char **fpr, size_t *fprlen, struct keyserver_spec *keyserver) { - KEYDB_SEARCH_DESC desc; - - memset (&desc, 0, sizeof desc); + KEYDB_SEARCH_DESC desc = { 0 }; - desc.mode = KEYDB_SEARCH_MODE_EXACT; - desc.u.name = name; + desc.mode = KEYDB_SEARCH_MODE_MAIL; + desc.u.name = mbox; return keyserver_get (ctrl, &desc, 1, keyserver, 0, fpr, fprlen); } diff --git a/g10/test-stubs.c b/g10/test-stubs.c index 3d3c73716..07dd19d26 100644 --- a/g10/test-stubs.c +++ b/g10/test-stubs.c @@ -231,7 +231,7 @@ keyserver_import_wkd (ctrl_t ctrl, const char *name, unsigned int flags, } int -keyserver_import_name (const char *name,struct keyserver_spec *spec) +keyserver_import_mbox (const char *name,struct keyserver_spec *spec) { (void)name; (void)spec; |