Update changelog
[l2tpns.git] / stripdomain.c
1 #include <string.h>
2 #include <linux/rtnetlink.h>
3 #include <netinet/ip6.h>
4
5 #include "dhcp6.h"
6 #include "l2tpns.h"
7 #include "plugin.h"
8
9 /* strip domain part of username before sending RADIUS requests */
10
11 int plugin_api_version = PLUGIN_API_VERSION;
12 static struct pluginfuncs *f = 0;
13
14 int plugin_pre_auth(struct param_pre_auth *data)
15 {
16 char *p;
17
18 if (!data->continue_auth) return PLUGIN_RET_STOP;
19
20 // Strip off @domain
21 if ((p = strchr(data->username, '@')))
22 {
23 f->log(3, 0, 0, "Stripping off trailing domain name \"%s\"\n", p);
24 *p = 0;
25 }
26
27 return PLUGIN_RET_OK;
28 }
29
30 int plugin_init(struct pluginfuncs *funcs)
31 {
32 return ((f = funcs)) ? 1 : 0;
33 }