add "allow_duplicate_users" config option

This commit is contained in:
bodea 2005-06-02 04:04:07 +00:00
parent c03782046a
commit 47de707495
4 changed files with 32 additions and 5 deletions

View file

@ -223,6 +223,17 @@ This secret will be used in all RADIUS queries. If this is not set then
RADIUS queries will fail. RADIUS queries will fail.
</LI> </LI>
<LI><B>radius_authtypes</B> (string)</BR>
A comma separated list of supported RADIUS authentication methods
(<B>pap</B> or <B>chap</B>), in order of preference (default <B>pap</B>).
</LI>
<LI><B>allow_duplicate_users</B> (boolean)</BR>
Allow multiple logins with the same username. If false (the default),
any prior session with the same username will be dropped when a new
session is established.
</LI>
<LI><B>bind_address</B> (ip address)<BR> <LI><B>bind_address</B> (ip address)<BR>
When the tun interface is created, it is assigned the address When the tun interface is created, it is assigned the address
specified here. If no address is given, 1.1.1.1 is used. Packets specified here. If no address is given, 1.1.1.1 is used. Packets

View file

@ -2,7 +2,7 @@
.de Id .de Id
.ds Dt \\$4 \\$5 .ds Dt \\$4 \\$5
.. ..
.Id $Id: startup-config.5,v 1.8 2005/05/26 12:17:31 bodea Exp $ .Id $Id: startup-config.5,v 1.9 2005/06/02 04:04:08 bodea Exp $
.TH STARTUP-CONFIG 5 "\*(Dt" L2TPNS "File Formats and Conventions" .TH STARTUP-CONFIG 5 "\*(Dt" L2TPNS "File Formats and Conventions"
.SH NAME .SH NAME
startup\-config \- configuration file for l2tpns startup\-config \- configuration file for l2tpns
@ -103,6 +103,11 @@ Secret to be used in RADIUS packets.
A comma separated list of supported RADIUS authentication methods A comma separated list of supported RADIUS authentication methods
("pap" or "chap"), in order of preference (default "pap"). ("pap" or "chap"), in order of preference (default "pap").
.TP .TP
.B allow_duplicate_users
Allow multiple logins with the same username. If false (the default),
any prior session with the same username will be dropped when a new
session is established.
.TP
.B bind_address .B bind_address
When the tun interface is created, it is assigned the address When the tun interface is created, it is assigned the address
specified here. If no address is given, 1.1.1.1 is used. Packets specified here. If no address is given, 1.1.1.1 is used. Packets

View file

@ -4,7 +4,7 @@
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
// vim: sw=8 ts=8 // vim: sw=8 ts=8
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.105 2005/05/26 12:17:30 bodea Exp $"; char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.106 2005/06/02 04:04:07 bodea Exp $";
#include <arpa/inet.h> #include <arpa/inet.h>
#include <assert.h> #include <assert.h>
@ -113,6 +113,7 @@ config_descriptt config_values[] = {
CONFIG("radius_interim", radius_interim, INT), CONFIG("radius_interim", radius_interim, INT),
CONFIG("radius_secret", radiussecret, STRING), CONFIG("radius_secret", radiussecret, STRING),
CONFIG("radius_authtypes", radius_authtypes_s, STRING), CONFIG("radius_authtypes", radius_authtypes_s, STRING),
CONFIG("allow_duplicate_users", allow_duplicate_users, BOOL),
CONFIG("bind_address", bind_address, IPv4), CONFIG("bind_address", bind_address, IPv4),
CONFIG("peer_address", peer_address, IPv4), CONFIG("peer_address", peer_address, IPv4),
CONFIG("send_garp", send_garp, BOOL), CONFIG("send_garp", send_garp, BOOL),
@ -4190,8 +4191,16 @@ int sessionsetup(tunnelidt t, sessionidt s)
for (i = 1; i <= config->cluster_highest_sessionid; i++) for (i = 1; i <= config->cluster_highest_sessionid; i++)
{ {
if (i == s) continue; if (i == s) continue;
if (ip == session[i].ip) sessionkill(i, "Duplicate IP address"); if (!session[s].opened) continue;
if (!session[s].walled_garden && !session[i].walled_garden && strcasecmp(user, session[i].user) == 0) if (ip == session[i].ip)
{
sessionkill(i, "Duplicate IP address");
continue;
}
if (config->allow_duplicate_users) continue;
if (session[s].walled_garden || session[i].walled_garden) continue;
if (!strcasecmp(user, session[i].user))
sessionkill(i, "Duplicate session for users"); sessionkill(i, "Duplicate session for users");
} }
} }

View file

@ -1,5 +1,5 @@
// L2TPNS Global Stuff // L2TPNS Global Stuff
// $Id: l2tpns.h,v 1.73 2005/05/26 12:17:30 bodea Exp $ // $Id: l2tpns.h,v 1.74 2005/06/02 04:04:07 bodea Exp $
#ifndef __L2TPNS_H__ #ifndef __L2TPNS_H__
#define __L2TPNS_H__ #define __L2TPNS_H__
@ -458,6 +458,8 @@ typedef struct
int radius_authtypes; int radius_authtypes;
int radius_authprefer; int radius_authprefer;
int allow_duplicate_users; // allow multiple logins with the same username
in_addr_t default_dns1, default_dns2; in_addr_t default_dns1, default_dns2;
unsigned long rl_rate; // default throttle rate unsigned long rl_rate; // default throttle rate