From 01b1374bc4e7bc10268a89151087f610e7c41c79 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 23 Mar 2006 10:59:50 +0000 Subject: [PATCH] patch #1455286, catch 'permission denied' error on SHOW DATABASES --- ChangeLog | 2 ++ libraries/common.lib.php | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7f231e37..66ac40dc1 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2006-03-23 Marc Delisle * libraries/display_tbl.lib.php: bug #1444417 blobs are centered + * libraries/common.lib.php: patch #1455286, catch 'permission denied' + error on SHOW DATABASES, thanks to Bernard Dautrevaux - b-dautrevaux 2006-03-22 Alexander M. Turek * lang/spanish-*.inc.php: Updates, thanks to Daniel Hinostroza. diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 8657747d3..94eb0a5b6 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3137,13 +3137,16 @@ if (!defined('PMA_MINIMUM_COMMON')) { $local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\''; // here, a PMA_DBI_query() could fail silently // if SHOW DATABASES is disabled - $rs = PMA_DBI_try_query($local_query, $controllink); + $rs = PMA_DBI_try_query($local_query, $controllink); - if ($i == 0 - && (substr(PMA_DBI_getError($controllink), 1, 4) == 1045)) { - // "SHOW DATABASES" statement is disabled - $true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i])); - $is_show_dbs = false; + if ($i == 0 && ! $rs) { + $error_code = substr(PMA_DBI_getError($controllink), 1, 4); + if ($error_code == 1227 || $error_code == 1045) { + // "SHOW DATABASES" statement is disabled or not allowed to user + $true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i])); + $is_show_dbs = false; + } + unset($error_code); } // Debug // elseif (PMA_DBI_getError($controllink)) {