summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Wagner <waja@cyconet.org>2016-11-05 17:22:39 +0100
committerHolger Weiss <holger@zedat.fu-berlin.de>2016-11-15 23:21:40 +0100
commit2c898cf23f10962fe63ba15904c57fd63962e346 (patch)
treee79862d5826ab8cd4e1322f5f9f099eb934ebcb6
parent2f845e9ebc2b7bcf6472e0191752215d351e4e7c (diff)
downloadmonitoring-plugins-2c898cf23f10962fe63ba15904c57fd63962e346.tar.gz
This patch adds support for using the readcli lib.
http://radcli.github.io/radcli/ (Closes #1437)
-rw-r--r--.travis.yml2
-rw-r--r--configure.ac29
-rw-r--r--plugins/check_radius.c12
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:
20 # - mysql -e "create database IF NOT EXISTS test;" -uroot 20 # - mysql -e "create database IF NOT EXISTS test;" -uroot
21 21
22install: 22install:
23 - 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 23 - 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
24 - sudo apt-get install -qq --no-install-recommends libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd 24 - sudo apt-get install -qq --no-install-recommends libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd
25 - sudo apt-get install -qq --no-install-recommends fping snmp netcat smbclient fping pure-ftpd apache2 postfix libhttp-daemon-ssl-perl 25 - sudo apt-get install -qq --no-install-recommends fping snmp netcat smbclient fping pure-ftpd apache2 postfix libhttp-daemon-ssl-perl
26 - sudo apt-get install -qq --no-install-recommends libdbd-sybase-perl libnet-dns-perl 26 - 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
273dnl Check for radius libraries 273dnl Check for radius libraries
274AS_IF([test "x$with_radius" != "xno"], [ 274AS_IF([test "x$with_radius" != "xno"], [
275 _SAVEDLIBS="$LIBS" 275 _SAVEDLIBS="$LIBS"
276 AC_CHECK_LIB(freeradius-client,rc_read_config) 276 AC_CHECK_LIB(radcli,rc_read_config)
277 if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then 277 if test "$ac_cv_lib_radcli_rc_read_config" = "yes"; then
278 EXTRAS="$EXTRAS check_radius\$(EXEEXT)" 278 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
279 RADIUSLIBS="-lfreeradius-client" 279 RADIUSLIBS="-lradcli"
280 AC_SUBST(RADIUSLIBS) 280 AC_SUBST(RADIUSLIBS)
281 else 281 else
282 AC_CHECK_LIB(radiusclient-ng,rc_read_config) 282 AC_CHECK_LIB(freeradius-client,rc_read_config)
283 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then 283 if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then
284 EXTRAS="$EXTRAS check_radius\$(EXEEXT)" 284 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
285 RADIUSLIBS="-lradiusclient-ng" 285 RADIUSLIBS="-lfreeradius-client"
286 AC_SUBST(RADIUSLIBS) 286 AC_SUBST(RADIUSLIBS)
287 else 287 else
288 AC_CHECK_LIB(radiusclient,rc_read_config) 288 AC_CHECK_LIB(radiusclient-ng,rc_read_config)
289 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then 289 if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
290 EXTRAS="$EXTRAS check_radius\$(EXEEXT)" 290 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
291 RADIUSLIBS="-lradiusclient" 291 RADIUSLIBS="-lradiusclient-ng"
292 AC_SUBST(RADIUSLIBS) 292 AC_SUBST(RADIUSLIBS)
293 else 293 else
294 AC_MSG_WARN([Skipping radius plugin]) 294 AC_CHECK_LIB(radiusclient,rc_read_config)
295 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) 295 if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
296 EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
297 RADIUSLIBS="-lradiusclient"
298 AC_SUBST(RADIUSLIBS)
299 else
300 AC_MSG_WARN([Skipping radius plugin])
301 AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
302 fi
296 fi 303 fi
297 fi 304 fi
298 fi 305 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";
36#include "utils.h" 36#include "utils.h"
37#include "netutils.h" 37#include "netutils.h"
38 38
39#if defined(HAVE_LIBFREERADIUS_CLIENT) 39#if defined(HAVE_LIBRADCLI)
40#include <radcli/radcli.h>
41#elif defined(HAVE_LIBFREERADIUS_CLIENT)
40#include <freeradius-client.h> 42#include <freeradius-client.h>
41#elif defined(HAVE_LIBRADIUSCLIENT_NG) 43#elif defined(HAVE_LIBRADIUSCLIENT_NG)
42#include <radiusclient-ng.h> 44#include <radiusclient-ng.h>
@@ -48,10 +50,10 @@ int process_arguments (int, char **);
48void print_help (void); 50void print_help (void);
49void print_usage (void); 51void print_usage (void);
50 52
51#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) 53#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
52#define my_rc_conf_str(a) rc_conf_str(rch,a) 54#define my_rc_conf_str(a) rc_conf_str(rch,a)
53#define my_rc_send_server(a,b) rc_send_server(rch,a,b) 55#define my_rc_send_server(a,b) rc_send_server(rch,a,b)
54#ifdef HAVE_LIBFREERADIUS_CLIENT 56#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADCLI)
55#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f) 57#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f)
56#else 58#else
57#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) 59#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);
76 78
77int my_rc_read_config(char *); 79int my_rc_read_config(char *);
78 80
79#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) 81#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
80rc_handle *rch = NULL; 82rc_handle *rch = NULL;
81#endif 83#endif
82 84
@@ -399,7 +401,7 @@ print_usage (void)
399 401
400int my_rc_read_config(char * a) 402int my_rc_read_config(char * a)
401{ 403{
402#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) 404#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
403 rch = rc_read_config(a); 405 rch = rc_read_config(a);
404 return (rch == NULL) ? 1 : 0; 406 return (rch == NULL) ? 1 : 0;
405#else 407#else