diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | configure.in | 11 | ||||
-rw-r--r-- | plugins/check_radius.c | 55 |
4 files changed, 57 insertions, 13 deletions
@@ -25,7 +25,8 @@ This file documents the major additions and syntax changes between releases. | |||
25 | WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments | 25 | WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments |
26 | Passing -E after -p or -r results in UNKNOWN state, now | 26 | Passing -E after -p or -r results in UNKNOWN state, now |
27 | This is needed due to the new ignore feature | 27 | This is needed due to the new ignore feature |
28 | Fix bug when mixing case sensitive and case insensitive regex arguments | 28 | Fix check_disk bug when mixing case sensitive and case insensitive regex arguments |
29 | Check_radius now supports radiusclient-ng | ||
29 | 30 | ||
30 | 1.4.9 4th June 2006 | 31 | 1.4.9 4th June 2006 |
31 | Inclusion of contrib/check_cluster2 as check_cluster with some improvements | 32 | Inclusion of contrib/check_cluster2 as check_cluster with some improvements |
@@ -224,3 +224,4 @@ Aurelien Bompard | |||
224 | Christoph Schell | 224 | Christoph Schell |
225 | Andrew Elwell | 225 | Andrew Elwell |
226 | Heiti Ernits | 226 | Heiti Ernits |
227 | Sebastien Guay | ||
diff --git a/configure.in b/configure.in index dc89b05f..ee928d44 100644 --- a/configure.in +++ b/configure.in | |||
@@ -218,8 +218,15 @@ if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then | |||
218 | RADIUSLIBS="-lradiusclient" | 218 | RADIUSLIBS="-lradiusclient" |
219 | AC_SUBST(RADIUSLIBS) | 219 | AC_SUBST(RADIUSLIBS) |
220 | else | 220 | else |
221 | AC_MSG_WARN([Skipping radius plugin]) | 221 | AC_CHECK_LIB(radiusclient-ng,rc_read_config) |
222 | AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | 222 | if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then |
223 | EXTRAS="$EXTRAS check_radius" | ||
224 | RADIUSLIBS="-lradiusclient-ng" | ||
225 | AC_SUBST(RADIUSLIBS) | ||
226 | else | ||
227 | AC_MSG_WARN([Skipping radius plugin]) | ||
228 | AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | ||
229 | fi | ||
223 | fi | 230 | fi |
224 | LIBS="$_SAVEDLIBS" | 231 | LIBS="$_SAVEDLIBS" |
225 | 232 | ||
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 4b340c3b..32af91fa 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -43,12 +43,35 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
43 | #include "utils.h" | 43 | #include "utils.h" |
44 | #include "netutils.h" | 44 | #include "netutils.h" |
45 | 45 | ||
46 | #ifdef HAVE_LIBRADIUSCLIENT_NG | ||
47 | #include <radiusclient-ng.h> | ||
48 | rc_handle *rch = NULL; | ||
49 | #else | ||
46 | #include <radiusclient.h> | 50 | #include <radiusclient.h> |
51 | #endif | ||
47 | 52 | ||
48 | int process_arguments (int, char **); | 53 | int process_arguments (int, char **); |
49 | void print_help (void); | 54 | void print_help (void); |
50 | void print_usage (void); | 55 | void print_usage (void); |
51 | 56 | ||
57 | /* libradiusclient(-ng) wrapper functions */ | ||
58 | #ifdef HAVE_LIBRADIUSCLIENT_NG | ||
59 | #define my_rc_conf_str(a) rc_conf_str(rch,a) | ||
60 | #define my_rc_send_server(a,b) rc_send_server(rch,a,b) | ||
61 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) | ||
62 | #define my_rc_own_ipaddress() rc_own_ipaddress(rch) | ||
63 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d) | ||
64 | #define my_rc_read_dictionary(a) rc_read_dictionary(rch, a) | ||
65 | #else | ||
66 | #define my_rc_conf_str(a) rc_conf_str(a) | ||
67 | #define my_rc_send_server(a,b) rc_send_server(a, b) | ||
68 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(a,b,c,d,e,f) | ||
69 | #define my_rc_own_ipaddress() rc_own_ipaddress() | ||
70 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(a, b, c, d) | ||
71 | #define my_rc_read_dictionary(a) rc_read_dictionary(a) | ||
72 | #endif | ||
73 | int my_rc_read_config(char *); | ||
74 | |||
52 | char *server = NULL; | 75 | char *server = NULL; |
53 | char *username = NULL; | 76 | char *username = NULL; |
54 | char *password = NULL; | 77 | char *password = NULL; |
@@ -133,33 +156,33 @@ main (int argc, char **argv) | |||
133 | usage4 (_("Could not parse arguments")); | 156 | usage4 (_("Could not parse arguments")); |
134 | 157 | ||
135 | str = strdup ("dictionary"); | 158 | str = strdup ("dictionary"); |
136 | if ((config_file && rc_read_config (config_file)) || | 159 | if ((config_file && my_rc_read_config (config_file)) || |
137 | rc_read_dictionary (rc_conf_str (str))) | 160 | my_rc_read_dictionary (my_rc_conf_str (str))) |
138 | die (STATE_UNKNOWN, _("Config file error")); | 161 | die (STATE_UNKNOWN, _("Config file error")); |
139 | 162 | ||
140 | service = PW_AUTHENTICATE_ONLY; | 163 | service = PW_AUTHENTICATE_ONLY; |
141 | 164 | ||
142 | memset (&data, 0, sizeof(data)); | 165 | memset (&data, 0, sizeof(data)); |
143 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | 166 | if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && |
144 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | 167 | my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && |
145 | rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | 168 | my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && |
146 | (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | 169 | (nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) |
147 | die (STATE_UNKNOWN, _("Out of Memory?")); | 170 | die (STATE_UNKNOWN, _("Out of Memory?")); |
148 | 171 | ||
149 | /* | 172 | /* |
150 | * Fill in NAS-IP-Address | 173 | * Fill in NAS-IP-Address |
151 | */ | 174 | */ |
152 | 175 | ||
153 | if ((client_id = rc_own_ipaddress ()) == 0) | 176 | if ((client_id = my_rc_own_ipaddress ()) == 0) |
154 | return (ERROR_RC); | 177 | return (ERROR_RC); |
155 | 178 | ||
156 | if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | 179 | if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == |
157 | NULL) return (ERROR_RC); | 180 | NULL) return (ERROR_RC); |
158 | 181 | ||
159 | rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | 182 | my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, |
160 | retries); | 183 | retries); |
161 | 184 | ||
162 | result = rc_send_server (&data, msg); | 185 | result = my_rc_send_server (&data, msg); |
163 | rc_avpair_free (data.send_pairs); | 186 | rc_avpair_free (data.send_pairs); |
164 | if (data.receive_pairs) | 187 | if (data.receive_pairs) |
165 | rc_avpair_free (data.receive_pairs); | 188 | rc_avpair_free (data.receive_pairs); |
@@ -350,3 +373,15 @@ print_usage (void) | |||
350 | printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | 373 | printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ |
351 | [-t timeout] [-r retries] [-e expect]\n", progname); | 374 | [-t timeout] [-r retries] [-e expect]\n", progname); |
352 | } | 375 | } |
376 | |||
377 | |||
378 | |||
379 | int my_rc_read_config(char * a) | ||
380 | { | ||
381 | #ifdef HAVE_LIBRADIUSCLIENT_NG | ||
382 | rch = rc_read_config(a); | ||
383 | return (rch == NULL) ? 1 : 0; | ||
384 | #else | ||
385 | return rc_read_config(a); | ||
386 | #endif | ||
387 | } | ||