mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-6788: The variable 'role' is being used without being initialized at sql_acl.cc:8840
Second variant of the fix: reduce the scope of 'role' variable
This commit is contained in:
@ -8645,7 +8645,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
|
|||||||
int elements;
|
int elements;
|
||||||
const char *UNINIT_VAR(user);
|
const char *UNINIT_VAR(user);
|
||||||
const char *UNINIT_VAR(host);
|
const char *UNINIT_VAR(host);
|
||||||
const char *role;
|
|
||||||
ACL_USER *acl_user= NULL;
|
ACL_USER *acl_user= NULL;
|
||||||
ACL_ROLE *acl_role= NULL;
|
ACL_ROLE *acl_role= NULL;
|
||||||
ACL_DB *acl_db= NULL;
|
ACL_DB *acl_db= NULL;
|
||||||
@ -8785,7 +8784,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
|
|||||||
role_grant_pair= (ROLE_GRANT_PAIR *) my_hash_element(roles_mappings_hash, idx);
|
role_grant_pair= (ROLE_GRANT_PAIR *) my_hash_element(roles_mappings_hash, idx);
|
||||||
user= role_grant_pair->u_uname;
|
user= role_grant_pair->u_uname;
|
||||||
host= role_grant_pair->u_hname;
|
host= role_grant_pair->u_hname;
|
||||||
role= role_grant_pair->r_uname;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -8803,8 +8801,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
|
|||||||
|
|
||||||
if (struct_no == ROLES_MAPPINGS_HASH)
|
if (struct_no == ROLES_MAPPINGS_HASH)
|
||||||
{
|
{
|
||||||
if (! role)
|
const char* role= role_grant_pair->r_uname? role_grant_pair->r_uname: "";
|
||||||
role= "";
|
|
||||||
if (user_from->is_role() ? strcmp(user_from->user.str, role) :
|
if (user_from->is_role() ? strcmp(user_from->user.str, role) :
|
||||||
(strcmp(user_from->user.str, user) ||
|
(strcmp(user_from->user.str, user) ||
|
||||||
my_strcasecmp(system_charset_info, user_from->host.str, host)))
|
my_strcasecmp(system_charset_info, user_from->host.str, host)))
|
||||||
|
Reference in New Issue
Block a user