diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-05-13 17:54:20 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-05-13 17:54:27 +0000 |
commit | acea2b1236e05ea53f414683e26db47afb902039 (patch) | |
tree | 8ab88f447157716b8e60cbc2b01bafe700a1390e /usr | |
parent | dfd7a44cab72d38a5c6385ca8ccfcdb189c6eff3 (diff) | |
download | pfsense-acea2b1236e05ea53f414683e26db47afb902039.zip pfsense-acea2b1236e05ea53f414683e26db47afb902039.tar.gz |
Fix lock leaking on portal_allow function.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/captiveportal/index.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 906397f..4c076a6 100755 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -197,8 +197,10 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut global $redirurl, $g, $config, $url_redirection, $type; /* See if a ruleno is passed, if not start locking the sessions because this means there isn't one atm */ + $captiveshouldunlock = false; if ($ruleno == null) { $cplock = lock('captiveportal'); + $captiveshouldunlock = true; $ruleno = captiveportal_get_next_ipfw_ruleno(); } @@ -206,7 +208,8 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut if (is_null($ruleno)) { portal_reply_page($redirurl, "error", "System reached maximum login capacity"); log_error("WARNING! Captive portal has reached maximum login capacity"); - unlock($cplock); + if ($captiveshouldunlock == true) + unlock($cplock); exit; } @@ -302,6 +305,8 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut /* rewrite information to database */ captiveportal_write_db($cpdb); + if ($captiveshouldunlock == true) + unlock($cplock); /* redirect user to desired destination */ if ($url_redirection) |