From 90ee6c0497b4821c85234984ae095bd0df1fc99c Mon Sep 17 00:00:00 2001 From: jdegraeve Date: Tue, 28 Mar 2006 09:03:32 +0000 Subject: [PATCH] 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 --- captiveportal/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } -- 2.25.1