forked from bip/bip
1
0
Fork 0

merge blackmore's configure.in patch one type and a small connection close fix

This commit is contained in:
nohar 2005-08-16 14:03:33 +00:00
parent 574841d9e3
commit 2afd09e3de
5 changed files with 100 additions and 15 deletions

View File

@ -1,6 +1,6 @@
Arnaud 'nohar' Cornet
Loïc 'Kyoshiro' Gomez
Thanks to jj, YS and lafounie, for hanging around while we were coding.
Thanks to jj, YS and lafouine, for hanging around while we were coding.
Crypto shamelessly taken from Christophe 'sexy' Devine.

89
configure vendored
View File

@ -2951,7 +2951,7 @@ else
OIDENTD_FALSE=
fi
requires_libssl=yes
requires_libssl="yes"
# Check whether --enable-ssl or --disable-ssl was given.
if test "${enable_ssl+set}" = set; then
enableval="$enable_ssl"
@ -2959,13 +2959,91 @@ if test "${enable_ssl+set}" = set; then
fi;
if test "x$requires_libssl" = "xyes" ; then
echo "$as_me:$LINENO: checking for CRYPTO_new_ex_data in -lcrypto" >&5
echo $ECHO_N "checking for CRYPTO_new_ex_data in -lcrypto... $ECHO_C" >&6
if test "${ac_cv_lib_crypto_CRYPTO_new_ex_data+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char CRYPTO_new_ex_data ();
int
main ()
{
CRYPTO_new_ex_data ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_crypto_CRYPTO_new_ex_data=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_crypto_CRYPTO_new_ex_data=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_new_ex_data" >&5
echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_new_ex_data" >&6
if test $ac_cv_lib_crypto_CRYPTO_new_ex_data = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS="-lcrypto $LIBS"
else
{ { echo "$as_me:$LINENO: error: library 'crypto' is required for OpenSSL support" >&5
echo "$as_me: error: library 'crypto' is required for OpenSSL support" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: checking for SSL_read in -lssl" >&5
echo $ECHO_N "checking for SSL_read in -lssl... $ECHO_C" >&6
if test "${ac_cv_lib_ssl_SSL_read+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lssl $LIBS"
LIBS="-lssl -lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -3030,10 +3108,9 @@ _ACEOF
LIBS="-lssl $LIBS"
else
echo "Error! You need to have libssl around."
exit -1
{ { echo "$as_me:$LINENO: error: library 'ssl' is required for OpenSSL support" >&5
echo "$as_me: error: library 'ssl' is required for OpenSSL support" >&2;}
{ (exit 1); exit 1; }; }
fi
fi

View File

@ -23,14 +23,17 @@ AC_DEFINE([HAVE_OIDENTD], [], [Enable oidentd.conf management support])
#[oidentd=true]
AM_CONDITIONAL(OIDENTD, test x$debug = xtrue)
requires_libssl=yes
requires_libssl="yes"
AC_ARG_ENABLE(ssl,
[ --disable-ssl Drop OpenSSL support],
[requires_libssl=no])
if test "x$requires_libssl" = "xyes" ; then
AC_CHECK_LIB(ssl, SSL_read, [], [
echo "Error! You need to have libssl around."
exit -1
])
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [],
[AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])])
AC_CHECK_LIB(ssl, SSL_read, [],
[AC_MSG_ERROR(
[library 'ssl' is required for OpenSSL support])],
-lcrypto)
fi
AC_OUTPUT(Makefile src/Makefile samples/Makefile)

View File

@ -1,5 +1,8 @@
/* src/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL

View File

@ -49,9 +49,11 @@ static void connecting_data_free(struct connecting_data *t)
void connection_close(connection_t *cn)
{
mylog(LOG_DEBUG, "Connection close asked. FD:%d ", (long)cn->handle);
cn->connected = CONN_DISCONN;
shutdown(cn->handle, SHUT_RDWR);
close(cn->handle);
if (cn->connected != CONN_DISCONN) {
cn->connected = CONN_DISCONN;
shutdown(cn->handle, SHUT_RDWR);
close(cn->handle);
}
}
void connection_free(connection_t *cn)