From d5a3142b8f2e5603357182f34f0b081b47eda23c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 18 Sep 2015 16:07:39 +0200 Subject: [PATCH] gpg: Report a conflict between honor-keyserver-url and TOR. * g10/call-dirmngr.c (create_context): Send option and print a verbose error. -- It is in general a bad idea to use honor-keyserver-url but if Dirmngr is running in TOR mode we should not allow this option at all. We let Dirmngr know about the use of this option and let Dirmngr tell use whether TOR mode is active so that we can print a hint to disable that keyserver option. A future extension in gpgconf may disable that option directly but a user may still override that and thus we better check. Signed-off-by: Werner Koch --- g10/call-dirmngr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c index e452c971e..df19e4c00 100644 --- a/g10/call-dirmngr.c +++ b/g10/call-dirmngr.c @@ -176,6 +176,22 @@ create_context (ctrl_t ctrl, assuan_context_t *r_ctx) xfree (line); } } + + if (err) + ; + else if ((opt.keyserver_options.options & KEYSERVER_HONOR_KEYSERVER_URL)) + { + /* Tell the dirmngr that this possibly privacy invading + option is in use. If Dirmngr is running in TOR mode, it + will return an error. */ + err = assuan_transact (ctx, "OPTION honor-keyserver-url-used", + NULL, NULL, NULL, NULL, NULL, NULL); + if (gpg_err_code (err) == GPG_ERR_FORBIDDEN) + log_error (_("keyserver option \"honor-keyserver-url\"" + " may not be used in TOR mode\n")); + else if (gpg_err_code (err) == GPG_ERR_UNKNOWN_OPTION) + err = 0; /* Old dirmngr versions do not support this option. */ + } } if (err)