summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-08-11 11:44:20 -0400
committerjim-p <jimp@pfsense.org>2011-08-11 11:44:20 -0400
commit3f655b442c996b7e3f933296011944593a0d8926 (patch)
treebdeb3048b27cb4391896010b4616e31998a388d8
parenta020b6387ec881f9a939375b5db38b4ec871c503 (diff)
downloadpfsense-3f655b442c996b7e3f933296011944593a0d8926.zip
pfsense-3f655b442c996b7e3f933296011944593a0d8926.tar.gz
Fix privilege matching so that it respects wildcards better, especially when leading.
-rw-r--r--etc/inc/priv.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/priv.inc b/etc/inc/priv.inc
index f150aaf..16dd112 100644
--- a/etc/inc/priv.inc
+++ b/etc/inc/priv.inc
@@ -122,8 +122,10 @@ function cmp_page_matches($page, & $matches, $fullwc = true) {
$wcpos = strpos($match, "*");
if ($wcpos === false)
$result = strcmp($page, $match);
- else
- $result = strncmp($page, $match, $wcpos);
+ else {
+ $match = "/" . str_replace(array(".", "*"), array("\.", ".*"), $match) . "/";
+ $result = !preg_match($match, $page);
+ }
if (!$result)
return true;
OpenPOWER on IntegriCloud