Allow sessions to have a max lifetime

This commit is contained in:
Jamie Cameron 2025-05-19 22:18:33 -07:00
parent c126e9f93e
commit 693f3c792e

View File

@ -1101,16 +1101,22 @@ while(1) {
print $outfd "0 0\n"; print $outfd "0 0\n";
} }
else { else {
local ($user, $ltime, $ip) = local ($user, $ltime, $ip, $lifetime) =
split(/\s+/, $sessiondb{$skey}); split(/\s+/, $sessiondb{$skey});
local $lot = &get_logout_time($user, $session_id); local $lot = &get_logout_time($user, $session_id);
if ($lot && if ($lot &&
$time_now - $ltime > $lot*60 && $time_now - $ltime > $lot*60 &&
!$notimeout) { !$notimeout) {
# Session has timed out # Session has timed out due to
# idle time being hit
print $outfd "1 ",($time_now - $ltime),"\n"; print $outfd "1 ",($time_now - $ltime),"\n";
#delete($sessiondb{$skey}); #delete($sessiondb{$skey});
} }
elsif ($lifetime && $time_now - $ltime > $lifetime) {
# Session has timed out due to
# lifetime exceeded
print $outfd "1 ",($time_now - $ltime),"\n";
}
elsif ($ip && $vip && $ip ne $vip && elsif ($ip && $vip && $ip ne $vip &&
$config{'session_ip'}) { $config{'session_ip'}) {
# Session was OK, but from the # Session was OK, but from the