From 864ea251983977b91a7f6ff5964e497cf4b208dc Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 8 Jun 2021 08:46:59 +0200 Subject: dirmngr: Rewrite the LDAP wrapper tool * dirmngr/ldap-misc.c: New. * dirmngr/ldap-misc.h: New. * dirmngr/ks-engine-ldap.c: Include ldap-misc.h. (ldap_err_to_gpg_err, ldap_to_gpg_err): Move to ldap-misc.c. * dirmngr/ldap-wrapper.c (ldap_wrapper): Print list of args in debug mode. * dirmngr/server.c (lookup_cert_by_pattern): Handle GPG_ERR_NOT_FOUND the saqme as GPG_ERR_NO_DATA. * dirmngr/ldap.c (run_ldap_wrapper): Add args tls_mode and ntds. Remove arg url. Adjust for changes in dirmngr_ldap. (url_fetch_ldap): Remove args host and port. Parse the URL and use these values to call run_ldap_wrapper. (attr_fetch_ldap): Pass tls flags to run_ldap_wrapper. (rfc2254_need_escape, rfc2254_escape): New. (extfilt_need_escape, extfilt_escape): New. (parse_one_pattern): Rename to ... (make_one_filter): this. Change for new dirmngr_ldap calling convention. Make issuer DN searching partly work. (escape4url, make_url): Remove. (start_cert_fetch_ldap): Change for new dirmngr_ldap calling convention. * dirmngr/dirmngr_ldap.c: Major rewrite. * dirmngr/t-ldap-misc.c: New. * dirmngr/t-support.h (DIM, DIMof): New. * dirmngr/Makefile.am (dirmngr_ldap_SOURCES): Add ldap-misc.c (module_tests) [USE_LDAP]: Add t-ldap-misc. (t_ldap_parse_uri_SOURCES): Ditto. (t_ldap_misc_SOURCES): New. -- This rewrite allows to properly handle TLS and avoids some code duplication. Signed-off-by: Werner Koch (cherry picked from commit 39815c023f0371dea01f7c51469b19c06ad18718) --- dirmngr/crlfetch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dirmngr/crlfetch.c') diff --git a/dirmngr/crlfetch.c b/dirmngr/crlfetch.c index c8091f6f6..e355aab16 100644 --- a/dirmngr/crlfetch.c +++ b/dirmngr/crlfetch.c @@ -240,7 +240,7 @@ crl_fetch (ctrl_t ctrl, const char *url, ksba_reader_t *reader) else { # if USE_LDAP - err = url_fetch_ldap (ctrl, url, NULL, 0, reader); + err = url_fetch_ldap (ctrl, url, reader); # else /*!USE_LDAP*/ err = gpg_error (GPG_ERR_NOT_IMPLEMENTED); # endif /*!USE_LDAP*/ @@ -513,7 +513,7 @@ fetch_cert_by_url (ctrl_t ctrl, const char *url, else /* Assume LDAP. */ { #if USE_LDAP - err = url_fetch_ldap (ctrl, url, NULL, 0, &reader); + err = url_fetch_ldap (ctrl, url, &reader); #else (void)ctrl; (void)url; -- cgit v1.2.3