From: fred_nerk Date: Thu, 2 Sep 2004 04:29:30 +0000 (+0000) Subject: Add strip domain plugin X-Git-Tag: release_2_0_2~5 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/f8f6e0d8516b17e39b531922cae12abc501a16ee?ds=inline Add strip domain plugin --- diff --git a/Changes b/Changes index bd8f94c..38586c1 100644 --- a/Changes +++ b/Changes @@ -16,6 +16,7 @@ - Make autothrottle.so understand cisco lcp:interface-config - Yuri - Show filter stats in show session - Yuri - Cleanup from Michael to change sid to unique_id +- Add plugin to remove domain name from auth requests * Tue Jul 13 2004 Brendan O'Dea 2.0.1 - Update INSTALL, Docs/manual.html documentation. diff --git a/Makefile b/Makefile index 9cad50b..015aa63 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,13 @@ OBJS= md5.o \ tbf.o \ bgp.o \ -PLUGINS=garden.so autothrottle.so autosnoop.so +PLUGINS=garden.so autothrottle.so autosnoop.so stripdomain.so +TARGETS=l2tpns nsctl generateload bounce $(PLUGINS) -all: l2tpns nsctl generateload bounce $(PLUGINS) +all: $(TARGETS) clean: - /bin/rm -f *.o *.so l2tpns nsctl + /bin/rm -f *.o *.so $(TARGETS) depend: (sed -n 'p; /^## Dependencies: (autogenerated) ##/q' Makefile && \ diff --git a/stripdomain.c b/stripdomain.c new file mode 100644 index 0000000..6af4076 --- /dev/null +++ b/stripdomain.c @@ -0,0 +1,29 @@ +#include +#include "l2tpns.h" +#include "plugin.h" + +char const *cvs_id = "$Id: stripdomain.c,v 1.1 2004/09/02 04:29:30 fred_nerk Exp $"; + +int __plugin_api_version = 1; +static struct pluginfuncs *p = 0; + +int plugin_pre_auth(struct param_pre_auth *data) +{ + char *x; + + if (!data->continue_auth) return PLUGIN_RET_STOP; + + // Strip off @domain + if ((x = strchr(data->username, '@'))) + { + p->log(3, 0, 0, 0, "Stripping off trailing domain name \"%s\"\n", x); + *x = 0; + } + + return PLUGIN_RET_OK; +} + +int plugin_init(struct pluginfuncs *funcs) +{ + return ((p = funcs)) ? 1 : 0; +}