mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
cleanup
This commit is contained in:
@@ -281,8 +281,8 @@ public:
|
|||||||
uint counter;
|
uint counter;
|
||||||
DYNAMIC_ARRAY parent_grantee; // array of backlinks to elements granted
|
DYNAMIC_ARRAY parent_grantee; // array of backlinks to elements granted
|
||||||
|
|
||||||
ACL_ROLE(ACL_USER * user, MEM_ROOT *mem);
|
ACL_ROLE(ACL_USER *user);
|
||||||
ACL_ROLE(const char * rolename, privilege_t privileges, MEM_ROOT *mem);
|
ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *mem);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2182,7 +2182,7 @@ enum enum_acl_lists
|
|||||||
ROLES_MAPPINGS_HASH
|
ROLES_MAPPINGS_HASH
|
||||||
};
|
};
|
||||||
|
|
||||||
ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root)
|
ACL_ROLE::ACL_ROLE(ACL_USER *user)
|
||||||
:
|
:
|
||||||
/* set initial role access the same as the table row privileges */
|
/* set initial role access the same as the table row privileges */
|
||||||
initial_role_access(user->access),
|
initial_role_access(user->access),
|
||||||
@@ -2194,9 +2194,8 @@ ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root)
|
|||||||
flags= IS_ROLE;
|
flags= IS_ROLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACL_ROLE::ACL_ROLE(const char * rolename, privilege_t privileges,
|
ACL_ROLE::ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *root)
|
||||||
MEM_ROOT *root) :
|
: initial_role_access(privileges), counter(0)
|
||||||
initial_role_access(privileges), counter(0)
|
|
||||||
{
|
{
|
||||||
this->access= initial_role_access;
|
this->access= initial_role_access;
|
||||||
this->user.str= safe_strdup_root(root, rolename);
|
this->user.str= safe_strdup_root(root, rolename);
|
||||||
@@ -2666,7 +2665,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user, &acl_memroot);
|
ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user);
|
||||||
entry->role_grants = user.role_grants;
|
entry->role_grants = user.role_grants;
|
||||||
my_init_dynamic_array(key_memory_acl_mem, &entry->parent_grantee,
|
my_init_dynamic_array(key_memory_acl_mem, &entry->parent_grantee,
|
||||||
sizeof(ACL_USER_BASE *), 0, 8, MYF(0));
|
sizeof(ACL_USER_BASE *), 0, 8, MYF(0));
|
||||||
@@ -8518,16 +8517,13 @@ void GRANT_INFO::read(const Security_context *sctx,
|
|||||||
grant_table_user= grant_table_role= grant_public= NULL;
|
grant_table_user= grant_table_role= grant_public= NULL;
|
||||||
#else
|
#else
|
||||||
grant_table_user=
|
grant_table_user=
|
||||||
table_hash_search(sctx->host, sctx->ip, db,
|
table_hash_search(sctx->host, sctx->ip, db, sctx->priv_user,
|
||||||
sctx->priv_user,
|
|
||||||
table, FALSE); /* purecov: inspected */
|
table, FALSE); /* purecov: inspected */
|
||||||
grant_table_role=
|
grant_table_role=
|
||||||
sctx->priv_role[0] ? table_hash_search("", NULL, db,
|
sctx->priv_role[0] ? table_hash_search("", NULL, db, sctx->priv_role,
|
||||||
sctx->priv_role,
|
|
||||||
table, TRUE) : NULL;
|
table, TRUE) : NULL;
|
||||||
grant_public=
|
grant_public=
|
||||||
acl_public ? table_hash_search("", NULL, db,
|
acl_public ? table_hash_search("", NULL, db, public_name.str,
|
||||||
public_name.str,
|
|
||||||
table, TRUE) : NULL;
|
table, TRUE) : NULL;
|
||||||
#endif
|
#endif
|
||||||
version= grant_version; /* purecov: inspected */
|
version= grant_version; /* purecov: inspected */
|
||||||
@@ -11211,8 +11207,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
|
|||||||
int rc;
|
int rc;
|
||||||
user_name= get_current_user(thd, tmp_user_name, false);
|
user_name= get_current_user(thd, tmp_user_name, false);
|
||||||
if (!user_name || (handle_as_role &&
|
if (!user_name || (handle_as_role &&
|
||||||
(strcasecmp(user_name->user.str,
|
(strcasecmp(user_name->user.str, public_name.str) == 0)))
|
||||||
public_name.str) == 0)))
|
|
||||||
{
|
{
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
if (!user_name)
|
if (!user_name)
|
||||||
@@ -13010,8 +13005,7 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock)
|
|||||||
return dup;
|
return dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
role_name_check_result result= check_role_name(user->user.str,
|
role_name_check_result result= check_role_name(user->user.str, true);
|
||||||
user->host.length == 0);
|
|
||||||
if (result == ROLE_NAME_INVALID)
|
if (result == ROLE_NAME_INVALID)
|
||||||
return 0;
|
return 0;
|
||||||
if (result == ROLE_NAME_PUBLIC)
|
if (result == ROLE_NAME_PUBLIC)
|
||||||
|
@@ -6024,11 +6024,7 @@ void THD::get_definer(LEX_USER *definer, bool role)
|
|||||||
{
|
{
|
||||||
binlog_invoker(role);
|
binlog_invoker(role);
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
||||||
#ifdef WITH_WSREP
|
if ((IF_WSREP(wsrep_applier, 0) || slave_thread) && has_invoker())
|
||||||
if ((wsrep_applier || slave_thread) && has_invoker())
|
|
||||||
#else
|
|
||||||
if (slave_thread && has_invoker())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
definer->user= invoker.user;
|
definer->user= invoker.user;
|
||||||
definer->host= invoker.host;
|
definer->host= invoker.host;
|
||||||
|
@@ -17156,8 +17156,7 @@ grant_role:
|
|||||||
$$->host= empty_clex_str;
|
$$->host= empty_clex_str;
|
||||||
|
|
||||||
if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
|
if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
|
||||||
username_char_length,
|
username_char_length, cs, 0)))
|
||||||
cs, 0)))
|
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
| current_role
|
| current_role
|
||||||
|
Reference in New Issue
Block a user