From b22b76e7f5201017928ef11b143cb7583b6c5a64 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 27 Nov 2013 12:36:51 -0500 Subject: [PATCH] bug #4158 Events page says no privileges with ALL PRIVILEGES --- ChangeLog | 1 + libraries/Util.class.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 52224dcf5fde..e02e51740e12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ phpMyAdmin - ChangeLog - bug #4075 Support A10 Networks load balancer - bug #4083 row deleting isn't binlogs friendly - bug #4163 Setup script does not recognize manually-configured server +- bug #4158 Events page says no privileges with ALL PRIVILEGES 4.0.9.0 (2013-11-04) - bug #4104 Can't edit updatable view when searching diff --git a/libraries/Util.class.php b/libraries/Util.class.php index c6bc407dca85..36ce7a1d5c87 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -3926,7 +3926,15 @@ public static function currentUserHasPrivilege($priv, $db = null, $tbl = null) if ($db !== null) { // need to escape wildcards in db and table names, see bug #3518484 $db = str_replace(array('%', '_'), array('\%', '\_'), $db); - $query .= " AND TABLE_SCHEMA='%s'"; + /* + * This is to take into account a wildcard db privilege + * so we replace % by .* and _ by . to be able to compare + * with REGEXP. + * + * Also, we need to double the inner % to please sprintf(). + */ + $query .= " AND '%s' REGEXP" + . " REPLACE(REPLACE(TABLE_SCHEMA, '_', '.'), '%%', '.*')"; $schema_privileges = PMA_DBI_fetch_value( sprintf( $query,