Skip to content

Commit

Permalink
testbench: Added tls fingerprint test
Browse files Browse the repository at this point in the history
Fixed minor openssl compatbility issues with older versions.
Fixed configure.ac
Fixed minor memory leaks
  • Loading branch information
alorbach committed Jun 25, 2018
1 parent 7fdf137 commit cde0086
Show file tree
Hide file tree
Showing 17 changed files with 241 additions and 102 deletions.
6 changes: 6 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extraction:
cpp:
configure:
command:
- autoreconf -fvi
- ./configure --enable-tls-openssl
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ script:
- autoreconf -fvi
- ./configure --enable-tls
- make -j2
- make distcheck V=0
- make check
- cat tests/test-suite.log
# - make distcheck V=0
# and now with openssl
- make clean
- ./configure --enable-openssl
- ./configure --enable-tls-openssl
- make -j2
- make distcheck V=0
- make check
- cat tests/test-suite.log
# - make distcheck V=0

# - cat /home/travis/build/rsyslog/librelp/librelp-1.2.16.master/_build/tests/test-suite.log
# - sudo make install
# now we use the rsyslog testbench for testing. This also means we need to
Expand Down
59 changes: 32 additions & 27 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,39 @@ AC_ARG_ENABLE(tls,
no) enable_tls="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tls) ;;
esac],
[enable_tls="no"]
[enable_tls="yes"]
)
# enable Openssl TLS
AC_ARG_ENABLE(tls-openssl,
[AS_HELP_STRING([--enable-tls-openssl],[Enable OpenSSL TLS support @<:@default=yes@:>@])],
[case "${enableval}" in
yes) enable_tls_openssl="yes" ;;
no) enable_tls_openssl="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tls-openssl) ;;
esac],
[enable_tls_openssl="no"]
)

if test "$enable_tls_openssl" = "yes"; then
PKG_CHECK_MODULES(OPENSSL, openssl)
AC_DEFINE([ENABLE_TLS_OPENSSL], [1], [Indicator that openssl is present])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
save_LIBS="$LIBS"
LIBS="$LIBS $OPENSSL_LIBS"

# Make sure GNUTLS is disabled
if test "$enable_tls" = "yes"; then
AC_MSG_WARN([Cannot compile GNUTLS and OpenSSL at the same time. Disabling gnutls. ])

# Disable GNUTLS
enable_tls="no"
have_gnutls_certificate_set_verify_function="no"
fi

fi
AM_CONDITIONAL(ENABLE_TLS_OPENSSL, test x$enable_tls_openssl = xyes)

if test "$enable_tls" = "yes"; then
PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.0.0)
AC_DEFINE(ENABLE_TLS, 1, [Defined if TLS support is enabled])
Expand Down Expand Up @@ -158,32 +189,6 @@ if test "$enable_tls" = "yes"; then
LIBS="$save_LIBS"
fi


# enable Openssl TLS
AC_ARG_ENABLE(tls-openssl,
[AS_HELP_STRING([--enable-tls-openssl],[Enable OpenSSL TLS support @<:@default=yes@:>@])],
[case "${enableval}" in
yes) enable_tls_openssl="yes" ;;
no) enable_tls_openssl="no" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tls-openssl) ;;
esac],
[enable_tls_openssl="no"]
)
if test "$enable_tls_openssl" = "yes"; then
PKG_CHECK_MODULES(OPENSSL, openssl)
AC_DEFINE([ENABLE_TLS_OPENSSL], [1], [Indicator that openssl is present])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
save_LIBS="$LIBS"
LIBS="$LIBS $OPENSSL_LIBS"

# Make sure GNUTLS is disabled
if test "$enable_tls" = "yes"; then
AC_MSG_ERROR([Cannot compile GNUTLS and OpenSSL at the same time. Either use --enable-tls or --enable-tls-openssl but not both.])
fi
fi
AM_CONDITIONAL(ENABLE_TLS_OPENSSL, test x$enable_tls_openssl = xyes)

# debug mode settings
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=no@:>@])],
Expand Down
2 changes: 1 addition & 1 deletion devtools/run-configure.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
printf "running configure with\nCC:\t$CC\nCFLAGS:\t$CFLAGS\n"
autoreconf -fvi
./configure --enable-tls
./configure $PROJ_CONFIGURE_OPTIONS
36 changes: 36 additions & 0 deletions devtools/travis-run-compile-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,48 @@ DO_IN_CONTAINER="$PROJ_HOME/devtools/devcontainer.sh"
printf "\n\n============ STEP: check code style ================\n\n\n"
$DO_IN_CONTAINER devtools/check-codestyle.sh


echo ==================== compile using gnutls ====================
export PROJ_CONFIGURE_OPTIONS=--enable-tls


printf "\n\n============ STEP: run static analyzer ================\n\n\n"
$DO_IN_CONTAINER devtools/run-static-analyzer.sh

# #################### newer compilers ####################

printf "\n\n============ STEP: gcc-7 compile test ================\n\n\n"
export CC=gcc-7
export CFLAGS=
$DO_IN_CONTAINER devtools/run-configure.sh
$DO_IN_CONTAINER make check TESTS=""

$DO_IN_CONTAINER make clean
printf "\n\n============ STEP: clang-5.0 compile test ================\n\n\n"
export CC=clang-5.0
export CFLAGS=
$DO_IN_CONTAINER devtools/run-configure.sh
$DO_IN_CONTAINER make check TESTS=""

exit 0

# #################### older style compile tests####################
$DO_IN_CONTAINER make clean
printf "\n\n============ STEP: testing alpine build ================\n\n\n"
$PROJ_HOME/tests/travis/docker-alpine.sh



echo ==================== compile using openssl ====================
export PROJ_CONFIGURE_OPTIONS=--enable-tls-openssl


printf "\n\n============ STEP: run static analyzer ================\n\n\n"
$DO_IN_CONTAINER make clean
$DO_IN_CONTAINER devtools/run-static-analyzer.sh

# #################### newer compilers ####################

printf "\n\n============ STEP: gcc-7 compile test ================\n\n\n"
export CC=gcc-7
export CFLAGS=
Expand Down
1 change: 1 addition & 0 deletions src/relpsess.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ relpSessDestruct(relpSess_t **ppThis)
free(pThis->srvAddr);
free(pThis->clientIP);
free(pThis->pristring);
free(pThis->caCertFile);
free(pThis->ownCertFile);
free(pThis->privKeyFile);
relpSessFreePermittedPeers(pThis);
Expand Down
Loading

0 comments on commit cde0086

Please sign in to comment.