diff options
Diffstat (limited to 'web/attachments/280540-check_radius.c.diff')
-rw-r--r-- | web/attachments/280540-check_radius.c.diff | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/web/attachments/280540-check_radius.c.diff b/web/attachments/280540-check_radius.c.diff new file mode 100644 index 0000000..94052ab --- /dev/null +++ b/web/attachments/280540-check_radius.c.diff | |||
@@ -0,0 +1,95 @@ | |||
1 | --- nagios-plugins-1.4.12.orig/plugins/check_radius.c 2008-06-06 13:54:31.000000000 +0200 | ||
2 | +++ nagios-plugins-1.4.12/plugins/check_radius.c 2008-06-06 14:08:00.000000000 +0200 | ||
3 | @@ -73,6 +73,7 @@ | ||
4 | char *username = NULL; | ||
5 | char *password = NULL; | ||
6 | char *nasid = NULL; | ||
7 | +char *nasipaddress = NULL; | ||
8 | char *expect = NULL; | ||
9 | char *config_file = NULL; | ||
10 | unsigned short port = PW_AUTH_UDP_PORT; | ||
11 | @@ -173,19 +174,26 @@ | ||
12 | memset (&data, 0, sizeof(data)); | ||
13 | if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
14 | my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
15 | - my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
16 | - (nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
17 | + my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) | ||
18 | + )) | ||
19 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
20 | |||
21 | - /* | ||
22 | - * Fill in NAS-IP-Address | ||
23 | - */ | ||
24 | - | ||
25 | - if ((client_id = my_rc_own_ipaddress ()) == 0) | ||
26 | - return (ERROR_RC); | ||
27 | + if (nasid != NULL) { | ||
28 | + if (!(my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))) | ||
29 | + die (STATE_UNKNOWN, _("Invalid NAS-Identifier")); | ||
30 | + } | ||
31 | |||
32 | - if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
33 | - NULL) return (ERROR_RC); | ||
34 | + if (nasipaddress != NULL) { | ||
35 | + if (rc_good_ipaddr (nasipaddress)) | ||
36 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
37 | + if ((client_id = rc_get_ipaddr(nasipaddress)) == 0) | ||
38 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
39 | + } else { | ||
40 | + if ((client_id = my_rc_own_ipaddress ()) == 0) | ||
41 | + die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address")); | ||
42 | + } | ||
43 | + if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL) | ||
44 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
45 | |||
46 | my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
47 | retries); | ||
48 | @@ -223,6 +231,7 @@ | ||
49 | {"username", required_argument, 0, 'u'}, | ||
50 | {"password", required_argument, 0, 'p'}, | ||
51 | {"nas-id", required_argument, 0, 'n'}, | ||
52 | + {"nas-ip-address", required_argument, 0, 'N'}, | ||
53 | {"filename", required_argument, 0, 'F'}, | ||
54 | {"expect", required_argument, 0, 'e'}, | ||
55 | {"retries", required_argument, 0, 'r'}, | ||
56 | @@ -234,7 +243,7 @@ | ||
57 | }; | ||
58 | |||
59 | while (1) { | ||
60 | - c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts, | ||
61 | + c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, | ||
62 | &option); | ||
63 | |||
64 | if (c == -1 || c == EOF || c == 1) | ||
65 | @@ -279,6 +288,9 @@ | ||
66 | case 'n': /* nas id */ | ||
67 | nasid = optarg; | ||
68 | break; | ||
69 | + case 'N': /* nas ip address */ | ||
70 | + nasipaddress = optarg; | ||
71 | + break; | ||
72 | case 'F': /* configuration file */ | ||
73 | config_file = optarg; | ||
74 | break; | ||
75 | @@ -342,6 +354,8 @@ | ||
76 | printf (" %s\n", _("Password for autentication (SECURITY RISK)")); | ||
77 | printf (" %s\n", "-n, --nas-id=STRING"); | ||
78 | printf (" %s\n", _("NAS identifier")); | ||
79 | + printf (" %s\n", "-N, --nas-ip-address=STRING"); | ||
80 | + printf (" %s\n", _("NAS IP Address")); | ||
81 | printf (" %s\n", "-F, --filename=STRING"); | ||
82 | printf (" %s\n", _("Configuration file")); | ||
83 | printf (" %s\n", "-e, --expect=STRING"); | ||
84 | @@ -377,8 +391,9 @@ | ||
85 | print_usage (void) | ||
86 | { | ||
87 | printf (_("Usage:")); | ||
88 | - printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | ||
89 | - [-t timeout] [-r retries] [-e expect]\n", progname); | ||
90 | + printf ("%s -H host -F config_file -u username -p password\n\ | ||
91 | + [-P port] [-t timeout] [-r retries] [-e expect]\n\ | ||
92 | + [-n nas-id] [-N nas-ip-addr]\n", progname); | ||
93 | } | ||
94 | |||
95 | |||