mirror of
git://git.gnupg.org/gnupg.git
synced 2024-10-31 20:08:43 +01:00
39815c023f
* 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 <wk@gnupg.org>
88 lines
3.0 KiB
C
88 lines
3.0 KiB
C
/* crlfetch.h - LDAP access
|
|
* Copyright (C) 2002 Klarälvdalens Datakonsult AB
|
|
*
|
|
* This file is part of DirMngr.
|
|
*
|
|
* DirMngr is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* DirMngr is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef CRLFETCH_H
|
|
#define CRLFETCH_H
|
|
|
|
#include "dirmngr.h"
|
|
|
|
|
|
struct cert_fetch_context_s;
|
|
typedef struct cert_fetch_context_s *cert_fetch_context_t;
|
|
|
|
|
|
/* Fetch CRL from URL. */
|
|
gpg_error_t crl_fetch (ctrl_t ctrl, const char* url, ksba_reader_t *reader);
|
|
|
|
/* Fetch CRL for ISSUER using default server. */
|
|
gpg_error_t crl_fetch_default (ctrl_t ctrl,
|
|
const char* issuer, ksba_reader_t *reader);
|
|
|
|
|
|
/* Fetch cert for DN. */
|
|
gpg_error_t ca_cert_fetch (ctrl_t ctrl, cert_fetch_context_t *context,
|
|
const char *dn);
|
|
|
|
|
|
/* Query the server for certs matching patterns. */
|
|
gpg_error_t start_cert_fetch (ctrl_t ctrl,
|
|
cert_fetch_context_t *context,
|
|
strlist_t patterns,
|
|
const ldap_server_t server);
|
|
gpg_error_t fetch_next_cert(cert_fetch_context_t context,
|
|
unsigned char **value, size_t *valuelen);
|
|
gpg_error_t fetch_next_ksba_cert (cert_fetch_context_t context,
|
|
ksba_cert_t *r_cert);
|
|
void end_cert_fetch (cert_fetch_context_t context);
|
|
|
|
/* Lookup a cert by it's URL. */
|
|
gpg_error_t fetch_cert_by_url (ctrl_t ctrl, const char *url,
|
|
unsigned char **value, size_t *valuelen);
|
|
|
|
/* Close a reader object. */
|
|
void crl_close_reader (ksba_reader_t reader);
|
|
|
|
|
|
|
|
/*-- ldap.c --*/
|
|
gpg_error_t url_fetch_ldap (ctrl_t ctrl,
|
|
const char *url, ksba_reader_t *reader);
|
|
gpg_error_t attr_fetch_ldap (ctrl_t ctrl,
|
|
const char *dn, const char *attr,
|
|
ksba_reader_t *reader);
|
|
|
|
|
|
gpg_error_t start_cacert_fetch_ldap (ctrl_t ctrl,
|
|
cert_fetch_context_t *context,
|
|
const char *dn);
|
|
gpg_error_t start_cert_fetch_ldap( ctrl_t ctrl,
|
|
cert_fetch_context_t *context,
|
|
strlist_t patterns,
|
|
const ldap_server_t server );
|
|
gpg_error_t fetch_next_cert_ldap (cert_fetch_context_t context,
|
|
unsigned char **value, size_t *valuelen );
|
|
void end_cert_fetch_ldap (cert_fetch_context_t context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CRLFETCH_H */
|