]> git.gsnw.org Git - m0n0chwall.git/commitdiff
Change wrap of ruleno to make it safe for CP allow ip addresses
authorjdegraeve <jdegraeve@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Tue, 28 Mar 2006 09:03:32 +0000 (09:03 +0000)
committerjdegraeve <jdegraeve@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Tue, 28 Mar 2006 09:03:32 +0000 (09:03 +0000)
git-svn-id: https://svn.m0n0.ch/wall/trunk@112 e36fee2c-cc09-0410-a7cc-ebac5c6737de

captiveportal/index.php

index d6dbb725fde7e4d25ad412c3cf876a2b5faf4d3d..0611ca1b100f03f9e693c0585e4cf6a61ac44b38 100755 (executable)
@@ -298,12 +298,15 @@ function portal_allow($clientip,$clientmac,$clientuser,$password = null, $attrib
     /* rewrite information to database */
     captiveportal_write_db($cpdb);
 
+    /* Builtin wrap safety for allowedip */
+    $allowedipno = (is_array($config['captiveportal']['allowedip'])) ? count($config['captiveportal']['allowedip']) : 0;
+
     /* write next rule number */
     $fd = @fopen("{$g['vardb_path']}/captiveportal.nextrule", "w");
     if ($fd) {
         $ruleno++;
         if ($ruleno > 19899)
-            $ruleno = 10000;    /* wrap around */
+            $ruleno = 10000 + $allowedipno;    /* wrap around */
         fwrite($fd, $ruleno);
         fclose($fd);
     }