From e24e60df46599cf4150305f10cf27717bfecf13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 30 Sep 2001 08:32:03 +0000 Subject: [PATCH] fixed "backslashed backslash" before wildcards problem in databases names --- ChangeLog | 4 ++++ libraries/common.lib.php3 | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3121a5ec0..52f0dfdae 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-09-30 Loïc Chapeaux + * libraries/common.lib.php3, lines 489-493: fixed "backslashed backslash" + before wildcards problem in databases names. + 2001-09-29 Loïc Chapeaux * libraries/common.lib.php3: - fixed a possible problem with invalid keys values in the $uva_mydbs diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index be9ab8bb2..e5a1ef1e6 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -486,12 +486,11 @@ if (!defined('__LIB_COMMON__')){ reset($uva_mydbs); while (list($uva_matchpattern, $uva_value) = each($uva_mydbs)) { // loic1: fixed bad regexp - // TODO: - slash before wildcards - // may be itself slashed - // - db names may contain - // characters that are - // regexp instructions - $uva_regex = ereg_replace('[^\]%', '.*', ereg_replace('[^\]_', '.{1}', $uva_value)); + // TODO: db names may contain + // characters that are regexp + // instructions + $re = '(^|(\\\\\\\\)+|[^\])'; + $uva_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $uva_value)); // Fixed db name matching // 2000-08-28 -- Benjamin Gandon if (ereg('^' . $uva_regex . '$', $uva_row[0])) {