From: jdegraeve Date: Tue, 28 Mar 2006 09:03:32 +0000 (+0000) Subject: Change wrap of ruleno to make it safe for CP allow ip addresses X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90ee6c0497b4821c85234984ae095bd0df1fc99c;p=m0n0chwall.git Change wrap of ruleno to make it safe for CP allow ip addresses git-svn-id: https://svn.m0n0.ch/wall/trunk@112 e36fee2c-cc09-0410-a7cc-ebac5c6737de --- diff --git a/captiveportal/index.php b/captiveportal/index.php index d6dbb72..0611ca1 100755 --- a/captiveportal/index.php +++ b/captiveportal/index.php @@ -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); }