Skip to content

Commit 0b519a4

Browse files
committed
cleanup
1 parent b4e7803 commit 0b519a4

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

sql/sql_acl.cc

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ class ACL_ROLE :public ACL_USER_BASE
281281
uint counter;
282282
DYNAMIC_ARRAY parent_grantee; // array of backlinks to elements granted
283283

284-
ACL_ROLE(ACL_USER * user, MEM_ROOT *mem);
285-
ACL_ROLE(const char * rolename, privilege_t privileges, MEM_ROOT *mem);
284+
ACL_ROLE(ACL_USER *user);
285+
ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *mem);
286286

287287
};
288288

@@ -2182,7 +2182,7 @@ enum enum_acl_lists
21822182
ROLES_MAPPINGS_HASH
21832183
};
21842184

2185-
ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root)
2185+
ACL_ROLE::ACL_ROLE(ACL_USER *user)
21862186
:
21872187
/* set initial role access the same as the table row privileges */
21882188
initial_role_access(user->access),
@@ -2194,9 +2194,8 @@ ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root)
21942194
flags= IS_ROLE;
21952195
}
21962196

2197-
ACL_ROLE::ACL_ROLE(const char * rolename, privilege_t privileges,
2198-
MEM_ROOT *root) :
2199-
initial_role_access(privileges), counter(0)
2197+
ACL_ROLE::ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *root)
2198+
: initial_role_access(privileges), counter(0)
22002199
{
22012200
this->access= initial_role_access;
22022201
this->user.str= safe_strdup_root(root, rolename);
@@ -2666,7 +2665,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
26662665
continue;
26672666
}
26682667

2669-
ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user, &acl_memroot);
2668+
ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user);
26702669
entry->role_grants = user.role_grants;
26712670
my_init_dynamic_array(key_memory_acl_mem, &entry->parent_grantee,
26722671
sizeof(ACL_USER_BASE *), 0, 8, MYF(0));
@@ -8518,16 +8517,13 @@ void GRANT_INFO::read(const Security_context *sctx,
85188517
grant_table_user= grant_table_role= grant_public= NULL;
85198518
#else
85208519
grant_table_user=
8521-
table_hash_search(sctx->host, sctx->ip, db,
8522-
sctx->priv_user,
8520+
table_hash_search(sctx->host, sctx->ip, db, sctx->priv_user,
85238521
table, FALSE); /* purecov: inspected */
85248522
grant_table_role=
8525-
sctx->priv_role[0] ? table_hash_search("", NULL, db,
8526-
sctx->priv_role,
8523+
sctx->priv_role[0] ? table_hash_search("", NULL, db, sctx->priv_role,
85278524
table, TRUE) : NULL;
85288525
grant_public=
8529-
acl_public ? table_hash_search("", NULL, db,
8530-
public_name.str,
8526+
acl_public ? table_hash_search("", NULL, db, public_name.str,
85318527
table, TRUE) : NULL;
85328528
#endif
85338529
version= grant_version;/* purecov: inspected */
@@ -11211,8 +11207,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
1121111207
int rc;
1121211208
user_name= get_current_user(thd, tmp_user_name, false);
1121311209
if (!user_name || (handle_as_role &&
11214-
(strcasecmp(user_name->user.str,
11215-
public_name.str) == 0)))
11210+
(strcasecmp(user_name->user.str, public_name.str) == 0)))
1121611211
{
1121711212
thd->clear_error();
1121811213
if (!user_name)
@@ -13010,8 +13005,7 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock)
1301013005
return dup;
1301113006
}
1301213007

13013-
role_name_check_result result= check_role_name(user->user.str,
13014-
user->host.length == 0);
13008+
role_name_check_result result= check_role_name(user->user.str, true);
1301513009
if (result == ROLE_NAME_INVALID)
1301613010
return 0;
1301713011
if (result == ROLE_NAME_PUBLIC)

sql/sql_class.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6024,11 +6024,7 @@ void THD::get_definer(LEX_USER *definer, bool role)
60246024
{
60256025
binlog_invoker(role);
60266026
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
6027-
#ifdef WITH_WSREP
6028-
if ((wsrep_applier || slave_thread) && has_invoker())
6029-
#else
6030-
if (slave_thread && has_invoker())
6031-
#endif
6027+
if ((IF_WSREP(wsrep_applier, 0) || slave_thread) && has_invoker())
60326028
{
60336029
definer->user= invoker.user;
60346030
definer->host= invoker.host;

sql/sql_yacc.yy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17156,8 +17156,7 @@ grant_role:
1715617156
$$->host= empty_clex_str;
1715717157

1715817158
if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
17159-
username_char_length,
17160-
cs, 0)))
17159+
username_char_length, cs, 0)))
1716117160
MYSQL_YYABORT;
1716217161
}
1716317162
| current_role

0 commit comments

Comments
 (0)