summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-28 19:16:24 +0000
committerErmal <eri@pfsense.org>2010-05-28 19:16:24 +0000
commit1c291e64f1273d2dc9a9d0ef5f714468b4ed49e7 (patch)
treef9198d53be0125898dd43a82fe3cc9c376043369 /usr
parent9a31a1cefa6f0437bd5e2ac3bec39e0defc688b7 (diff)
downloadpfsense-1c291e64f1273d2dc9a9d0ef5f714468b4ed49e7.zip
pfsense-1c291e64f1273d2dc9a9d0ef5f714468b4ed49e7.tar.gz
Add the username to the auto added mac passthrough entry. Add an option to services->captiveportal page to activate/deactivate the auto-saving of username with the auto added mac passthrough.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/captiveportal/index.php15
-rwxr-xr-xusr/local/www/services_captiveportal.php10
2 files changed, 23 insertions, 2 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index b019b00..52d177a 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -286,7 +286,18 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
$remaining_time = $attributes['session_timeout'];
/* Find an existing session */
- for ($i = 0; $i < count($cpdb); $i++) {
+ if ((isset($config['captiveportal']['noconcurrentlogins'])) && $passthrumac) {
+ if (isset($config['captiveportal']['passthrumacadd'])) {
+ $mac = captiveportal_passthrumac_findbyname($username);
+ if (!empty($mac)) {
+ portal_reply_page($redirurl, "error", "Username: {$username} is known with another mac address.");
+ exit;
+ }
+ }
+ }
+
+ $nousers = count($cpdb);
+ for ($i = 0; $i < $nousers; $i++) {
/* on the same ip */
if($cpdb[$i][2] == $clientip) {
captiveportal_logportalauth($cpdb[$i][4],$cpdb[$i][3],$cpdb[$i][2],"CONCURRENT LOGIN - REUSING OLD SESSION");
@@ -342,6 +353,8 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
if ($passthrumac) {
$mac = array();
$mac['mac'] = $clientmac;
+ if (isset($config['captiveportal']['passthrumacaddusername']))
+ $mac['username'] = $username;
$mac['descr'] = "Auto added pass-through MAC for user {$username}";
if (!empty($bw_up))
$mac['bw_up'] = $bw_up;
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index 6b024d3..8d79eb2 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -93,6 +93,7 @@ $pconfig['radiuskey2'] = $config['captiveportal']['radiuskey2'];
$pconfig['radiusvendor'] = $config['captiveportal']['radiusvendor'];
$pconfig['radiussession_timeout'] = isset($config['captiveportal']['radiussession_timeout']);
$pconfig['passthrumacadd'] = isset($config['captiveportal']['passthrumacadd']);
+$pconfig['passthrumacaddusername'] = isset($config['captiveportal']['passthrumacaddusername']);
$pconfig['radmac_format'] = $config['captiveportal']['radmac_format'];
if ($_POST) {
@@ -194,6 +195,7 @@ if ($_POST) {
$config['captiveportal']['radiusvendor'] = $_POST['radiusvendor'] ? $_POST['radiusvendor'] : false;
$config['captiveportal']['radiussession_timeout'] = $_POST['radiussession_timeout'] ? true : false;
$config['captiveportal']['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false;
+ $config['captiveportal']['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false;
$config['captiveportal']['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
/* file upload? */
@@ -370,7 +372,13 @@ to access after they've authenticated.</td>
<strong>Enable Pass-through MAC automatic additions</strong><br>
If this option is set, a MAC passthrough entry is automatically added after the user has successfully authenticated. Users of that MAC address will never have to authenticate again.
To remove the passthrough MAC entry you either have to log in and remove it manually from the <a href="services_captiveportal_mac.php">Pass-through MAC tab</a> or send a POST from another system to remove it.
- If this is enabled, RADIUS MAC authentication cannot be used. Also, the logout window will not be shown.</td>
+ If this is enabled, RADIUS MAC authentication cannot be used. Also, the logout window will not be shown.
+ <br/><br/>
+ <input name="passthrumacaddusername" type="checkbox" class="formfld" id="passthrumacaddusername" value="yes" <?php if ($pconfig['passthrumacaddusername']) echo "checked"; ?>>
+ <strong>Enable Pass-through MAC automatic addition with username</strong><br>
+ If this option is set, with the automatically MAC passthrough entry created the username, used during authentication, will be saved.
+ To remove the passthrough MAC entry you either have to log in and remove it manually from the <a href="services_captiveportal_mac.php">Pass-through MAC tab</a> or send a POST from another system to remove it.
+ </td>
</tr>
<tr>
<td valign="top" class="vncell">Per-user bandwidth restriction</td>
OpenPOWER on IntegriCloud