summaryrefslogtreecommitdiffstats
path: root/web/attachments/240319-wrapper.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/240319-wrapper.patch')
-rw-r--r--web/attachments/240319-wrapper.patch146
1 files changed, 146 insertions, 0 deletions
diff --git a/web/attachments/240319-wrapper.patch b/web/attachments/240319-wrapper.patch
new file mode 100644
index 0000000..0d852ef
--- /dev/null
+++ b/web/attachments/240319-wrapper.patch
@@ -0,0 +1,146 @@
1--- check_radius_orig.c 2007-08-07 22:34:39.000000000 +0200
2+++ check_radius.c 2007-08-07 23:07:46.000000000 +0200
3@@ -43,12 +43,28 @@
4 #include "utils.h"
5 #include "netutils.h"
6
7+#ifdef HAVE_LIBRADIUSCLIENT_NG
8+#include <radiusclient-ng.h>
9+rc_handle *rch = NULL;
10+#else
11 #include <radiusclient.h>
12+#endif
13
14 int process_arguments (int, char **);
15 void print_help (void);
16 void print_usage (void);
17
18+/* libradiusclient(-ng) wrapper functions */
19+int my_rc_read_dictionary(const char *);
20+VALUE_PAIR *my_rc_avpair_add(VALUE_PAIR **, int, void *, int);
21+UINT4 my_rc_own_ipaddress();
22+void my_rc_buildreq(SEND_DATA *, int, char *, unsigned short, int, int);
23+int my_rc_send_server(SEND_DATA *, char *);
24+char *my_rc_conf_str(char *);
25+int my_rc_read_config(char *);
26+
27+
28+
29 char *server = NULL;
30 char *username = NULL;
31 char *password = NULL;
32@@ -133,33 +149,33 @@
33 usage4 (_("Could not parse arguments"));
34
35 str = strdup ("dictionary");
36- if ((config_file && rc_read_config (config_file)) ||
37- rc_read_dictionary (rc_conf_str (str)))
38+ if ((config_file && my_rc_read_config (config_file)) ||
39+ my_rc_read_dictionary (my_rc_conf_str (str)))
40 die (STATE_UNKNOWN, _("Config file error"));
41
42 service = PW_AUTHENTICATE_ONLY;
43
44 memset (&data, 0, sizeof(data));
45- if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
46- rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
47- rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
48- (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
49+ if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
50+ my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
51+ my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
52+ (nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
53 die (STATE_UNKNOWN, _("Out of Memory?"));
54
55 /*
56 * Fill in NAS-IP-Address
57 */
58
59- if ((client_id = rc_own_ipaddress ()) == 0)
60+ if ((client_id = my_rc_own_ipaddress ()) == 0)
61 return (ERROR_RC);
62
63- if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) ==
64+ if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) ==
65 NULL) return (ERROR_RC);
66
67- rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
68+ my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
69 retries);
70
71- result = rc_send_server (&data, msg);
72+ result = my_rc_send_server (&data, msg);
73 rc_avpair_free (data.send_pairs);
74 if (data.receive_pairs)
75 rc_avpair_free (data.receive_pairs);
76@@ -350,3 +366,70 @@
77 printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\
78 [-t timeout] [-r retries] [-e expect]\n", progname);
79 }
80+
81+
82+
83+
84+int my_rc_read_dictionary(const char * a)
85+{
86+#ifdef HAVE_LIBRADIUSCLIENT_NG
87+ return rc_read_dictionary(rch, a);
88+#else
89+ return rc_read_dictionary(a);
90+#endif
91+}
92+
93+VALUE_PAIR *my_rc_avpair_add(VALUE_PAIR ** a, int b, void * c, int d)
94+{
95+#ifdef HAVE_LIBRADIUSCLIENT_NG
96+ return rc_avpair_add(rch, a, b, c, -1, d);
97+#else
98+ return rc_avpair_add(a, b, c, d);
99+#endif
100+}
101+
102+UINT4 my_rc_own_ipaddress()
103+{
104+#ifdef HAVE_LIBRADIUSCLIENT_NG
105+ return rc_own_ipaddress(rch);
106+#else
107+ return rc_own_ipaddress();
108+#endif
109+}
110+
111+void my_rc_buildreq(SEND_DATA * a, int b, char * c, unsigned short d, int e, int f)
112+{
113+#ifdef HAVE_LIBRADIUSCLIENT_NG
114+ return rc_buildreq(rch, a, b, c, d, e, f);
115+#else
116+ return rc_buildreq(a, b, c, d, e, f);
117+#endif
118+}
119+
120+int my_rc_send_server(SEND_DATA * a, char * b)
121+{
122+#ifdef HAVE_LIBRADIUSCLIENT_NG
123+ return rc_send_server(rch, a, b);
124+#else
125+ return rc_send_server(a, b);
126+#endif
127+}
128+
129+int my_rc_read_config(char * a)
130+{
131+#ifdef HAVE_LIBRADIUSCLIENT_NG
132+ rch = rc_read_config(a);
133+ return (rch == NULL) ? 1 : 0;
134+#else
135+ return rc_read_config(a);
136+#endif
137+}
138+
139+char *my_rc_conf_str(char * a)
140+{
141+#ifdef HAVE_LIBRADIUSCLIENT_NG
142+ return rc_conf_str(rch, a);
143+#else
144+ return rc_conf_str(a);
145+#endif
146+}