mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg,sm: Simplify keyserver spec parsing.
* common/keyserver.h: Remove. * sm/gpgsm.h (struct keyserver_spec): Remove. (opt): Change keyserver to a strlist_t. * sm/gpgsm.c (keyserver_list_free): Remove. (parse_keyserver_line): Remove. (main): Store keyserver in an strlist. * sm/call-dirmngr.c (prepare_dirmngr): Adjust for the strlist. Avoid an ambiguity in dirmngr by adding a prefix if needed. * g10/options.h (struct keyserver_spec): Move definition from keyserver.h to here. Remove most fields. * g10/keyserver.c (free_keyserver_spec): Adjust. (cmp_keyserver_spec): Adjust. (parse_keyserver_uri): Simplify. (keyidlist): Remove fakev3 arg which does not make any sense because we don't even support v3 keys. -- We now rely on the dirmngr to parse the keyserver specs. Thus a bad specification will not be caught immediately. However, even before that dirmngr had stricter tests. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
72124fadaf
commit
9f586700ec
10 changed files with 36 additions and 480 deletions
|
@ -198,7 +198,7 @@ warn_version_mismatch (ctrl_t ctrl, assuan_context_t ctx,
|
|||
static void
|
||||
prepare_dirmngr (ctrl_t ctrl, assuan_context_t ctx, gpg_error_t err)
|
||||
{
|
||||
struct keyserver_spec *server;
|
||||
strlist_t server;
|
||||
|
||||
if (!err)
|
||||
err = warn_version_mismatch (ctrl, ctx, DIRMNGR_NAME, 0);
|
||||
|
@ -219,12 +219,13 @@ prepare_dirmngr (ctrl_t ctrl, assuan_context_t ctx, gpg_error_t err)
|
|||
while (server)
|
||||
{
|
||||
char line[ASSUAN_LINELENGTH];
|
||||
char *user = server->user ? server->user : "";
|
||||
char *pass = server->pass ? server->pass : "";
|
||||
char *base = server->base ? server->base : "";
|
||||
|
||||
snprintf (line, DIM (line), "LDAPSERVER %s:%i:%s:%s:%s",
|
||||
server->host, server->port, user, pass, base);
|
||||
/* If the host is "ldap" we prefix the entire line with "ldap:"
|
||||
* to avoid an ambiguity on the server due to the introduction
|
||||
* of this optional prefix. */
|
||||
snprintf (line, DIM (line), "LDAPSERVER %s%s",
|
||||
!strncmp (server->d, "ldap:", 5)? "ldap:":"",
|
||||
server->d);
|
||||
|
||||
assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
/* The code below is not required because we don't return an error. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue