diff options
Diffstat (limited to 'web/attachments/240320-ifdef.patch')
-rw-r--r-- | web/attachments/240320-ifdef.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/web/attachments/240320-ifdef.patch b/web/attachments/240320-ifdef.patch new file mode 100644 index 0000000..983a1ce --- /dev/null +++ b/web/attachments/240320-ifdef.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | --- check_radius_orig.c 2007-08-07 22:34:39.000000000 +0200 | ||
2 | +++ check_radius_ifdef.c 2007-08-07 22:34:01.000000000 +0200 | ||
3 | @@ -42,8 +42,12 @@ | ||
4 | #include "common.h" | ||
5 | #include "utils.h" | ||
6 | #include "netutils.h" | ||
7 | - | ||
8 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
9 | +#include <radiusclient-ng.h> | ||
10 | +rc_handle *rch = NULL; | ||
11 | +#else | ||
12 | #include <radiusclient.h> | ||
13 | +#endif | ||
14 | |||
15 | int process_arguments (int, char **); | ||
16 | void print_help (void); | ||
17 | @@ -133,26 +137,49 @@ | ||
18 | usage4 (_("Could not parse arguments")); | ||
19 | |||
20 | str = strdup ("dictionary"); | ||
21 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
22 | + if ((config_file && ! (rch = rc_read_config (config_file))) || | ||
23 | + rc_read_dictionary (rch, rc_conf_str (rch, str))) | ||
24 | +#else | ||
25 | if ((config_file && rc_read_config (config_file)) || | ||
26 | rc_read_dictionary (rc_conf_str (str))) | ||
27 | +#endif | ||
28 | die (STATE_UNKNOWN, _("Config file error")); | ||
29 | |||
30 | service = PW_AUTHENTICATE_ONLY; | ||
31 | |||
32 | memset (&data, 0, sizeof(data)); | ||
33 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
34 | + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && | ||
35 | + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && | ||
36 | + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && | ||
37 | + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) | ||
38 | +#else | ||
39 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
40 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
41 | rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
42 | (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
43 | +#endif | ||
44 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
45 | |||
46 | /* | ||
47 | * Fill in NAS-IP-Address | ||
48 | */ | ||
49 | |||
50 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
51 | + if ((client_id = rc_own_ipaddress (rch)) == 0) | ||
52 | +#else | ||
53 | if ((client_id = rc_own_ipaddress ()) == 0) | ||
54 | +#endif | ||
55 | return (ERROR_RC); | ||
56 | |||
57 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
58 | + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id,-1, 0) == | ||
59 | + NULL) return (ERROR_RC); | ||
60 | + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
61 | + retries); | ||
62 | + result = rc_send_server (rch, &data, msg); | ||
63 | +#else | ||
64 | if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
65 | NULL) return (ERROR_RC); | ||
66 | |||
67 | @@ -160,6 +187,8 @@ | ||
68 | retries); | ||
69 | |||
70 | result = rc_send_server (&data, msg); | ||
71 | +#endif | ||
72 | + | ||
73 | rc_avpair_free (data.send_pairs); | ||
74 | if (data.receive_pairs) | ||
75 | rc_avpair_free (data.receive_pairs); | ||