diff options
author | Werner Koch <wk@gnupg.org> | 2022-10-04 12:44:29 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2022-10-04 12:44:29 +0200 |
commit | 4de98d4468f37bfb8352426830d5d5642ded7536 (patch) | |
tree | 023a4f1088e41e5b8bff7855269cc1a76f3f5813 /dirmngr/ks-engine.h | |
parent | gpg: Show just keyserver and port with --send-keys. (diff) | |
download | gnupg2-4de98d4468f37bfb8352426830d5d5642ded7536.tar.xz gnupg2-4de98d4468f37bfb8352426830d5d5642ded7536.zip |
dirmngr: New options --first and --next for KS_GET.
* dirmngr/server.c (cmd_ks_get): Add option --first and --next.
(start_command_handler): Free that new ldap state.
* dirmngr/ks-engine-ldap.c (struct ks_engine_ldap_local_s): New.
(ks_ldap_new_state, ks_ldap_clear_state): New.
(ks_ldap_free_state): New.
(return_one_keyblock): New. Mostly factored out from ....
(ks_ldap_get): here. Implement --first/--next feature.
* dirmngr/ks-action.c (ks_action_get): Rename arg ldap_only to
ks_get_flags.
* dirmngr/ks-engine.h (KS_GET_FLAG_ONLY_LDAP): New.
(KS_GET_FLAG_FIRST): New.
(KS_GET_FLAG_NEXT): New.
* dirmngr/dirmngr.h (struct server_control_s): Add member
ks_get_state.
(struct ks_engine_ldap_local_s): New forward reference.
--
This feature allows to fetch keyblock by keyblock from an LDAP server.
This way tools can process and maybe filter each keyblock in a more
flexible way. Here is an example where two keyblocks for one mail
address are returned:
$ gpg-connect-agent --dirmngr
> ks_get --ldap --first <foo@example.org>
[... First keyblock is returned ]
OK
> ks_get --next
[ ... Next keyblock is returned ]
OK
> ks_get --next
ERR 167772218 No data <Dirmngr>
GnuPG_bug_id: 6224
Diffstat (limited to 'dirmngr/ks-engine.h')
-rw-r--r-- | dirmngr/ks-engine.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/dirmngr/ks-engine.h b/dirmngr/ks-engine.h index d28c6ab71..be4e27e6f 100644 --- a/dirmngr/ks-engine.h +++ b/dirmngr/ks-engine.h @@ -23,6 +23,12 @@ #include "http.h" +/* Flags for engine functions. */ +#define KS_GET_FLAG_ONLY_LDAP 1 +#define KS_GET_FLAG_FIRST 2 +#define KS_GET_FLAG_NEXT 4 + + /*-- ks-action.c --*/ gpg_error_t ks_print_help (ctrl_t ctrl, const char *text); gpg_error_t ks_printf_help (ctrl_t ctrl, const char *format, @@ -63,10 +69,12 @@ gpg_error_t ks_kdns_fetch (ctrl_t ctrl, parsed_uri_t uri, estream_t *r_fp); /*-- ks-engine-ldap.c --*/ gpg_error_t ks_ldap_help (ctrl_t ctrl, parsed_uri_t uri); +void ks_ldap_free_state (struct ks_engine_ldap_local_s *state); gpg_error_t ks_ldap_search (ctrl_t ctrl, parsed_uri_t uri, const char *pattern, estream_t *r_fp); gpg_error_t ks_ldap_get (ctrl_t ctrl, parsed_uri_t uri, - const char *keyspec, estream_t *r_fp); + const char *keyspec, unsigned int ks_get_flags, + estream_t *r_fp); gpg_error_t ks_ldap_put (ctrl_t ctrl, parsed_uri_t uri, void *data, size_t datalen, void *info, size_t infolen); |