X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fscripts%2Fcaptive-cleanup;h=b576df4fe59295373625f87483e542b415107871;hb=c94aa254759e544aa8dd50bb5c4c370ac97e78e6;hp=aae6f6064df42cb281463c94f4e003873783f6ee;hpb=e01c5ab71a78b4061cf98fd03be76112842a6bf2;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/src/scripts/captive-cleanup b/src/scripts/captive-cleanup index aae6f6064d..b576df4fe5 100755 --- a/src/scripts/captive-cleanup +++ b/src/scripts/captive-cleanup @@ -35,9 +35,18 @@ if (-f $settingsfile && -f $clients && ! -z $clients){ &General::readhasharray("$clients", \%clientshash); $time = time(); foreach my $key (keys %clientshash) { + # Skip unlimited access lines + next if ($clientshash{$key}[3] == 0); + $expiretime=($clientshash{$key}[2])+$clientshash{$key}[3]; if ($expiretime < $time){ - delete $clientshash{key}; + delete $clientshash{$key}; + my $exp = gmtime($expiretime); + &General::log("Captive", "Delete expired voucher $clientshash{$key}[4] expired on $exp. Remark: $clientshash{$key}[5]"); } } + &General::writehasharray("$clients", \%clientshash); + + # Reload firewall rules + system("/usr/local/bin/captivectrl"); }