Add strip domain plugin

This commit is contained in:
David Parrish 2004-09-02 04:29:30 +00:00
parent f9982099ef
commit a109954b2c
3 changed files with 34 additions and 3 deletions

View file

@ -16,6 +16,7 @@
- Make autothrottle.so understand cisco lcp:interface-config - Yuri - Make autothrottle.so understand cisco lcp:interface-config - Yuri
- Show filter stats in show session - Yuri - Show filter stats in show session - Yuri
- Cleanup from Michael to change sid to unique_id - 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 <bod@optusnet.com.au> 2.0.1 * Tue Jul 13 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.1
- Update INSTALL, Docs/manual.html documentation. - Update INSTALL, Docs/manual.html documentation.

View file

@ -27,12 +27,13 @@ OBJS= md5.o \
tbf.o \ tbf.o \
bgp.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: clean:
/bin/rm -f *.o *.so l2tpns nsctl /bin/rm -f *.o *.so $(TARGETS)
depend: depend:
(sed -n 'p; /^## Dependencies: (autogenerated) ##/q' Makefile && \ (sed -n 'p; /^## Dependencies: (autogenerated) ##/q' Makefile && \

29
stripdomain.c Normal file
View file

@ -0,0 +1,29 @@
#include <string.h>
#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;
}