bug #1826022 [privileges] unable to add user (MySQL 3.23) since PMA 2.11.2

This commit is contained in:
Marc Delisle
2007-11-07 12:46:56 +00:00
parent 9a19ae7fa8
commit 18a9fe81c1
3 changed files with 15 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1817224 [import] Incorrect detection of file_uploads in some cases,
thanks to Juergen Wind
- bug #1777249 [display] Do not underline links in left panel (in default
themes)
- bug #1826022 [privileges] unable to add user (MySQL 3.23) since PMA 2.11.2
2.11.2.0 (2007-10-27)
- patch #1791576 HTTP auth: support REDIRECT_REMOTE_USER, thanks to Allard

View File

@@ -572,7 +572,7 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
*
* @access private
*/
function PMA_convert_using($string, $mode='unquoted')
function PMA_convert_using($string, $mode='unquoted', $force_utf8 = false)
{
if ($mode == 'quoted') {
$possible_quote = "'";
@@ -581,8 +581,14 @@ function PMA_convert_using($string, $mode='unquoted')
}
if (PMA_MYSQL_INT_VERSION >= 40100) {
list($conn_charset) = explode('_', $GLOBALS['collation_connection']);
$converted_string = "CONVERT(" . $possible_quote . $string . $possible_quote . " USING " . $conn_charset . ")";
if ($force_utf8) {
$charset = 'utf8';
$collate = ' COLLATE utf8_bin';
} else {
list($charset) = explode('_', $GLOBALS['collation_connection']);
$collate = '';
}
$converted_string = "CONVERT(" . $possible_quote . $string . $possible_quote . " USING " . $charset . ")" . $collate;
} else {
$converted_string = $possible_quote . $string . $possible_quote;
}

View File

@@ -749,11 +749,12 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
}
$res = PMA_DBI_query(
'SELECT \'foo\' FROM `mysql`.`user`'
.' WHERE CONVERT(`User` USING utf8) COLLATE utf8_bin '
.' = CONVERT(\'' . PMA_sqlAddslashes($username) . '\' USING utf8) COLLATE utf8_bin '
.' AND CONVERT(`Host` USING utf8) COLLATE utf8_bin '
.' = CONVERT(\'' . PMA_sqlAddslashes($hostname) . '\' USING utf8) COLLATE utf8_bin ;',
.' WHERE ' . PMA_convert_using('User', 'unquoted', true)
.' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted', true)
.' AND ' . PMA_convert_using('Host', 'unquoted', true)
.' = ' . PMA_convert_using($hostname, 'quoted', true) . ';',
null, PMA_DBI_QUERY_STORE);
if (PMA_DBI_num_rows($res) == 1) {
PMA_DBI_free_result($res);
$message = sprintf($GLOBALS['strUserAlreadyExists'], '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]');