From 2c898cf23f10962fe63ba15904c57fd63962e346 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 5 Nov 2016 17:22:39 +0100 Subject: This patch adds support for using the readcli lib. http://radcli.github.io/radcli/ (Closes #1437) --- .travis.yml | 2 +- configure.ac | 29 ++++++++++++++++++----------- plugins/check_radius.c | 12 +++++++----- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29290fd1..dcf13d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_install: # - mysql -e "create database IF NOT EXISTS test;" -uroot install: - - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libfreeradius-client-dev libkrb5-dev libnet-snmp-perl procps + - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libradcli-dev libkrb5-dev libnet-snmp-perl procps - sudo apt-get install -qq --no-install-recommends libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd - sudo apt-get install -qq --no-install-recommends fping snmp netcat smbclient fping pure-ftpd apache2 postfix libhttp-daemon-ssl-perl - sudo apt-get install -qq --no-install-recommends libdbd-sybase-perl libnet-dns-perl diff --git a/configure.ac b/configure.ac index 0a554af6..1368780f 100644 --- a/configure.ac +++ b/configure.ac @@ -273,26 +273,33 @@ AC_ARG_WITH([radius], [AS_HELP_STRING([--without-radius], [Skips the radius plug dnl Check for radius libraries AS_IF([test "x$with_radius" != "xno"], [ _SAVEDLIBS="$LIBS" - AC_CHECK_LIB(freeradius-client,rc_read_config) - if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then + AC_CHECK_LIB(radcli,rc_read_config) + if test "$ac_cv_lib_radcli_rc_read_config" = "yes"; then EXTRAS="$EXTRAS check_radius\$(EXEEXT)" - RADIUSLIBS="-lfreeradius-client" + RADIUSLIBS="-lradcli" AC_SUBST(RADIUSLIBS) else - AC_CHECK_LIB(radiusclient-ng,rc_read_config) - if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then + AC_CHECK_LIB(freeradius-client,rc_read_config) + if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then EXTRAS="$EXTRAS check_radius\$(EXEEXT)" - RADIUSLIBS="-lradiusclient-ng" + RADIUSLIBS="-lfreeradius-client" AC_SUBST(RADIUSLIBS) else - AC_CHECK_LIB(radiusclient,rc_read_config) - if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then + AC_CHECK_LIB(radiusclient-ng,rc_read_config) + if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then EXTRAS="$EXTRAS check_radius\$(EXEEXT)" - RADIUSLIBS="-lradiusclient" + RADIUSLIBS="-lradiusclient-ng" AC_SUBST(RADIUSLIBS) else - AC_MSG_WARN([Skipping radius plugin]) - AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) + AC_CHECK_LIB(radiusclient,rc_read_config) + if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then + EXTRAS="$EXTRAS check_radius\$(EXEEXT)" + RADIUSLIBS="-lradiusclient" + AC_SUBST(RADIUSLIBS) + else + AC_MSG_WARN([Skipping radius plugin]) + AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) + fi fi fi fi diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 03cbb8b0..43dffad2 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -36,7 +36,9 @@ const char *email = "devel@monitoring-plugins.org"; #include "utils.h" #include "netutils.h" -#if defined(HAVE_LIBFREERADIUS_CLIENT) +#if defined(HAVE_LIBRADCLI) +#include +#elif defined(HAVE_LIBFREERADIUS_CLIENT) #include #elif defined(HAVE_LIBRADIUSCLIENT_NG) #include @@ -48,10 +50,10 @@ int process_arguments (int, char **); void print_help (void); void print_usage (void); -#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) +#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) #define my_rc_conf_str(a) rc_conf_str(rch,a) #define my_rc_send_server(a,b) rc_send_server(rch,a,b) -#ifdef HAVE_LIBFREERADIUS_CLIENT +#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADCLI) #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f) #else #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) @@ -76,7 +78,7 @@ void print_usage (void); int my_rc_read_config(char *); -#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) +#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) rc_handle *rch = NULL; #endif @@ -399,7 +401,7 @@ print_usage (void) int my_rc_read_config(char * a) { -#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) +#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) rch = rc_read_config(a); return (rch == NULL) ? 1 : 0; #else -- cgit v1.2.3-74-g34f1