summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorAshish Agarwal <ashish.y.agarwal@oracle.com>2013-08-23 09:07:09 +0530
committerAshish Agarwal <ashish.y.agarwal@oracle.com>2013-08-23 09:07:09 +0530
commitd75c58e11fb864abafb48d74efd9bb1dbdc9f4c4 (patch)
tree01a2e2f69168201021668f8d6144a6aa701c61ad /sql/sql_show.cc
parentf7e0cc8204ab2e9e09e96e77f015dfb369553de0 (diff)
parentf5b5e6b951eabe6d6add84fa915d305a4a95cddf (diff)
downloadmariadb-git-d75c58e11fb864abafb48d74efd9bb1dbdc9f4c4.tar.gz
WL#7076: Backporting wl6715 to support both formats
in 5.5, 5.6, 5.7.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 01aea327ccf..94fcbee8c9e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -795,8 +795,8 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
if (test_all_bits(sctx->master_access, DB_ACLS))
db_access=DB_ACLS;
else
- db_access= (acl_get(sctx->host, sctx->ip, sctx->priv_user, dbname, 0) |
- sctx->master_access);
+ db_access= (acl_get(sctx->get_host()->ptr(), sctx->get_ip()->ptr(),
+ sctx->priv_user, dbname, 0) | sctx->master_access);
if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname))
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
@@ -1832,8 +1832,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user :
(tmp->system_thread ?
"system user" : "unauthenticated user"));
- if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
- thd->security_ctx->host_or_ip[0])
+ if (tmp->peer_port && (tmp_sctx->get_host()->length() ||
+ tmp_sctx->get_ip()->length()) && thd->security_ctx->host_or_ip[0])
{
if ((thd_info->host= (char*) thd->alloc(LIST_PROCESS_HOST_LEN+1)))
my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN,
@@ -1842,7 +1842,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
thd_info->host= thd->strdup(tmp_sctx->host_or_ip[0] ?
tmp_sctx->host_or_ip :
- tmp_sctx->host ? tmp_sctx->host : "");
+ tmp_sctx->get_host()->length() ?
+ tmp_sctx->get_host()->ptr() : "");
+ if ((thd_info->db=tmp->db)) // Safe test
+ thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command;
mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((thd_info->db= tmp->db)) // Safe test
@@ -1934,8 +1937,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
(tmp->system_thread ? "system user" : "unauthenticated user");
table->field[1]->store(val, strlen(val), cs);
/* HOST */
- if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
- thd->security_ctx->host_or_ip[0])
+ if (tmp->peer_port && (tmp_sctx->get_host()->length() ||
+ tmp_sctx->get_ip()->length()) && thd->security_ctx->host_or_ip[0])
{
char host[LIST_PROCESS_HOST_LEN + 1];
my_snprintf(host, LIST_PROCESS_HOST_LEN, "%s:%u",
@@ -3746,7 +3749,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
&thd->col_access, NULL, 0, 1) ||
(!thd->col_access && check_grant_db(thd, db_name->str))) ||
sctx->master_access & (DB_ACLS | SHOW_DB_ACL) ||
- acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0))
+ acl_get(sctx->get_host()->ptr(), sctx->get_ip()->ptr(),
+ sctx->priv_user, db_name->str, 0))
#endif
{
List<LEX_STRING> table_names;
@@ -3917,7 +3921,8 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (sctx->master_access & (DB_ACLS | SHOW_DB_ACL) ||
- acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0) ||
+ acl_get(sctx->get_host()->ptr(), sctx->get_ip()->ptr(),
+ sctx->priv_user, db_name->str, 0) ||
!check_grant_db(thd, db_name->str))
#endif
{