summaryrefslogtreecommitdiff
path: root/ninfod
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2012-12-21 04:32:43 +0900
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2012-12-21 04:32:43 +0900
commit0de89dd843216bb44d012781f65769a4113d57a3 (patch)
treead5c8584466b54965261c4db3aab0db8727aa307 /ninfod
parent3b20833926284b6b55114e9e86a44bafec82c438 (diff)
downloadiputils-0de89dd843216bb44d012781f65769a4113d57a3.tar.gz
ninfod: Support GNU TLS.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'ninfod')
-rw-r--r--ninfod/config.h.in3
-rwxr-xr-xninfod/configure99
-rw-r--r--ninfod/configure.in14
-rw-r--r--ninfod/ninfod_name.c6
4 files changed, 114 insertions, 8 deletions
diff --git a/ninfod/config.h.in b/ninfod/config.h.in
index 10ff9a2..b1709dd 100644
--- a/ninfod/config.h.in
+++ b/ninfod/config.h.in
@@ -15,6 +15,9 @@
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
+/* Define to 1 if you have the <gnutls/openssl.h> header file. */
+#undef HAVE_GNUTLS_OPENSSL_H
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff --git a/ninfod/configure b/ninfod/configure
index deba361..763e416 100755
--- a/ninfod/configure
+++ b/ninfod/configure
@@ -3547,6 +3547,18 @@ fi
done
+for ac_header in gnutls/openssl.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "gnutls/openssl.h" "ac_cv_header_gnutls_openssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_gnutls_openssl_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GNUTLS_OPENSSL_H 1
+_ACEOF
+
+fi
+
+done
+
for ac_header in openssl/md5.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "openssl/md5.h" "ac_cv_header_openssl_md5_h" "$ac_includes_default"
@@ -4123,7 +4135,92 @@ _ACEOF
fi
-LIBS="-lcrypto $LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Init in -lgnutls-openssl" >&5
+$as_echo_n "checking for MD5_Init in -lgnutls-openssl... " >&6; }
+if ${ac_cv_lib_gnutls_openssl_MD5_Init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgnutls-openssl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MD5_Init ();
+int
+main ()
+{
+return MD5_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_gnutls_openssl_MD5_Init=yes
+else
+ ac_cv_lib_gnutls_openssl_MD5_Init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_openssl_MD5_Init" >&5
+$as_echo "$ac_cv_lib_gnutls_openssl_MD5_Init" >&6; }
+if test "x$ac_cv_lib_gnutls_openssl_MD5_Init" = xyes; then :
+ $as_echo "#define HAVE_MD5_INIT 1" >>confdefs.h
+
+ LIBS="-lgnutls-openssl $LIBS"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Init in -lcrypto" >&5
+$as_echo_n "checking for MD5_Init in -lcrypto... " >&6; }
+if ${ac_cv_lib_crypto_MD5_Init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MD5_Init ();
+int
+main ()
+{
+return MD5_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_crypto_MD5_Init=yes
+else
+ ac_cv_lib_crypto_MD5_Init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_MD5_Init" >&5
+$as_echo "$ac_cv_lib_crypto_MD5_Init" >&6; }
+if test "x$ac_cv_lib_crypto_MD5_Init" = xyes; then :
+ $as_echo "#define HAVE_MD5_INIT 1" >>confdefs.h
+
+ LIBS="-lcrypto $LIBS"
+fi
+
+
+fi
+
ac_config_files="$ac_config_files Makefile ninfod.sh"
diff --git a/ninfod/configure.in b/ninfod/configure.in
index 99f8da0..2e3275e 100644
--- a/ninfod/configure.in
+++ b/ninfod/configure.in
@@ -77,6 +77,7 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(limits.h)
+AC_CHECK_HEADERS(gnutls/openssl.h)
AC_CHECK_HEADERS(openssl/md5.h)
AC_CHECK_HEADERS(sys/uio.h)
AC_CHECK_HEADERS(sys/utsname.h arpa/inet.h netdb.h syslog.h)
@@ -122,15 +123,18 @@ AC_CHECK_FUNCS(nanosleep)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(cap, cap_init)
-dnl AC_CHECK_LIB(crypto, MD5_Init,
-dnl AC_DEFINE(HAVE_MD5_INIT)
-dnl LIBS="-lcrypto $LIBS",
-dnl )
+AC_CHECK_LIB(gnutls-openssl, MD5_Init,
+ AC_DEFINE(HAVE_MD5_INIT)
+ LIBS="-lgnutls-openssl $LIBS",
+ AC_CHECK_LIB(crypto, MD5_Init,
+ AC_DEFINE(HAVE_MD5_INIT)
+ LIBS="-lcrypto $LIBS",
+ )
+)
dnl AC_CHECK_LIB(crypto, MD5Init,
dnl AC_DEFINE(HAVE_MD5INIT)
dnl LIBS="-lcrypto $LIBS",
dnl)
-LIBS="-lcrypto $LIBS"
dnl AC_SUBST(DEFS)
diff --git a/ninfod/ninfod_name.c b/ninfod/ninfod_name.c
index 967d7f7..6d7e92b 100644
--- a/ninfod/ninfod_name.c
+++ b/ninfod/ninfod_name.c
@@ -99,8 +99,10 @@
#include <arpa/inet.h>
-#ifdef HAVE_OPENSSL_MD5_H
-#include <openssl/md5.h>
+#if defined(HAVE_GNUTLS_OPENSSL_H)
+# include <gnutls/openssl.h>
+#elif defined(HAVE_OPENSSL_MD5_H)
+# include <openssl/md5.h>
#endif
#if HAVE_SYS_UTSNAME_H