diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-06-22 14:10:38 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-06-22 14:10:38 +0200 |
| commit | c0311d98481b783f1d24dd6c59fe25ce994a090d (patch) | |
| tree | dafb02e27d2000fabcca60ac096a5f5368973c83 /plugins | |
| parent | 22e7b78685747ded288642f25fefee7c57d3645a (diff) | |
| download | monitoring-plugins-c0311d98481b783f1d24dd6c59fe25ce994a090d.tar.gz | |
check_radius: Support FreeRADIUS Client library
Allow for using the FreeRADIUS Client library instead of radiusclient or
radiusclient-ng. The latter two projects are dead.
Closes #1231.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_radius.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 3481f0cc..9394d26d 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
| @@ -36,9 +36,10 @@ 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 | #ifdef HAVE_LIBRADIUSCLIENT_NG | 39 | #if defined(HAVE_LIBFREERADIUS_CLIENT) |
| 40 | #include <freeradius-client.h> | ||
| 41 | #elif defined(HAVE_LIBRADIUSCLIENT_NG) | ||
| 40 | #include <radiusclient-ng.h> | 42 | #include <radiusclient-ng.h> |
| 41 | rc_handle *rch = NULL; | ||
| 42 | #else | 43 | #else |
| 43 | #include <radiusclient.h> | 44 | #include <radiusclient.h> |
| 44 | #endif | 45 | #endif |
| @@ -47,11 +48,14 @@ int process_arguments (int, char **); | |||
| 47 | void print_help (void); | 48 | void print_help (void); |
| 48 | void print_usage (void); | 49 | void print_usage (void); |
| 49 | 50 | ||
| 50 | /* libradiusclient(-ng) wrapper functions */ | 51 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) |
| 51 | #ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 52 | #define my_rc_conf_str(a) rc_conf_str(rch,a) | 52 | #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) | 53 | #define my_rc_send_server(a,b) rc_send_server(rch,a,b) |
| 54 | #ifdef HAVE_LIBFREERADIUS_CLIENT | ||
| 55 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f) | ||
| 56 | #else | ||
| 54 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) | 57 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) |
| 58 | #endif | ||
| 55 | #define my_rc_own_ipaddress() rc_own_ipaddress(rch) | 59 | #define my_rc_own_ipaddress() rc_own_ipaddress(rch) |
| 56 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d) | 60 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d) |
| 57 | #define my_rc_read_dictionary(a) rc_read_dictionary(rch, a) | 61 | #define my_rc_read_dictionary(a) rc_read_dictionary(rch, a) |
| @@ -72,6 +76,10 @@ void print_usage (void); | |||
| 72 | 76 | ||
| 73 | int my_rc_read_config(char *); | 77 | int my_rc_read_config(char *); |
| 74 | 78 | ||
| 79 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) | ||
| 80 | rc_handle *rch = NULL; | ||
| 81 | #endif | ||
| 82 | |||
| 75 | char *server = NULL; | 83 | char *server = NULL; |
| 76 | char *username = NULL; | 84 | char *username = NULL; |
| 77 | char *password = NULL; | 85 | char *password = NULL; |
| @@ -142,11 +150,10 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
| 142 | int | 150 | int |
| 143 | main (int argc, char **argv) | 151 | main (int argc, char **argv) |
| 144 | { | 152 | { |
| 145 | UINT4 service; | ||
| 146 | char msg[BUFFER_LEN]; | 153 | char msg[BUFFER_LEN]; |
| 147 | SEND_DATA data; | 154 | SEND_DATA data; |
| 148 | int result = STATE_UNKNOWN; | 155 | int result = STATE_UNKNOWN; |
| 149 | UINT4 client_id; | 156 | uint32_t client_id, service; |
| 150 | char *str; | 157 | char *str; |
| 151 | 158 | ||
| 152 | setlocale (LC_ALL, ""); | 159 | setlocale (LC_ALL, ""); |
| @@ -392,7 +399,7 @@ print_usage (void) | |||
| 392 | 399 | ||
| 393 | int my_rc_read_config(char * a) | 400 | int my_rc_read_config(char * a) |
| 394 | { | 401 | { |
| 395 | #ifdef HAVE_LIBRADIUSCLIENT_NG | 402 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) |
| 396 | rch = rc_read_config(a); | 403 | rch = rc_read_config(a); |
| 397 | return (rch == NULL) ? 1 : 0; | 404 | return (rch == NULL) ? 1 : 0; |
| 398 | #else | 405 | #else |
