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