From 68a7ccc0c870cce6ab9fefb1aa6fd100e1de129b Mon Sep 17 00:00:00 2001 From: Kristian Fiskerstrand Date: Tue, 25 Nov 2014 19:24:18 +0100 Subject: [PATCH] dirmngr: Only report hkps scheme when available * dirmngr/ks-engine-hkp.c (ks_hkp_help): Make use of TLS macros. -- Only report support for the hkps scheme when GnuPG / dirmngr has been built with a TLS library. This helps debuging and enable the user to detect whether support for hkps is included by doing a `gpg-connect-agent --dirmngr 'keyserver --help' /bye`. Currently hkps will be listed as a supported scheme but trying to add a keyserver using it will silently fail. As a digression, https is never listed as a valid scheme. --- dirmngr/ks-engine-hkp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 12b1778c6..83e878ad7 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -767,12 +767,20 @@ ks_hkp_help (ctrl_t ctrl, parsed_uri_t uri) const char const data[] = "Handler for HKP URLs:\n" " hkp://\n" +#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS " hkps://\n" +#endif "Supported methods: search, get, put\n"; gpg_error_t err; +#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS + const char data2[] = " hkp\n hkps"; +#else + const char data2[] = " hkp"; +#endif + if (!uri) - err = ks_print_help (ctrl, " hkp\n hkps"); + err = ks_print_help (ctrl, data2); else if (uri->is_http && (!strcmp (uri->scheme, "hkp") || !strcmp (uri->scheme, "hkps"))) err = ks_print_help (ctrl, data);