gpg: Make keyserver-option http_proxy work.

* g10/options.h (opt): Add field keyserver_options.http_proxy.
* g10/keyserver.c (warn_kshelper_option): Add arg noisy.
(parse_keyserver_options): Parse into new http_proxy field.
* g10/call-dirmngr.c (create_context): Send the http-proxy option.
This commit is contained in:
Werner Koch 2015-04-21 19:29:53 +02:00
parent 54e55149f2
commit c4d98734c5
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 26 additions and 5 deletions

View File

@ -148,9 +148,24 @@ create_context (ctrl_t ctrl, assuan_context_t *r_ctx)
}
else if (!err)
{
char *line;
/* Tell the dirmngr that we want to collect audit event. */
/* err = assuan_transact (agent_ctx, "OPTION audit-events=1", */
/* NULL, NULL, NULL, NULL, NULL, NULL); */
if (opt.keyserver_options.http_proxy)
{
line = xtryasprintf ("OPTION http-proxy=%s",
opt.keyserver_options.http_proxy);
if (!line)
err = gpg_error_from_syserror ();
else
{
err = assuan_transact (ctx, line, NULL, NULL, NULL,
NULL, NULL, NULL);
xfree (line);
}
}
}
if (err)

View File

@ -92,11 +92,11 @@ static struct parse_options keyserver_opts[]=
/* some of these options are not real - just for the help
message */
{"max-cert-size",0,NULL,NULL}, /* MUST be the first in this array! */
{"http-proxy", KEYSERVER_HTTP_PROXY, NULL, /* MUST be the second! */
N_("override proxy options set for dirmngr")},
{"include-revoked",0,NULL,N_("include revoked keys in search results")},
{"include-subkeys",0,NULL,N_("include subkeys when searching by key ID")},
{"http-proxy", KEYSERVER_HTTP_PROXY, NULL,
N_("override proxy options set for dirmngr")},
{"timeout", KEYSERVER_TIMEOUT, NULL,
N_("override timeout options set for dirmngr")},
{"refresh-add-fake-v3-keyids",KEYSERVER_ADD_FAKE_V3,NULL,
@ -124,8 +124,9 @@ static gpg_error_t keyserver_put (ctrl_t ctrl, strlist_t keyspecs,
static size_t max_cert_size=DEFAULT_MAX_CERT_SIZE;
static void
warn_kshelper_option(char *option)
warn_kshelper_option(char *option, int noisy)
{
char *p;
@ -139,9 +140,12 @@ warn_kshelper_option(char *option)
else if (!strcmp (option, "check-cert")
|| !strcmp (option, "broken-http-proxy"))
log_info ("keyserver option '%s' is obsolete\n", option);
else if (noisy || opt.verbose)
log_info ("keyserver option '%s' is unknown\n", option);
}
/* Called from main to parse the args for --keyserver-options. */
int
parse_keyserver_options(char *options)
{
@ -150,6 +154,7 @@ parse_keyserver_options(char *options)
char *max_cert=NULL;
keyserver_opts[0].value=&max_cert;
keyserver_opts[1].value=&opt.keyserver_options.http_proxy;
while((tok=optsep(&options)))
{
@ -166,7 +171,7 @@ parse_keyserver_options(char *options)
{
/* All of the standard options have failed, so the option was
destined for a keyserver plugin as used by GnuPG < 2.1 */
warn_kshelper_option (tok);
warn_kshelper_option (tok, 1);
}
}
@ -259,7 +264,7 @@ parse_keyserver_uri (const char *string,int require_scheme)
options++;
while((tok=optsep(&options)))
warn_kshelper_option (tok);
warn_kshelper_option (tok, 0);
}
/* Get the scheme */

View File

@ -148,6 +148,7 @@ struct
unsigned int options;
unsigned int import_options;
unsigned int export_options;
char *http_proxy;
} keyserver_options;
int exec_disable;
int exec_path_set;