aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-03-02 16:58:00 +0000
committerWerner Koch <[email protected]>2017-03-02 16:58:58 +0000
commitde6d8313f6df32aaa151bee74e1db269ac1e0fed (patch)
tree676c6d8deb0a50597f8defa7bd518b5151ad518d /dirmngr/misc.c
parentgpg: Always initialize the trust db when generating keys. (diff)
downloadgnupg-de6d8313f6df32aaa151bee74e1db269ac1e0fed.tar.gz
gnupg-de6d8313f6df32aaa151bee74e1db269ac1e0fed.zip
dirmngr: Let --gpgconf-list return the default keyserver.
* dirmngr/misc.c (get_default_keyserver): New. * dirmngr/http.c: Include misc.h (http_session_new): Use get_default_keyserver instead of hardwired "hkps.pool.sks-keyservers.net". * dirmngr/http-ntbtls.c (gnupg_http_tls_verify_cb): Ditto. * dirmngr/dirmngr.c (main) <aGPGCongList>: Return default keyserver. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'dirmngr/misc.c')
-rw-r--r--dirmngr/misc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/dirmngr/misc.c b/dirmngr/misc.c
index 6d7c963db..d2f1c69a6 100644
--- a/dirmngr/misc.c
+++ b/dirmngr/misc.c
@@ -30,6 +30,29 @@
#include "util.h"
#include "misc.h"
+/* Return a static string with the default keyserver. If NAME_ONLY is
+ * given only the name part is returned. */
+const char *
+get_default_keyserver (int name_only)
+{
+ static const char *result;
+
+ if (!name_only)
+ return DIRMNGR_DEFAULT_KEYSERVER;
+
+ if (!result)
+ {
+ /* Strip the scheme from the constant. */
+ result = strstr (DIRMNGR_DEFAULT_KEYSERVER, "://");
+ log_assert (result && strlen (result) > 3);
+ result += 3;
+ /* Assert that there is no port given. */
+ log_assert (strchr (result, ':'));
+ }
+ return result;
+}
+
+
/* Convert the hex encoded STRING back into binary and store the
result into the provided buffer RESULT. The actual size of that