summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2004-03-18 20:31:52 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2004-03-18 20:31:52 +0000
commit9ec2c84dbf069fb3299b9ff3b11dc812550b5689 (patch)
tree2ab574cbb123cece54c0bf93c97b6be5f0d888ba
parent7433e4b73fb48d2486a48b38da50453adc367085 (diff)
downloadmonitoring-plugins-9ec2c84dbf069fb3299b9ff3b11dc812550b5689.tar.gz
Option to fill in NAS-identifier to Emulate pam_radius behaviour (Alexander Kulak)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@851 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_radius.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index d56222f9..ece17943 100644
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -33,6 +33,7 @@ void print_usage (void);
33char *server = NULL; 33char *server = NULL;
34char *username = NULL; 34char *username = NULL;
35char *password = NULL; 35char *password = NULL;
36char *nasid = NULL;
36char *expect = NULL; 37char *expect = NULL;
37char *config_file = NULL; 38char *config_file = NULL;
38unsigned short port = PW_AUTH_UDP_PORT; 39unsigned short port = PW_AUTH_UDP_PORT;
@@ -119,7 +120,8 @@ main (int argc, char **argv)
119 120
120 if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && 121 if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
121 rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && 122 rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
122 rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0))) 123 rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
124 (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
123 die (STATE_UNKNOWN, _("Out of Memory?")); 125 die (STATE_UNKNOWN, _("Out of Memory?"));
124 126
125 /* 127 /*
@@ -167,6 +169,7 @@ process_arguments (int argc, char **argv)
167 {"port", required_argument, 0, 'P'}, 169 {"port", required_argument, 0, 'P'},
168 {"username", required_argument, 0, 'u'}, 170 {"username", required_argument, 0, 'u'},
169 {"password", required_argument, 0, 'p'}, 171 {"password", required_argument, 0, 'p'},
172 {"nas-id", required_argument, 0, 'n'},
170 {"filename", required_argument, 0, 'F'}, 173 {"filename", required_argument, 0, 'F'},
171 {"expect", required_argument, 0, 'e'}, 174 {"expect", required_argument, 0, 'e'},
172 {"retries", required_argument, 0, 'r'}, 175 {"retries", required_argument, 0, 'r'},
@@ -202,7 +205,7 @@ process_arguments (int argc, char **argv)
202 } 205 }
203 206
204 while (1) { 207 while (1) {
205 c = getopt_long (argc, argv, "+hVvH:P:F:u:p:t:r:e:", longopts, 208 c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts,
206 &option); 209 &option);
207 210
208 if (c == -1 || c == EOF || c == 1) 211 if (c == -1 || c == EOF || c == 1)
@@ -242,6 +245,9 @@ process_arguments (int argc, char **argv)
242 case 'p': /* password */ 245 case 'p': /* password */
243 password = optarg; 246 password = optarg;
244 break; 247 break;
248 case 'n': /* nas id */
249 nasid = optarg;
250 break;
245 case 'F': /* configuration file */ 251 case 'F': /* configuration file */
246 config_file = optarg; 252 config_file = optarg;
247 break; 253 break;
@@ -294,6 +300,8 @@ print_help (void)
294 The user to authenticate\n\ 300 The user to authenticate\n\
295 -p, --password=STRING\n\ 301 -p, --password=STRING\n\
296 Password for autentication (SECURITY RISK)\n\ 302 Password for autentication (SECURITY RISK)\n\
303 -n, --nas-id=STRING\n\
304 NAS identifier\n\
297 -F, --filename=STRING\n\ 305 -F, --filename=STRING\n\
298 Configuration file\n\ 306 Configuration file\n\
299 -e, --expect=STRING\n\ 307 -e, --expect=STRING\n\
@@ -328,7 +336,7 @@ void
328print_usage (void) 336print_usage (void)
329{ 337{
330 printf ("\ 338 printf ("\
331Usage: %s -H host -F config_file -u username -p password [-P port]\n\ 339Usage: %s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\
332 [-t timeout] [-r retries] [-e expect]\n", progname); 340 [-t timeout] [-r retries] [-e expect]\n", progname);
333 printf (_(UT_HLP_VRS), progname, progname); 341 printf (_(UT_HLP_VRS), progname, progname);
334} 342}