diff options
Diffstat (limited to 'plugins/check_radius.c')
| -rw-r--r-- | plugins/check_radius.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index cc846709..d26f7cf3 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
| @@ -56,7 +56,8 @@ static check_radius_config_wrapper process_arguments(int /*argc*/, char ** /*arg | |||
| 56 | static void print_help(void); | 56 | static void print_help(void); |
| 57 | void print_usage(void); | 57 | void print_usage(void); |
| 58 | 58 | ||
| 59 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) | 59 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || \ |
| 60 | defined(HAVE_LIBRADCLI) | ||
| 60 | # define my_rc_conf_str(a) rc_conf_str(rch, a) | 61 | # define my_rc_conf_str(a) rc_conf_str(rch, a) |
| 61 | # if defined(HAVE_LIBRADCLI) | 62 | # if defined(HAVE_LIBRADCLI) |
| 62 | # define my_rc_send_server(a, b) rc_send_server(rch, a, b, AUTH) | 63 | # define my_rc_send_server(a, b) rc_send_server(rch, a, b, AUTH) |
| @@ -157,12 +158,14 @@ int main(int argc, char **argv) { | |||
| 157 | 158 | ||
| 158 | check_radius_config config = tmp_config.config; | 159 | check_radius_config config = tmp_config.config; |
| 159 | 160 | ||
| 160 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) | 161 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || \ |
| 162 | defined(HAVE_LIBRADCLI) | ||
| 161 | rc_handle *rch = NULL; | 163 | rc_handle *rch = NULL; |
| 162 | #endif | 164 | #endif |
| 163 | 165 | ||
| 164 | char *str = strdup("dictionary"); | 166 | char *str = strdup("dictionary"); |
| 165 | if ((config.config_file && my_rc_read_config(config.config_file, &rch)) || my_rc_read_dictionary(my_rc_conf_str(str))) { | 167 | if ((config.config_file && my_rc_read_config(config.config_file, &rch)) || |
| 168 | my_rc_read_dictionary(my_rc_conf_str(str))) { | ||
| 166 | die(STATE_UNKNOWN, _("Config file error\n")); | 169 | die(STATE_UNKNOWN, _("Config file error\n")); |
| 167 | } | 170 | } |
| 168 | 171 | ||
| @@ -200,7 +203,8 @@ int main(int argc, char **argv) { | |||
| 200 | die(STATE_UNKNOWN, _("Invalid NAS-IP-Address\n")); | 203 | die(STATE_UNKNOWN, _("Invalid NAS-IP-Address\n")); |
| 201 | } | 204 | } |
| 202 | 205 | ||
| 203 | my_rc_buildreq(&data, PW_ACCESS_REQUEST, config.server, config.port, (int)timeout_interval, config.retries); | 206 | my_rc_buildreq(&data, PW_ACCESS_REQUEST, config.server, config.port, (int)timeout_interval, |
| 207 | config.retries); | ||
| 204 | 208 | ||
| 205 | #ifdef RC_BUFFER_LEN | 209 | #ifdef RC_BUFFER_LEN |
| 206 | char msg[RC_BUFFER_LEN]; | 210 | char msg[RC_BUFFER_LEN]; |
| @@ -251,13 +255,14 @@ int main(int argc, char **argv) { | |||
| 251 | 255 | ||
| 252 | /* process command-line arguments */ | 256 | /* process command-line arguments */ |
| 253 | check_radius_config_wrapper process_arguments(int argc, char **argv) { | 257 | check_radius_config_wrapper process_arguments(int argc, char **argv) { |
| 254 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, {"port", required_argument, 0, 'P'}, | 258 | static struct option longopts[] = { |
| 255 | {"username", required_argument, 0, 'u'}, {"password", required_argument, 0, 'p'}, | 259 | {"hostname", required_argument, 0, 'H'}, {"port", required_argument, 0, 'P'}, |
| 256 | {"nas-id", required_argument, 0, 'n'}, {"nas-ip-address", required_argument, 0, 'N'}, | 260 | {"username", required_argument, 0, 'u'}, {"password", required_argument, 0, 'p'}, |
| 257 | {"filename", required_argument, 0, 'F'}, {"expect", required_argument, 0, 'e'}, | 261 | {"nas-id", required_argument, 0, 'n'}, {"nas-ip-address", required_argument, 0, 'N'}, |
| 258 | {"retries", required_argument, 0, 'r'}, {"timeout", required_argument, 0, 't'}, | 262 | {"filename", required_argument, 0, 'F'}, {"expect", required_argument, 0, 'e'}, |
| 259 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, | 263 | {"retries", required_argument, 0, 'r'}, {"timeout", required_argument, 0, 't'}, |
| 260 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; | 264 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, |
| 265 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; | ||
| 261 | 266 | ||
| 262 | check_radius_config_wrapper result = { | 267 | check_radius_config_wrapper result = { |
| 263 | .errorcode = OK, | 268 | .errorcode = OK, |
| @@ -397,9 +402,11 @@ void print_help(void) { | |||
| 397 | printf("%s\n", _("name and password. A configuration file must be present. The format of")); | 402 | printf("%s\n", _("name and password. A configuration file must be present. The format of")); |
| 398 | printf("%s\n", _("the configuration file is described in the radiusclient library sources.")); | 403 | printf("%s\n", _("the configuration file is described in the radiusclient library sources.")); |
| 399 | printf("%s\n", _("The password option presents a substantial security issue because the")); | 404 | printf("%s\n", _("The password option presents a substantial security issue because the")); |
| 400 | printf("%s\n", _("password can possibly be determined by careful watching of the command line")); | 405 | printf("%s\n", |
| 406 | _("password can possibly be determined by careful watching of the command line")); | ||
| 401 | printf("%s\n", _("in a process listing. This risk is exacerbated because the plugin will")); | 407 | printf("%s\n", _("in a process listing. This risk is exacerbated because the plugin will")); |
| 402 | printf("%s\n", _("typically be executed at regular predictable intervals. Please be sure that")); | 408 | printf("%s\n", |
| 409 | _("typically be executed at regular predictable intervals. Please be sure that")); | ||
| 403 | printf("%s\n", _("the password used does not allow access to sensitive system resources.")); | 410 | printf("%s\n", _("the password used does not allow access to sensitive system resources.")); |
| 404 | 411 | ||
| 405 | printf(UT_SUPPORT); | 412 | printf(UT_SUPPORT); |
| @@ -414,7 +421,8 @@ void print_usage(void) { | |||
| 414 | } | 421 | } |
| 415 | 422 | ||
| 416 | int my_rc_read_config(char *config_file_name, rc_handle **rch) { | 423 | int my_rc_read_config(char *config_file_name, rc_handle **rch) { |
| 417 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) | 424 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || \ |
| 425 | defined(HAVE_LIBRADCLI) | ||
| 418 | *rch = rc_read_config(config_file_name); | 426 | *rch = rc_read_config(config_file_name); |
| 419 | return (rch == NULL) ? 1 : 0; | 427 | return (rch == NULL) ? 1 : 0; |
| 420 | #else | 428 | #else |
