aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-04-21 17:29:53 +0000
committerWerner Koch <[email protected]>2015-04-21 17:29:53 +0000
commitc4d98734c5df39f57a71f0ec1c0c80e82ff08508 (patch)
tree1f29ec2bd39bdb5bc1e4b6a38ba95b87072546a8
parentcommon: Make proper use of http proxy parameter. (diff)
downloadgnupg-c4d98734c5df39f57a71f0ec1c0c80e82ff08508.tar.gz
gnupg-c4d98734c5df39f57a71f0ec1c0c80e82ff08508.zip
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.
-rw-r--r--g10/call-dirmngr.c15
-rw-r--r--g10/keyserver.c15
-rw-r--r--g10/options.h1
3 files changed, 26 insertions, 5 deletions
diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c
index 26955abbf..bb571b2e9 100644
--- a/g10/call-dirmngr.c
+++ b/g10/call-dirmngr.c
@@ -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)
diff --git a/g10/keyserver.c b/g10/keyserver.c
index 674eb8119..abe4bdebf 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -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 */
diff --git a/g10/options.h b/g10/options.h
index 75032a546..465c5b215 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -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;