From a109954b2c321e4ac88557abf9fbbce27329dae5 Mon Sep 17 00:00:00 2001 From: David Parrish Date: Thu, 2 Sep 2004 04:29:30 +0000 Subject: [PATCH] Add strip domain plugin --- Changes | 1 + Makefile | 7 ++++--- stripdomain.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 stripdomain.c 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..2711912 --- /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; +} -- 2.20.1