Bug #3403 Wrong encoding in SHOW GRANTS, EPLAIN SELECT output
This change fixes SHOW GRANTS problem, while EXPLAIN will be fixed in a separate patch.
This commit is contained in:
parent
9bf1be457a
commit
2fc1d5c146
@ -204,3 +204,27 @@ show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
|
||||
drop user mysqltest_1@localhost;
|
||||
SET NAMES koi8r;
|
||||
CREATE DATABASE ÂÄ;
|
||||
USE ÂÄ;
|
||||
CREATE TABLE ÔÁÂ (ËÏÌ int);
|
||||
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
|
||||
REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
|
||||
GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
||||
REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
||||
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
DROP DATABASE ÂÄ;
|
||||
SET NAMES latin1;
|
||||
|
@ -148,3 +148,26 @@ grant usage on *.* to mysqltest_1@localhost identified by "password";
|
||||
grant select, update, insert on test.* to mysqltest@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
#
|
||||
# Bug #3403 Wrong encodin in SHOW GRANTS output
|
||||
#
|
||||
SET NAMES koi8r;
|
||||
CREATE DATABASE ÂÄ;
|
||||
USE ÂÄ;
|
||||
CREATE TABLE ÔÁÂ (ËÏÌ int);
|
||||
|
||||
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
|
||||
|
||||
GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
|
||||
GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
|
||||
DROP DATABASE ÂÄ;
|
||||
SET NAMES latin1;
|
||||
|
@ -3064,7 +3064,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
|
||||
/* Add first global access grants */
|
||||
{
|
||||
String global(buff,sizeof(buff),&my_charset_latin1);
|
||||
String global(buff,sizeof(buff),system_charset_info);
|
||||
global.length(0);
|
||||
global.append("GRANT ",6);
|
||||
|
||||
@ -3089,7 +3089,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
}
|
||||
}
|
||||
global.append (" ON *.* TO '",12);
|
||||
global.append(lex_user->user.str,lex_user->user.length);
|
||||
global.append(lex_user->user.str, lex_user->user.length,
|
||||
system_charset_info);
|
||||
global.append ("'@'",3);
|
||||
global.append(lex_user->host.str,lex_user->host.length);
|
||||
global.append ('\'');
|
||||
@ -3177,7 +3178,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
want_access=acl_db->access;
|
||||
if (want_access)
|
||||
{
|
||||
String db(buff,sizeof(buff),&my_charset_latin1);
|
||||
String db(buff,sizeof(buff),system_charset_info);
|
||||
db.length(0);
|
||||
db.append("GRANT ",6);
|
||||
|
||||
@ -3203,7 +3204,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
db.append (" ON ",4);
|
||||
append_identifier(thd, &db, acl_db->db, strlen(acl_db->db));
|
||||
db.append (".* TO '",7);
|
||||
db.append(lex_user->user.str,lex_user->user.length);
|
||||
db.append(lex_user->user.str, lex_user->user.length,
|
||||
system_charset_info);
|
||||
db.append ("'@'",3);
|
||||
db.append(lex_user->host.str, lex_user->host.length);
|
||||
db.append ('\'');
|
||||
@ -3237,7 +3239,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
ulong table_access= grant_table->privs;
|
||||
if ((table_access | grant_table->cols) != 0)
|
||||
{
|
||||
String global(buff,sizeof(buff),&my_charset_latin1);
|
||||
String global(buff, sizeof(buff), system_charset_info);
|
||||
ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
|
||||
|
||||
global.length(0);
|
||||
@ -3291,7 +3293,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
else
|
||||
global.append(", ",2);
|
||||
global.append(grant_column->column,
|
||||
grant_column->key_length);
|
||||
grant_column->key_length,
|
||||
system_charset_info);
|
||||
}
|
||||
}
|
||||
if (found_col)
|
||||
@ -3307,7 +3310,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
append_identifier(thd, &global, grant_table->tname,
|
||||
strlen(grant_table->tname));
|
||||
global.append(" TO '",5);
|
||||
global.append(lex_user->user.str,lex_user->user.length);
|
||||
global.append(lex_user->user.str, lex_user->user.length,
|
||||
system_charset_info);
|
||||
global.append("'@'",3);
|
||||
global.append(lex_user->host.str,lex_user->host.length);
|
||||
global.append('\'');
|
||||
|
Loading…
x
Reference in New Issue
Block a user