mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
WL#7076: Backporting wl6715 to support both formats in 5.5, 5.6, 5.7
Backporting wl6715 to mysql-5.5
This commit is contained in:
@ -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,8 @@ 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;
|
||||
@ -1934,8 +1935,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 +3747,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 +3919,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
|
||||
{
|
||||
|
Reference in New Issue
Block a user