From: bodea Date: Thu, 2 Jun 2005 04:04:07 +0000 (+0000) Subject: add "allow_duplicate_users" config option X-Git-Tag: release_2_1_0~12 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/47de707495eac6c160ba40bdb8743838d0a929d9?ds=inline;hp=c03782046a6436da4bdce706318b95905fc99455 add "allow_duplicate_users" config option --- diff --git a/Docs/manual.html b/Docs/manual.html index e4cc1a5..ad4bbec 100644 --- a/Docs/manual.html +++ b/Docs/manual.html @@ -223,6 +223,17 @@ This secret will be used in all RADIUS queries. If this is not set then RADIUS queries will fail. +
  • radius_authtypes (string)
    +A comma separated list of supported RADIUS authentication methods +(pap or chap), in order of preference (default pap). +
  • + +
  • allow_duplicate_users (boolean)
    +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. +
  • +
  • bind_address (ip 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 diff --git a/Docs/startup-config.5 b/Docs/startup-config.5 index 71d5981..ccdfa64 100644 --- a/Docs/startup-config.5 +++ b/Docs/startup-config.5 @@ -2,7 +2,7 @@ .de Id .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" .SH NAME 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 ("pap" or "chap"), in order of preference (default "pap"). .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 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 diff --git a/l2tpns.c b/l2tpns.c index a592ff6..5ba7fe9 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // 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 #include @@ -113,6 +113,7 @@ config_descriptt config_values[] = { CONFIG("radius_interim", radius_interim, INT), CONFIG("radius_secret", radiussecret, STRING), CONFIG("radius_authtypes", radius_authtypes_s, STRING), + CONFIG("allow_duplicate_users", allow_duplicate_users, BOOL), CONFIG("bind_address", bind_address, IPv4), CONFIG("peer_address", peer_address, IPv4), 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++) { if (i == s) continue; - if (ip == session[i].ip) sessionkill(i, "Duplicate IP address"); - if (!session[s].walled_garden && !session[i].walled_garden && strcasecmp(user, session[i].user) == 0) + if (!session[s].opened) continue; + 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"); } } diff --git a/l2tpns.h b/l2tpns.h index 8ac0a7f..056becb 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -1,5 +1,5 @@ // 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__ #define __L2TPNS_H__ @@ -458,6 +458,8 @@ typedef struct int radius_authtypes; int radius_authprefer; + int allow_duplicate_users; // allow multiple logins with the same username + in_addr_t default_dns1, default_dns2; unsigned long rl_rate; // default throttle rate