--- nagios-plugins-1.4.3/plugins/check_radius.c.radiusclient 2004-12-26 01:17:44.000000000 +0200
+++ nagios-plugins-1.4.3/plugins/check_radius.c 2006-07-19 15:50:20.657859088 +0300
@@ -27,7 +27,7 @@ const char *email = "nagiosplug-devel@li
#include "utils.h"
#include "netutils.h"
-#include <radiusclient.h>
+#include <radiusclient-ng.h>
int process_arguments (int, char **);
void print_help (void);
@@ -108,6 +108,7 @@ main (int argc, char **argv)
int result = STATE_UNKNOWN;
UINT4 client_id;
char *str;
+ rc_handle *rh;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
@@ -117,32 +118,41 @@ main (int argc, char **argv)
usage4 (_("Could not parse arguments"));
str = strdup ("dictionary");
- if ((config_file && rc_read_config (config_file)) ||
- rc_read_dictionary (rc_conf_str (str)))
+
+
+ if (!config_file || ((rh = rc_read_config(config_file)) == NULL)) {
die (STATE_UNKNOWN, _("Config file error"));
+ }
+
+ if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
+ die (STATE_UNKNOWN, _("Config file error"));
+ }
service = PW_AUTHENTICATE_ONLY;
+ data.send_pairs = NULL;
+ data.receive_pairs = NULL;
- if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
- rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
- rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
- (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
+ if (!(rc_avpair_add (rh, &data.send_pairs, PW_SERVICE_TYPE, &service, 0, 0) &&
+ rc_avpair_add (rh, &data.send_pairs, PW_USER_NAME, username, -1, 0) &&
+ rc_avpair_add (rh, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) &&
+ (nasid==NULL || rc_avpair_add (rh, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0))))
die (STATE_UNKNOWN, _("Out of Memory?"));
/*
* Fill in NAS-IP-Address
*/
- if ((client_id = rc_own_ipaddress ()) == 0)
+ if ((client_id = rc_own_ipaddress (rh)) == 0)
return (ERROR_RC);
- if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) ==
+ if (rc_avpair_add (rh, &data.send_pairs, PW_NAS_IP_ADDRESS, &client_id, 0, 0) ==
NULL) return (ERROR_RC);
- rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
+ rc_buildreq (rh, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
retries);
- result = rc_send_server (&data, msg);
+ result = rc_send_server (rh, &data, msg);
+
rc_avpair_free (data.send_pairs);
if (data.receive_pairs)
rc_avpair_free (data.receive_pairs);
--- nagios-plugins-1.4.3/configure.in.radiusclient 2006-04-19 06:42:33.000000000 +0300
+++ nagios-plugins-1.4.3/configure.in 2006-07-19 13:50:20.000000000 +0300
@@ -227,10 +227,10 @@ CPPFLAGS="$_SAVEDCPPFLAGS"
dnl Check for radius libraries
_SAVEDLIBS="$LIBS"
-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"
- RADIUSLIBS="-lradiusclient"
+ RADIUSLIBS="-lradiusclient-ng"
AC_SUBST(RADIUSLIBS)
else
AC_MSG_WARN([Skipping radius plugin])
--- nagios-plugins-1.4.3/configure.orig 2006-08-09 22:23:01.000000000 -0500
+++ nagios-plugins-1.4.3/configure 2006-08-09 22:23:46.000000000 -0500
@@ -24967,13 +24967,13 @@
_SAVEDLIBS="$LIBS"
-echo "$as_me:$LINENO: checking for rc_read_config in -lradiusclient" >&5
-echo $ECHO_N "checking for rc_read_config in -lradiusclient... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for rc_read_config in -lradiusclient-ng" >&5
+echo $ECHO_N "checking for rc_read_config in -lradiusclient-ng... $ECHO_C" >&6
if test "${ac_cv_lib_radiusclient_rc_read_config+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lradiusclient $LIBS"
+LIBS="-lradiusclient-ng $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -25036,13 +25036,13 @@
#define HAVE_LIBRADIUSCLIENT 1
_ACEOF
- LIBS="-lradiusclient $LIBS"
+ LIBS="-lradiusclient-ng $LIBS"
fi
if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
EXTRAS="$EXTRAS check_radius"
- RADIUSLIBS="-lradiusclient"
+ RADIUSLIBS="-lradiusclient-ng"
else
{ echo "$as_me:$LINENO: WARNING: Skipping radius plugin" >&5