diff options
Diffstat (limited to 'web/attachments/279258-check_radius.c.diff')
-rw-r--r-- | web/attachments/279258-check_radius.c.diff | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/web/attachments/279258-check_radius.c.diff b/web/attachments/279258-check_radius.c.diff new file mode 100644 index 0000000..051dc4d --- /dev/null +++ b/web/attachments/279258-check_radius.c.diff | |||
@@ -0,0 +1,94 @@ | |||
1 | --- check_radius.c.orig 2008-05-28 00:31:54.000000000 +0200 | ||
2 | +++ check_radius.c 2008-05-28 00:29:27.000000000 +0200 | ||
3 | @@ -53,6 +53,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 | @@ -149,19 +150,26 @@ | ||
12 | |||
13 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
14 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
15 | - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
16 | - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
17 | + 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 = rc_own_ipaddress ()) == 0) | ||
26 | - return (ERROR_RC); | ||
27 | - | ||
28 | - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
29 | - NULL) return (ERROR_RC); | ||
30 | + if (nasid != NULL) { | ||
31 | + if (!(rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))) | ||
32 | + die (STATE_UNKNOWN, _("Invalid NAS-Identifier")); | ||
33 | + } | ||
34 | + | ||
35 | + if (nasipaddress != NULL) { | ||
36 | + if (rc_good_ipaddr (nasipaddress)) | ||
37 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
38 | + if ((client_id = rc_get_ipaddr(nasipaddress)) == 0) | ||
39 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
40 | + } else { | ||
41 | + if ((client_id = rc_own_ipaddress ()) == 0) | ||
42 | + die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address")); | ||
43 | + } | ||
44 | + if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL) | ||
45 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
46 | |||
47 | rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
48 | retries); | ||
49 | @@ -199,6 +207,7 @@ | ||
50 | {"username", required_argument, 0, 'u'}, | ||
51 | {"password", required_argument, 0, 'p'}, | ||
52 | {"nas-id", required_argument, 0, 'n'}, | ||
53 | + {"nas-ip-address", required_argument, 0, 'N'}, | ||
54 | {"filename", required_argument, 0, 'F'}, | ||
55 | {"expect", required_argument, 0, 'e'}, | ||
56 | {"retries", required_argument, 0, 'r'}, | ||
57 | @@ -234,7 +243,7 @@ | ||
58 | } | ||
59 | |||
60 | while (1) { | ||
61 | - c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts, | ||
62 | + c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, | ||
63 | &option); | ||
64 | |||
65 | if (c == -1 || c == EOF || c == 1) | ||
66 | @@ -273,6 +282,9 @@ | ||
67 | case 'n': /* nas id */ | ||
68 | nasid = optarg; | ||
69 | break; | ||
70 | + case 'N': /* nas ip address */ | ||
71 | + nasipaddress = optarg; | ||
72 | + break; | ||
73 | case 'F': /* configuration file */ | ||
74 | config_file = optarg; | ||
75 | break; | ||
76 | @@ -325,6 +337,8 @@ | ||
77 | printf (" %s\n", _("Password for autentication (SECURITY RISK)")); | ||
78 | printf (" %s\n", "-n, --nas-id=STRING"); | ||
79 | printf (" %s\n", _("NAS identifier")); | ||
80 | + printf (" %s\n", "-N, --nas-ip-address=STRING"); | ||
81 | + printf (" %s\n", _("NAS IP Address")); | ||
82 | printf (" %s\n", "-F, --filename=STRING"); | ||
83 | printf (" %s\n", _("Configuration file")); | ||
84 | printf (" %s\n", "-e, --expect=STRING"); | ||
85 | @@ -354,6 +368,7 @@ | ||
86 | print_usage (void) | ||
87 | { | ||
88 | printf (_("Usage:")); | ||
89 | - printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | ||
90 | - [-t timeout] [-r retries] [-e expect]\n", progname); | ||
91 | + printf ("%s -H host -F config_file -u username -p password\n\ | ||
92 | + [-P port] [-t timeout] [-r retries] [-e expect]\n\ | ||
93 | + [-n nas-id] [-N nas-ip-addr]\n", progname); | ||
94 | } | ||