summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-15 07:00:12 +0000
committerAndrew Tridgell <tridge@samba.org>2005-07-15 07:00:12 +0000
commit2c5084ad4d94668de5ae704771021fd49bfd0040 (patch)
tree0b04b24bda13d12f0fed90b445b8cb3f7860e374 /source
parente70a52d5dab1c7b1fcf2bb3b2848ea086f970527 (diff)
downloadsamba-2c5084ad4d94668de5ae704771021fd49bfd0040.tar.gz
samba-2c5084ad4d94668de5ae704771021fd49bfd0040.tar.xz
samba-2c5084ad4d94668de5ae704771021fd49bfd0040.zip
r8482: gnutls_x509_crt_set_subject_key_id is not available in some versions
of gnutls. Thanks to ab for spotting this.
Diffstat (limited to 'source')
-rw-r--r--source/configure.in1
-rw-r--r--source/lib/tls/config.m416
-rw-r--r--source/lib/tls/tlscert.c4
-rw-r--r--source/web_server/config.m411
4 files changed, 21 insertions, 11 deletions
diff --git a/source/configure.in b/source/configure.in
index 587f220d191..11bcc1211b0 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -19,6 +19,7 @@ sinclude(lib/talloc/config.m4)
sinclude(lib/tdb/config.m4)
sinclude(lib/ldb/sqlite3.m4)
sinclude(lib/ldb/config.m4)
+sinclude(lib/tls/config.m4)
sinclude(lib/events/config.m4)
sinclude(lib/cmdline/config.m4)
diff --git a/source/lib/tls/config.m4 b/source/lib/tls/config.m4
new file mode 100644
index 00000000000..6ad618632e5
--- /dev/null
+++ b/source/lib/tls/config.m4
@@ -0,0 +1,16 @@
+###############################
+# start SMB_EXT_LIB_GNUTLS
+# check for gnutls/gnutls.h and -lgnutls
+AC_CHECK_HEADERS(gnutls/gnutls.h)
+AC_CHECK_LIB_EXT(gnutls, GNUTLS_LIBS, gnutls_global_init)
+if test x"$ac_cv_header_gnutls_gnutls_h" = x"yes" -a x"$ac_cv_lib_ext_gnutls_gnutls_global_init" = x"yes";then
+ SMB_EXT_LIB_ENABLE(GNUTLS,YES)
+ AC_CHECK_DECL(gnutls_x509_crt_set_subject_key_id,
+ [AC_DEFINE(HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID,1,gnutls subject_key)], [], [
+#include <gnutls/gnutls.h>
+#include <gnutls/x509.h>
+])
+fi
+SMB_EXT_LIB(GNUTLS, $GNUTLS_LIBS)
+# end SMB_EXT_LIB_GNUTLS
+###############################
diff --git a/source/lib/tls/tlscert.c b/source/lib/tls/tlscert.c
index 2cd46ff4329..d1199226029 100644
--- a/source/lib/tls/tlscert.c
+++ b/source/lib/tls/tlscert.c
@@ -94,7 +94,9 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
#endif
TLSCHECK(gnutls_x509_crt_set_version(cacrt, 3));
TLSCHECK(gnutls_x509_crt_get_key_id(cacrt, 0, keyid, &keyidsize));
+#if HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
TLSCHECK(gnutls_x509_crt_set_subject_key_id(cacrt, keyid, keyidsize));
+#endif
TLSCHECK(gnutls_x509_crt_sign(cacrt, cacrt, cakey));
DEBUG(3,("Generating TLS certificate\n"));
@@ -118,7 +120,9 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
#endif
TLSCHECK(gnutls_x509_crt_set_version(crt, 3));
TLSCHECK(gnutls_x509_crt_get_key_id(crt, 0, keyid, &keyidsize));
+#if HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
TLSCHECK(gnutls_x509_crt_set_subject_key_id(crt, keyid, keyidsize));
+#endif
TLSCHECK(gnutls_x509_crt_sign(crt, crt, key));
DEBUG(3,("Exporting TLS keys\n"));
diff --git a/source/web_server/config.m4 b/source/web_server/config.m4
index 057f193179d..2dd5e5b823a 100644
--- a/source/web_server/config.m4
+++ b/source/web_server/config.m4
@@ -1,13 +1,2 @@
AC_CHECK_HEADERS(setjmp.h)
-###############################
-# start SMB_EXT_LIB_GNUTLS
-# check for gnutls/gnutls.h and -lgnutls
-AC_CHECK_HEADERS(gnutls/gnutls.h)
-AC_CHECK_LIB_EXT(gnutls, GNUTLS_LIBS, gnutls_global_init)
-if test x"$ac_cv_header_gnutls_gnutls_h" = x"yes" -a x"$ac_cv_lib_ext_gnutls_gnutls_global_init" = x"yes";then
- SMB_EXT_LIB_ENABLE(GNUTLS,YES)
-fi
-SMB_EXT_LIB(GNUTLS, $GNUTLS_LIBS)
-# end SMB_EXT_LIB_GNUTLS
-###############################