summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index eed20b040c3..0e2c044e3a1 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3121,7 +3121,6 @@ end:
my_error(ER_INVALID_ROLE, MYF(0), rolename);
break;
case 1:
- StringBuffer<1024> c_usr;
LEX_CSTRING role_lex;
/* First, check if current user can see mysql database. */
bool read_access= !check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 1);
@@ -3142,11 +3141,9 @@ end:
NULL) == -1))
{
/* Role is not granted but current user can see the role */
- c_usr.append(user, strlen(user));
- c_usr.append('@');
- c_usr.append(host, strlen(host));
- my_printf_error(ER_INVALID_ROLE, "User %`s has not been granted role %`s",
- MYF(0), c_usr.c_ptr(), rolename);
+ my_printf_error(ER_INVALID_ROLE, "User %`s@%`s has not been granted role %`s",
+ MYF(0), thd->security_ctx->priv_user,
+ thd->security_ctx->priv_host, rolename);
}
else
{
@@ -9261,14 +9258,13 @@ static bool show_default_role(THD *thd, ACL_USER *acl_entry,
String def_str(buff, buffsize, system_charset_info);
def_str.length(0);
def_str.append(STRING_WITH_LEN("SET DEFAULT ROLE "));
- def_str.append(&def_rolename);
- def_str.append(" FOR '");
- def_str.append(&acl_entry->user);
+ append_identifier(thd, &def_str, def_rolename.str, def_rolename.length);
+ def_str.append(" FOR ");
+ append_identifier(thd, &def_str, acl_entry->user.str, acl_entry->user.length);
DBUG_ASSERT(!(acl_entry->flags & IS_ROLE));
- def_str.append(STRING_WITH_LEN("'@'"));
- def_str.append(acl_entry->host.hostname, acl_entry->hostname_length,
- system_charset_info);
- def_str.append('\'');
+ def_str.append('@');
+ append_identifier(thd, &def_str, acl_entry->host.hostname,
+ acl_entry->hostname_length);
protocol->prepare_for_resend();
protocol->store(def_str.ptr(),def_str.length(),def_str.charset());
if (protocol->write())