From 3f655b442c996b7e3f933296011944593a0d8926 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 11 Aug 2011 11:44:20 -0400 Subject: Fix privilege matching so that it respects wildcards better, especially when leading. --- etc/inc/priv.inc | 6 ++++-- 1 file 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; -- cgit v1.1