[Pkg-gnupg-commit] [gnupg2] 09/124: dirmngr: Rearrange files to fix de6d831.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 5 15:55:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 1890896fe698c55d15160a53aa6c5c22dc424031
Author: Werner Koch <wk at gnupg.org>
Date: Thu Mar 2 18:17:58 2017 +0100
dirmngr: Rearrange files to fix de6d831.
* dirmngr/http-common.c: New.
* dirmngr/http-common.h: New.
* dirmngr/Makefile.am (dirmngr_SOURCES): Add them.
(t_http_SOURCES): Add them.
(t_ldap_parse_uri_SOURCES): Add them.
* dirmngr/misc.c (get_default_keyserver): Move to ...
* dirmngr/http-common.c: here.
* dirmngr/http.c: Include http-common.h instead of misc.h.
* dirmngr/http-ntbtls.c: Ditto.
Signed-off-by: Werner Koch <wk at gnupg.org>
---
dirmngr/Makefile.am | 7 +++----
dirmngr/dirmngr.c | 1 +
dirmngr/http-common.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
dirmngr/http-common.h | 25 +++++++++++++++++++++++++
dirmngr/http-ntbtls.c | 2 +-
dirmngr/http.c | 2 +-
dirmngr/misc.c | 23 -----------------------
dirmngr/misc.h | 2 --
8 files changed, 81 insertions(+), 31 deletions(-)
diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am
index 8d22cc4..93880f8 100644
--- a/dirmngr/Makefile.am
+++ b/dirmngr/Makefile.am
@@ -61,8 +61,7 @@ dirmngr_SOURCES = dirmngr.c dirmngr.h server.c crlcache.c crlfetch.c \
cdb.h cdblib.c misc.c dirmngr-err.h \
ocsp.c ocsp.h validate.c validate.h \
dns-stuff.c dns-stuff.h \
- http.c http.h \
- http-ntbtls.c \
+ http.c http.h http-common.c http-common.h http-ntbtls.c \
ks-action.c ks-action.h ks-engine.h \
ks-engine-hkp.c ks-engine-http.c ks-engine-finger.c ks-engine-kdns.c
@@ -141,7 +140,7 @@ endif
# http tests
# We need to add the KSBA flags in case we are building against GNUTLS.
# In that case NTBTLS flags are empty, but we need ksba anyway.
-t_http_SOURCES = $(t_common_src) t-http.c http.c dns-stuff.c
+t_http_SOURCES = $(t_common_src) t-http.c http.c dns-stuff.c http-common.c
t_http_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \
$(LIBGCRYPT_CFLAGS) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS) \
$(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS)
@@ -150,7 +149,7 @@ t_http_LDADD = $(t_common_ldadd) \
t_ldap_parse_uri_SOURCES = \
t-ldap-parse-uri.c ldap-parse-uri.c ldap-parse-uri.h \
- http.c dns-stuff.c \
+ http.c http-common.c dns-stuff.c \
$(ldap_url) $(t_common_src)
t_ldap_parse_uri_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \
$(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS)
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 75e8523..f05bdd1 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -72,6 +72,7 @@
#include "../common/init.h"
#include "gc-opt-flags.h"
#include "dns-stuff.h"
+#include "http-common.h"
#ifndef ENAMETOOLONG
# define ENAMETOOLONG EINVAL
diff --git a/dirmngr/http-common.c b/dirmngr/http-common.c
new file mode 100644
index 0000000..6013669
--- /dev/null
+++ b/dirmngr/http-common.c
@@ -0,0 +1,50 @@
+/* http-common.c - Common support for TLS implementations.
+ * Copyright (C) 2017 Werner Koch
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "dirmngr.h"
+#include "http-common.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;
+}
diff --git a/dirmngr/http-common.h b/dirmngr/http-common.h
new file mode 100644
index 0000000..5e6657b
--- /dev/null
+++ b/dirmngr/http-common.h
@@ -0,0 +1,25 @@
+/* http-common.h - Defs for common support for TLS implementations.
+ * Copyright (C) 2017 Werner Koch
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef HTTP_COMMON_H
+#define HTTP_COMMON_H
+
+const char *get_default_keyserver (int name_only);
+
+#endif /* HTTP_COMMON_H */
diff --git a/dirmngr/http-ntbtls.c b/dirmngr/http-ntbtls.c
index d44b779..250db55 100644
--- a/dirmngr/http-ntbtls.c
+++ b/dirmngr/http-ntbtls.c
@@ -26,7 +26,7 @@
#include "dirmngr.h"
#include "certcache.h"
#include "validate.h"
-#include "misc.h"
+#include "http-common.h"
#ifdef HTTP_USE_NTBTLS
# include <ntbtls.h>
diff --git a/dirmngr/http.c b/dirmngr/http.c
index fc82924..0f11af7 100644
--- a/dirmngr/http.c
+++ b/dirmngr/http.c
@@ -100,7 +100,7 @@
#include "i18n.h"
#include "dns-stuff.h"
#include "http.h"
-#include "misc.h"
+#include "http-common.h"
#ifdef USE_NPTH
diff --git a/dirmngr/misc.c b/dirmngr/misc.c
index d2f1c69..6d7c963 100644
--- a/dirmngr/misc.c
+++ b/dirmngr/misc.c
@@ -30,29 +30,6 @@
#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
diff --git a/dirmngr/misc.h b/dirmngr/misc.h
index f25574f..be4049e 100644
--- a/dirmngr/misc.h
+++ b/dirmngr/misc.h
@@ -21,8 +21,6 @@
#ifndef MISC_H
#define MISC_H
-const char *get_default_keyserver (int name_only);
-
/* Convert hex encoded string back to binary. */
size_t unhexify (unsigned char *result, const char *string);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list