summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorRobert Bindar <robert@mariadb.org>2019-02-13 20:02:42 +0100
committerSergei Golubchik <serg@mariadb.org>2019-02-14 17:30:22 +0100
commit6c8ce999f861c8c56edaf6b6e965c6c48bd9e37c (patch)
treeba71b52e8cb0182d2b54c57decf34a8fde0a2819 /sql/sql_yacc.yy
parentd89cdfc2291560c1cd9bc55658584577d0ce5ef6 (diff)
downloadmariadb-git-6c8ce999f861c8c56edaf6b6e965c6c48bd9e37c.tar.gz
MDEV-13095 Implement User Account locking
Add server support for user account locking. This patch extends the ALTER/CREATE USER statements for denying a user's subsequent login attempts: ALTER USER user [, user2] ACCOUNT [LOCK | UNLOCK] CREATE USER user [, user2] ACCOUNT [LOCK | UNLOCK] The SHOW CREATE USER statement was updated to display the locking state of an user. Closes #1006
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy19
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 2077ea52557..52150fb0619 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1151,6 +1151,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
Non-reserved keywords
*/
+%token <kwd> ACCOUNT_SYM /* MYSQL */
%token <kwd> ACTION /* SQL-2003-N */
%token <kwd> ADMIN_SYM /* SQL-2003-N */
%token <kwd> ADDDATE_SYM /* MYSQL-FUNC */
@@ -2911,7 +2912,7 @@ create:
Lex->pop_select(); //main select
}
| create_or_replace USER_SYM opt_if_not_exists clear_privileges
- grant_list opt_require_clause opt_resource_options
+ grant_list opt_require_clause opt_resource_options opt_account_locking
{
if (unlikely(Lex->set_command_with_check(SQLCOM_CREATE_USER,
$1 | $3)))
@@ -3318,6 +3319,7 @@ clear_privileges:
lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
bzero((char *)&(lex->mqh),sizeof(lex->mqh));
+ lex->account_options.reset();
}
;
@@ -7979,7 +7981,7 @@ alter:
} OPTIONS_SYM '(' server_options_list ')' { }
/* ALTER USER foo is allowed for MySQL compatibility. */
| ALTER opt_if_exists USER_SYM clear_privileges grant_list
- opt_require_clause opt_resource_options
+ opt_require_clause opt_resource_options opt_account_locking
{
Lex->create_info.set($2);
Lex->sql_command= SQLCOM_ALTER_USER;
@@ -8018,6 +8020,18 @@ alter:
}
;
+opt_account_locking:
+ /* Nothing */ {}
+ | ACCOUNT_SYM LOCK_SYM
+ {
+ Lex->account_options.account_locked= ACCOUNTLOCK_LOCKED;
+ }
+ | ACCOUNT_SYM UNLOCK_SYM
+ {
+ Lex->account_options.account_locked= ACCOUNTLOCK_UNLOCKED;
+ }
+ ;
+
ev_alter_on_schedule_completion:
/* empty */ { $$= 0;}
| ON SCHEDULE_SYM ev_schedule_time { $$= 1; }
@@ -15855,6 +15869,7 @@ keyword_data_type:
*/
keyword_sp_var_and_label:
ACTION
+ | ACCOUNT_SYM
| ADDDATE_SYM
| ADMIN_SYM
| AFTER_SYM