Skip to content

Commit

Permalink
while we're here, send named termination causes
Browse files Browse the repository at this point in the history
  • Loading branch information
miken32 committed Feb 15, 2013
1 parent 91ca7e9 commit 00109fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions etc/inc/captiveportal.inc
Expand Up @@ -630,15 +630,15 @@ function captiveportal_prune_old() {
if ($timeout) {
if (($pruning_time - $cpentry['allow_time']) >= $timeout) {
$timedout = true;
$term_cause = 5; // Session-Timeout
$term_cause = RADIUS_TERM_SESSION_TIMEOUT; // Session-Timeout
}
}

/* Session-Terminate-Time */
if (!$timedout && !empty($cpentry['session_terminate_time'])) {
if ($pruning_time >= $cpentry['session_terminate_time']) {
$timedout = true;
$term_cause = 5; // Session-Timeout
$term_cause = RADIUS_TERM_SESSION_TIMEOUT; // Session-Timeout
}
}

Expand All @@ -653,7 +653,7 @@ function captiveportal_prune_old() {
$lastact = $lastact ? $lastact : $cpentry['allow_time'];
if ($lastact && (($pruning_time - $lastact) >= $uidletimeout)) {
$timedout = true;
$term_cause = 4; // Idle-Timeout
$term_cause = RADIUS_TERM_IDLE_TIMEOUT; // Idle-Timeout
$stop_time = $lastact; // Entry added to comply with WISPr
}
}
Expand All @@ -662,7 +662,7 @@ function captiveportal_prune_old() {
if (!$timedout && isset($vcpcfg['enable']) && !empty($cpentry['session_timeout'])) {
if ($pruning_time >= ($cpentry['allow_time'] + $cpentry['session_timeout'])) {
$timedout = true;
$term_cause = 5; // Session-Timeout
$term_cause = RADIUS_TERM_SESSION_TIMEOUT; // Session-Timeout
$voucher_needs_sync = true;
}
}
Expand All @@ -671,7 +671,7 @@ function captiveportal_prune_old() {
if (!$timedout && isset($cpcfg['radiussession_timeout']) && !empty($cpentry['session_timeout'])) {
if ($pruning_time >= ($cpentry['allow_time'] + $cpentry['session_timeout'])) {
$timedout = true;
$term_cause = 5; // Session-Timeout
$term_cause = RADIUS_TERM_SESSION_TIMEOUT; // Session-Timeout
}
}

Expand All @@ -693,7 +693,7 @@ function captiveportal_prune_old() {
$radiusservers,
$cpentry['ip'], // clientip
$cpentry['mac'], // clientmac
10); // NAS Request
RADIUS_TERM_NAS_REQUEST); // NAS Request
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 1, $cpentry[2]);
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 2, $cpentry[2]);
RADIUS_ACCOUNTING_START($cpentry['pipeno'], // ruleno
Expand All @@ -718,7 +718,7 @@ function captiveportal_prune_old() {
$radiusservers,
$cpentry['ip'], // clientip
$cpentry['mac'], // clientmac
10, // NAS Request
0,
true); // Interim Updates
}
}
Expand All @@ -733,7 +733,7 @@ function captiveportal_prune_old() {
$cpentry['mac'], // clientmac
$cpentry['pipeno']); // ruleno
if ($auth_list['auth_val'] == 3) {
captiveportal_disconnect($cpentry, $radiusservers, 17);
captiveportal_disconnect($cpentry, $radiusservers, RADIUS_TERM_NAS_REQUEST);
captiveportal_logportalauth($cpentry['username'], $cpentry['mac'], $cpentry['ip'], "RADIUS_DISCONNECT", $auth_list['reply_message']);
$unsetindexes[] = $cpentry['sessionid'];
} else if ($auth_list['auth_val'] == 2)
Expand Down Expand Up @@ -911,7 +911,7 @@ function captiveportal_radius_stop_all() {
$radiusservers[$cpentry['context']],
$cpentry['ip'], // clientip
$cpentry['mac'], // clientmac
7); // Admin Reboot
RADIUS_TERM_NAS_REBOOT); // Admin Reboot
}
}
}
Expand Down Expand Up @@ -1787,7 +1787,7 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
$remaining_time = 0;

/* This user was already logged in so we disconnect the old one */
captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],13);
captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],RADIUS_TERM_PORT_PREEMPTED);
captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - TERMINATING OLD SESSION");
$unsetindexes[] = $cpentry['sessionid'];
break;
Expand All @@ -1796,7 +1796,7 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
/* on the same username */
if (strcasecmp($cpentry['username'], $username) == 0) {
/* This user was already logged in so we disconnect the old one */
captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],13);
captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],RADIUS_TERM_PORT_PREEMPTED);
captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - TERMINATING OLD SESSION");
$unsetindexes[] = $cpentry['sessionid'];
break;
Expand Down
2 changes: 1 addition & 1 deletion usr/local/www/status_captiveportal.php
Expand Up @@ -50,7 +50,7 @@
$cpzone = $_POST['zone'];

if ($_GET['act'] == "del" && !empty($cpzone)) {
captiveportal_disconnect_client($_GET['id']);
captiveportal_disconnect_client($_GET['id'], RADIUS_TERM_ADMIN_RESET);
Header("Location: status_captiveportal.php?zone={$cpzone}");
exit;
}
Expand Down
Expand Up @@ -46,7 +46,7 @@

if (($_GET['act'] == "del") && (!empty($_GET['zone']))) {
$cpzone = $_GET['zone'];
captiveportal_disconnect_client($_GET['id']);
captiveportal_disconnect_client($_GET['id'], RADIUS_TERM_ADMIN_RESET);
}

flush();
Expand Down

0 comments on commit 00109fe

Please sign in to comment.