Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0537ce4e
Commit
0537ce4e
authored
Sep 24, 2022
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove LEX_USER->is_public
it's now redundant
parent
5dc804c3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
24 deletions
+16
-24
sql/sql_acl.cc
sql/sql_acl.cc
+15
-17
sql/sql_class.cc
sql/sql_class.cc
+0
-1
sql/sql_parse.cc
sql/sql_parse.cc
+1
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+0
-3
sql/structs.h
sql/structs.h
+0
-1
No files found.
sql/sql_acl.cc
View file @
0537ce4e
...
...
@@ -108,6 +108,9 @@ LEX_CSTRING current_user_and_current_role=
LEX_CSTRING
none
=
{
STRING_WITH_LEN
(
"NONE"
)
};
LEX_CSTRING
public_name
=
{
STRING_WITH_LEN
(
"PUBLIC"
)
};
static
inline
bool
is_public
(
const
char
*
l
)
{
return
l
==
public_name
.
str
;
}
static
inline
bool
is_public
(
const
LEX_CSTRING
*
l
)
{
return
is_public
(
l
->
str
);
}
static
inline
bool
is_public
(
const
LEX_USER
*
l
)
{
return
is_public
(
&
l
->
user
);
}
static
plugin_ref
old_password_plugin
;
static
plugin_ref
native_password_plugin
;
...
...
@@ -2199,7 +2202,7 @@ ACL_ROLE::ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *root)
:
initial_role_access
(
privileges
),
counter
(
0
)
{
this
->
access
=
initial_role_access
;
if
(
rolename
==
public_name
.
str
)
if
(
is_public
(
rolename
)
)
this
->
user
=
public_name
;
else
{
...
...
@@ -3597,8 +3600,8 @@ static void acl_insert_role(const char *rolename, privilege_t privileges)
sizeof
(
ACL_ROLE
*
),
0
,
8
,
MYF
(
0
));
my_hash_insert
(
&
acl_roles
,
(
uchar
*
)
entry
);
DBUG_ASSERT
(
strcasecmp
(
rolename
,
public_name
.
str
)
||
rolename
==
public_name
.
str
);
if
(
rolename
==
public_name
.
str
)
DBUG_ASSERT
(
strcasecmp
(
rolename
,
public_name
.
str
)
||
is_public
(
rolename
)
);
if
(
is_public
(
rolename
)
)
acl_public
=
entry
;
DBUG_VOID_RETURN
;
...
...
@@ -7275,7 +7278,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
error
=
copy_and_check_auth
(
Str
,
Str
,
thd
)
||
replace_user_table
(
thd
,
tables
.
user_table
(),
Str
,
NO_ACL
,
revoke_grant
,
create_new_users
,
MY_TEST
(
!
Str
->
is_public
&&
MY_TEST
(
!
is_public
(
Str
)
&&
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
)));
if
(
unlikely
(
error
))
...
...
@@ -7461,7 +7464,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
if
(
copy_and_check_auth
(
Str
,
tmp_Str
,
thd
)
||
replace_user_table
(
thd
,
tables
.
user_table
(),
Str
,
NO_ACL
,
revoke_grant
,
create_new_users
,
!
Str
->
is_public
&&
(
thd
->
variables
.
sql_mode
&
!
is_public
(
Str
)
&&
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
)))
{
result
=
TRUE
;
...
...
@@ -7707,7 +7710,6 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
continue
;
case
ROLE_NAME_PUBLIC
:
user
->
host
=
hostname
=
empty_clex_str
;
user
->
is_public
=
true
;
role_as_user
=
acl_public
;
break
;
case
ROLE_NAME_OK
:
...
...
@@ -7726,7 +7728,7 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
if
(
has_auth
(
user
,
thd
->
lex
))
DBUG_ASSERT
(
!
grantee
);
else
if
(
!
grantee
&&
!
user
->
is_public
)
else
if
(
!
grantee
&&
!
is_public
(
user
)
)
grantee
=
find_user_exact
(
hostname
.
str
,
username
.
str
);
if
(
!
grantee
&&
!
revoke
)
...
...
@@ -7738,13 +7740,13 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
if
(
copy_and_check_auth
(
&
user_combo
,
&
user_combo
,
thd
)
||
replace_user_table
(
thd
,
tables
.
user_table
(),
&
user_combo
,
NO_ACL
,
false
,
create_new_user
,
(
!
user_combo
.
is_public
&&
no_auto_create_user
)))
(
!
is_public
(
&
user_combo
)
&&
no_auto_create_user
)))
{
append_user
(
thd
,
&
wrong_users
,
&
username
,
&
hostname
);
result
=
1
;
continue
;
}
if
(
!
user_combo
.
is_public
)
if
(
!
is_public
(
&
user_combo
)
)
grantee
=
find_user_exact
(
hostname
.
str
,
username
.
str
);
else
grantee
=
role_as_user
=
acl_public
;
...
...
@@ -7913,7 +7915,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
replace_user_table
(
thd
,
tables
.
user_table
(),
Str
,
(
!
db
?
rights
:
NO_ACL
),
revoke_grant
,
create_new_users
,
MY_TEST
(
!
Str
->
is_public
&&
MY_TEST
(
!
is_public
(
Str
)
&&
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
))))
result
=
true
;
...
...
@@ -9464,7 +9466,7 @@ bool get_show_user(THD *thd, LEX_USER *lex_user, const char **username,
if
(
lex_user
->
is_role
())
{
*
rolename
=
lex_user
->
user
.
str
;
do_check_access
=
!
lex_user
->
is_public
&&
strcmp
(
*
rolename
,
sctx
->
priv_role
);
do_check_access
=
!
is_public
(
lex_user
)
&&
strcmp
(
*
rolename
,
sctx
->
priv_role
);
}
else
{
...
...
@@ -9772,7 +9774,7 @@ static void add_to_user(THD *thd, String *result, const char *user,
bool
is_user
,
const
char
*
host
)
{
result
->
append
(
STRING_WITH_LEN
(
" TO "
));
if
(
user
==
public_name
.
str
)
if
(
is_public
(
user
)
)
result
->
append
(
public_name
);
else
append_identifier
(
thd
,
result
,
user
,
strlen
(
user
));
...
...
@@ -11217,7 +11219,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
{
int
rc
;
user_name
=
get_current_user
(
thd
,
tmp_user_name
,
false
);
if
(
!
user_name
||
(
handle_as_role
&&
user_name
->
is_public
))
if
(
!
user_name
||
(
handle_as_role
&&
is_public
(
user_name
)
))
{
thd
->
clear_error
();
if
(
!
user_name
)
...
...
@@ -11909,7 +11911,6 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
thd
->
make_lex_string
(
&
combo
->
host
,
combo
->
host
.
str
,
strlen
(
combo
->
host
.
str
));
combo
->
auth
=
NULL
;
combo
->
is_public
=
false
;
if
(
user_list
.
push_back
(
combo
,
thd
->
mem_root
))
DBUG_RETURN
(
TRUE
);
...
...
@@ -13006,8 +13007,6 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock)
if
(
!
dup
)
return
0
;
dup
->
is_public
=
false
;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if
(
has_auth
(
user
,
thd
->
lex
))
{
...
...
@@ -13020,7 +13019,6 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock)
return
0
;
if
(
result
==
ROLE_NAME_PUBLIC
)
{
dup
->
is_public
=
true
;
dup
->
host
=
empty_clex_str
;
return
dup
;
}
...
...
sql/sql_class.cc
View file @
0537ce4e
...
...
@@ -6029,7 +6029,6 @@ void THD::get_definer(LEX_USER *definer, bool role)
definer
->
user
=
invoker
.
user
;
definer
->
host
=
invoker
.
host
;
definer
->
auth
=
NULL
;
definer
->
is_public
=
false
;
}
else
#endif
...
...
sql/sql_parse.cc
View file @
0537ce4e
...
...
@@ -2801,7 +2801,7 @@ bool sp_process_definer(THD *thd)
LEX_USER
*
d
=
get_current_user
(
thd
,
lex
->
definer
);
if
(
!
d
)
DBUG_RETURN
(
TRUE
);
if
(
d
->
is_public
)
if
(
d
->
user
.
str
==
public_name
.
str
)
{
my_error
(
ER_INVALID_ROLE
,
MYF
(
0
),
lex
->
definer
->
user
.
str
);
DBUG_RETURN
(
TRUE
);
...
...
@@ -10064,7 +10064,6 @@ void get_default_definer(THD *thd, LEX_USER *definer, bool role)
}
definer
->
user
.
length
=
strlen
(
definer
->
user
.
str
);
definer
->
auth
=
NULL
;
definer
->
is_public
=
false
;
}
...
...
sql/sql_yacc.yy
View file @
0537ce4e
...
...
@@ -17155,10 +17155,7 @@ role_name: ident_or_text
if (lex_string_eq(&$1, &none))
$$->user= none;
else if (lex_string_eq(&$1, &public_name))
{
$$->user= public_name;
$$->is_public= true;
}
else if (check_string_char_length(&($$->user= $1), ER_USERNAME,
username_char_length, cs, 0))
MYSQL_YYABORT;
...
...
sql/structs.h
View file @
0537ce4e
...
...
@@ -254,7 +254,6 @@ struct AUTHID
struct
LEX_USER
:
public
AUTHID
{
USER_AUTH
*
auth
;
bool
is_public
;
bool
has_auth
()
{
return
auth
&&
(
auth
->
plugin
.
length
||
auth
->
auth_str
.
length
||
auth
->
pwtext
.
length
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment