diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-31 22:59:58 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-31 22:59:58 +0200 |
commit | 7841a7eb09208f52fcbab7e80e38c7ca29b1339e (patch) | |
tree | 7f9c4d80d3b86a33c54ff0090865ada4d4ed577d /sql/sql_acl.cc | |
parent | 77992bc710bbc16798c12da7081769817f87791a (diff) | |
parent | 1423cf5e3dcb3c50047f086a5933fe77006cf242 (diff) | |
download | mariadb-git-7841a7eb09208f52fcbab7e80e38c7ca29b1339e.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 22 |
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()) |