[monitoring-plugins] This patch adds support for using the readcli lib.

Holger Weiss git at monitoring-plugins.org
Fri Nov 18 11:10:11 CET 2016


    Module: monitoring-plugins
    Branch: master
    Commit: 2c898cf23f10962fe63ba15904c57fd63962e346
    Author: Jan Wagner <waja at cyconet.org>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Sat Nov  5 17:22:39 2016 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=2c898cf

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 29290fd..dcf13d5 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 0a554af..1368780 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 03cbb8b..43dffad 100644
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -36,7 +36,9 @@ const char *email = "devel at monitoring-plugins.org";
 #include "utils.h"
 #include "netutils.h"
 
-#if defined(HAVE_LIBFREERADIUS_CLIENT)
+#if defined(HAVE_LIBRADCLI)
+#include <radcli/radcli.h>
+#elif defined(HAVE_LIBFREERADIUS_CLIENT)
 #include <freeradius-client.h>
 #elif defined(HAVE_LIBRADIUSCLIENT_NG)
 #include <radiusclient-ng.h>
@@ -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



More information about the Commits mailing list