mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Add support to talking to LDAP key servers.
* g10/call-dirmngr.c (record_output): New function. (ks_put_inq_cb): Use it here to generate a --with-colons like output instead of a custom format. * dirmngr/ks-action.c: Include "ldap-parse-uri.h". (ks_action_help): If the provided URI is an LDAP URI, then use ldap_parse_uri to parse. Call ks_ldap_help. (ks_action_search): If passed an LDAP URI, then call ks_ldap_search. (ks_action_get): Likewise. (ks_action_put): Likewise. Also, change data from a 'const void *' to a 'void *' and add info and infolen parameters. Add note that function may modify DATA. * dirmngr/ks-action.h (ks_action_put): Update declaration accordingly. * dirmngr/server.c: Include "ldap-parse-uri.h". (cmd_keyserver): If ITEM->URI is an LDAP URI, parse it using ldap_parse_uri. (hlp_ks_put): Improve documentation. (cmd_ks_put): Also pass info and infolen to ks_action_put. Improve documentation. * dirmngr/ks-engine.h (ks_ldap_help): New declaration. (ks_ldap_search): Likewise. (ks_ldap_get): Likewise. (ks_ldap_put): Likewise. * dirmngr/ks-engine-ldap.c: New file. * dirmngr/Makefile.am (dirmngr_SOURCES): Add ks-engine-ldap.c, ldap-parse-uri.c and ldap-parse-uri.h. (dirmngr_LDADD) [USE_LDAP]: Add $(ldaplibs). -- Signed-off-by: Neal H. Walfield <neal@g10code.de>
This commit is contained in:
parent
81e8306085
commit
51341badb6
8 changed files with 2322 additions and 65 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (C) 2002 Klarälvdalens Datakonsult AB
|
||||
* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2011 g10 Code GmbH
|
||||
* Copyright (C) 2014 Werner Koch
|
||||
* Copyright (C) 2015 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -48,6 +49,7 @@
|
|||
#endif
|
||||
#include "ks-action.h"
|
||||
#include "ks-engine.h" /* (ks_hkp_print_hosttable) */
|
||||
#include "ldap-parse-uri.h"
|
||||
|
||||
/* To avoid DoS attacks we limit the size of a certificate to
|
||||
something reasonable. */
|
||||
|
@ -1524,7 +1526,10 @@ cmd_keyserver (assuan_context_t ctx, char *line)
|
|||
item->parsed_uri = NULL;
|
||||
strcpy (item->uri, line);
|
||||
|
||||
err = http_parse_uri (&item->parsed_uri, line, 1);
|
||||
if (ldap_uri_p (item->uri))
|
||||
err = ldap_parse_uri (&item->parsed_uri, line);
|
||||
else
|
||||
err = http_parse_uri (&item->parsed_uri, line, 1);
|
||||
if (err)
|
||||
{
|
||||
xfree (item);
|
||||
|
@ -1709,13 +1714,15 @@ static const char hlp_ks_put[] =
|
|||
"\n"
|
||||
" INQUIRE KEYBLOCK\n"
|
||||
"\n"
|
||||
"The client shall respond with a binary version of the keyblock. For LDAP\n"
|
||||
"The client shall respond with a binary version of the keyblock (e.g.,\n"
|
||||
"the output of `gpg --export KEYID'). For LDAP\n"
|
||||
"keyservers Dirmngr may ask for meta information of the provided keyblock\n"
|
||||
"using:\n"
|
||||
"\n"
|
||||
" INQUIRE KEYBLOCK_INFO\n"
|
||||
"\n"
|
||||
"The client shall respond with a colon delimited info lines";
|
||||
"The client shall respond with a colon delimited info lines (the output\n"
|
||||
"of 'for x in keys sigs; do gpg --list-$x --with-colons KEYID; done').\n";
|
||||
static gpg_error_t
|
||||
cmd_ks_put (assuan_context_t ctx, char *line)
|
||||
{
|
||||
|
@ -1755,7 +1762,7 @@ cmd_ks_put (assuan_context_t ctx, char *line)
|
|||
}
|
||||
|
||||
/* Send the key. */
|
||||
err = ks_action_put (ctrl, value, valuelen);
|
||||
err = ks_action_put (ctrl, value, valuelen, info, infolen);
|
||||
|
||||
leave:
|
||||
xfree (info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue