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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
81b2856e
Commit
81b2856e
authored
Oct 18, 2013
by
Vicențiu Ciorbaru
Committed by
Sergei Golubchik
Oct 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored yacc grammar to make use of named constants.
parent
3566f317
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
70 deletions
+35
-70
sql/sql_acl.cc
sql/sql_acl.cc
+11
-0
sql/sql_acl.h
sql/sql_acl.h
+3
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+21
-70
No files found.
sql/sql_acl.cc
View file @
81b2856e
...
...
@@ -184,6 +184,17 @@ static LEX_STRING old_password_plugin_name= {
/// @todo make it configurable
LEX_STRING
*
default_auth_plugin_name
=
&
native_password_plugin_name
;
/*
Constant used for differentiating specified user names and non specified
usernames. Example: userA -- userA@%
*/
const
char
*
HOST_NOT_SPECIFIED
=
"%"
;
/*
Constant used in the SET ROLE NONE command
*/
const
char
*
NONE_ROLE
=
"NONE"
;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
static
plugin_ref
old_password_plugin
;
#endif
...
...
sql/sql_acl.h
View file @
81b2856e
...
...
@@ -173,6 +173,9 @@ enum mysql_db_table_field
extern
const
TABLE_FIELD_DEF
mysql_db_table_def
;
extern
bool
mysql_user_table_is_in_short_password_format
;
extern
const
char
*
HOST_NOT_SPECIFIED
;
extern
const
char
*
NONE_ROLE
;
static
inline
int
access_denied_error_code
(
int
passwd_used
)
{
...
...
sql/sql_yacc.yy
View file @
81b2856e
...
...
@@ -1570,7 +1570,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <symbol> keyword keyword_sp
%type <lex_user> user
specified_user grant_user role
%type <lex_user> user
grant_user
%type <charset>
opt_collate
...
...
@@ -1624,7 +1624,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_option opt_place
opt_attribute opt_attribute_list attribute column_list column_list_id
opt_column_list grant_privileges grant_ident grant_list grant_option
grant_list_with_roles
object_privilege object_privilege_list user_list rename_list
clear_privileges flush_options flush_option
opt_with_read_lock flush_options_list
...
...
@@ -13163,8 +13162,24 @@ ident_or_text:
| LEX_HOSTNAME { $$=$1;}
;
specified_user:
ident_or_text '@' ident_or_text
user:
ident_or_text
{
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1;
$$->host.str= (char *)HOST_NOT_SPECIFIED;
$$->host.length= 1;
$$->password= null_lex_str;
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
}
| ident_or_text '@' ident_or_text
{
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
...
...
@@ -13198,46 +13213,6 @@ specified_user:
}
;
user:
ident_or_text
{
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1;
$$->host.str= (char *) "%";
$$->host.length= 1;
$$->password= null_lex_str;
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
}
|
specified_user {$$ = $1;}
;
role:
ident_or_text
{
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1;
$$->host.str= (char *) "";
$$->host.length= 0;
$$->password= null_lex_str;
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
}
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword:
keyword_sp {}
...
...
@@ -14271,7 +14246,7 @@ revoke_command:
lex->sql_command= SQLCOM_REVOKE;
lex->type= TYPE_ENUM_PROXY;
}
| grant_role FROM grant_list
_with_roles
| grant_role FROM grant_list
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_REVOKE_ROLE;
...
...
@@ -14325,7 +14300,7 @@ grant_command:
lex->sql_command= SQLCOM_GRANT;
lex->type= TYPE_ENUM_PROXY;
}
| grant_role TO_SYM grant_list
_with_roles
| grant_role TO_SYM grant_list
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_GRANT_ROLE;
...
...
@@ -14520,30 +14495,6 @@ user_list:
}
;
grant_list_with_roles:
role
{
if (Lex->users_list.push_back($1))
MYSQL_YYABORT;
}
| specified_user
{
if (Lex->users_list.push_back($1))
MYSQL_YYABORT;
}
| grant_list_with_roles ',' role
{
if (Lex->users_list.push_back($3))
MYSQL_YYABORT;
}
| grant_list_with_roles ',' specified_user
{
if (Lex->users_list.push_back($3))
MYSQL_YYABORT;
}
;
grant_list:
grant_user
{
...
...
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