]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/scripts/captive-cleanup
ipsec-interfaces: Fix typo in variable name
[people/pmueller/ipfire-2.x.git] / src / scripts / captive-cleanup
index aae6f6064df42cb281463c94f4e003873783f6ee..b576df4fe59295373625f87483e542b415107871 100755 (executable)
@@ -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");
 }