mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
[MDEV-7978] Updated syntax for SHOW CREATE USER
This commit is contained in:
parent
5c32d5e6e6
commit
b4fcd1a408
7 changed files with 26 additions and 1 deletions
|
@ -3917,6 +3917,7 @@ SHOW_VAR com_status_vars[]= {
|
||||||
{"show_create_proc", STMT_STATUS(SQLCOM_SHOW_CREATE_PROC)},
|
{"show_create_proc", STMT_STATUS(SQLCOM_SHOW_CREATE_PROC)},
|
||||||
{"show_create_table", STMT_STATUS(SQLCOM_SHOW_CREATE)},
|
{"show_create_table", STMT_STATUS(SQLCOM_SHOW_CREATE)},
|
||||||
{"show_create_trigger", STMT_STATUS(SQLCOM_SHOW_CREATE_TRIGGER)},
|
{"show_create_trigger", STMT_STATUS(SQLCOM_SHOW_CREATE_TRIGGER)},
|
||||||
|
{"show_create_user", STMT_STATUS(SQLCOM_SHOW_CREATE_USER)},
|
||||||
{"show_databases", STMT_STATUS(SQLCOM_SHOW_DATABASES)},
|
{"show_databases", STMT_STATUS(SQLCOM_SHOW_DATABASES)},
|
||||||
{"show_engine_logs", STMT_STATUS(SQLCOM_SHOW_ENGINE_LOGS)},
|
{"show_engine_logs", STMT_STATUS(SQLCOM_SHOW_ENGINE_LOGS)},
|
||||||
{"show_engine_mutex", STMT_STATUS(SQLCOM_SHOW_ENGINE_MUTEX)},
|
{"show_engine_mutex", STMT_STATUS(SQLCOM_SHOW_ENGINE_MUTEX)},
|
||||||
|
|
|
@ -216,6 +216,7 @@ sp_get_flags_for_command(LEX *lex)
|
||||||
case SQLCOM_SHOW_CREATE_PROC:
|
case SQLCOM_SHOW_CREATE_PROC:
|
||||||
case SQLCOM_SHOW_CREATE_EVENT:
|
case SQLCOM_SHOW_CREATE_EVENT:
|
||||||
case SQLCOM_SHOW_CREATE_TRIGGER:
|
case SQLCOM_SHOW_CREATE_TRIGGER:
|
||||||
|
case SQLCOM_SHOW_CREATE_USER:
|
||||||
case SQLCOM_SHOW_DATABASES:
|
case SQLCOM_SHOW_DATABASES:
|
||||||
case SQLCOM_SHOW_ERRORS:
|
case SQLCOM_SHOW_ERRORS:
|
||||||
case SQLCOM_SHOW_EXPLAIN:
|
case SQLCOM_SHOW_EXPLAIN:
|
||||||
|
|
|
@ -7733,6 +7733,10 @@ static int show_grants_callback(ACL_USER_BASE *role, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
|
void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
|
|
@ -244,6 +244,7 @@ ulong get_column_grant(THD *thd, GRANT_INFO *grant,
|
||||||
void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
|
void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
|
||||||
const char *name);
|
const char *name);
|
||||||
bool mysql_show_grants(THD *thd, LEX_USER *user);
|
bool mysql_show_grants(THD *thd, LEX_USER *user);
|
||||||
|
bool mysql_show_create_user(THD *thd, LEX_USER *user);
|
||||||
int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond);
|
int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond);
|
||||||
int fill_schema_applicable_roles(THD *thd, TABLE_LIST *tables, COND *cond);
|
int fill_schema_applicable_roles(THD *thd, TABLE_LIST *tables, COND *cond);
|
||||||
void get_privilege_desc(char *to, uint max_length, ulong access);
|
void get_privilege_desc(char *to, uint max_length, ulong access);
|
||||||
|
|
|
@ -94,6 +94,7 @@ enum enum_sql_command {
|
||||||
SQLCOM_COMPOUND,
|
SQLCOM_COMPOUND,
|
||||||
SQLCOM_SHOW_GENERIC,
|
SQLCOM_SHOW_GENERIC,
|
||||||
SQLCOM_ALTER_USER,
|
SQLCOM_ALTER_USER,
|
||||||
|
SQLCOM_SHOW_CREATE_USER,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
When a command is added here, be sure it's also added in mysqld.cc
|
When a command is added here, be sure it's also added in mysqld.cc
|
||||||
|
|
|
@ -417,6 +417,7 @@ void init_update_queries(void)
|
||||||
sql_command_flags[SQLCOM_SHOW_EXPLAIN]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_EXPLAIN]= CF_STATUS_COMMAND;
|
||||||
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
|
||||||
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
|
||||||
|
sql_command_flags[SQLCOM_SHOW_CREATE_USER]= CF_STATUS_COMMAND;
|
||||||
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND;
|
||||||
sql_command_flags[SQLCOM_SHOW_CREATE]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_CREATE]= CF_STATUS_COMMAND;
|
||||||
sql_command_flags[SQLCOM_SHOW_MASTER_STAT]= CF_STATUS_COMMAND;
|
sql_command_flags[SQLCOM_SHOW_MASTER_STAT]= CF_STATUS_COMMAND;
|
||||||
|
@ -4946,6 +4947,7 @@ end_with_restore_list:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
|
case SQLCOM_SHOW_CREATE_USER:
|
||||||
case SQLCOM_SHOW_GRANTS:
|
case SQLCOM_SHOW_GRANTS:
|
||||||
{
|
{
|
||||||
LEX_USER *grant_user= lex->grant_user;
|
LEX_USER *grant_user= lex->grant_user;
|
||||||
|
@ -4962,7 +4964,10 @@ end_with_restore_list:
|
||||||
grant_user->user.str == current_user_and_current_role.str ||
|
grant_user->user.str == current_user_and_current_role.str ||
|
||||||
!check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 0))
|
!check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 0))
|
||||||
{
|
{
|
||||||
res = mysql_show_grants(thd, grant_user);
|
if (lex->sql_command == SQLCOM_SHOW_GRANTS)
|
||||||
|
res = mysql_show_grants(thd, grant_user);
|
||||||
|
else
|
||||||
|
res = mysql_show_create_user(thd, grant_user);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12774,6 +12774,18 @@ show_param:
|
||||||
lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER;
|
lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER;
|
||||||
lex->spname= $3;
|
lex->spname= $3;
|
||||||
}
|
}
|
||||||
|
| CREATE USER
|
||||||
|
{
|
||||||
|
Lex->sql_command= SQLCOM_SHOW_CREATE_USER;
|
||||||
|
if (!(Lex->grant_user= (LEX_USER*)thd->alloc(sizeof(LEX_USER))))
|
||||||
|
MYSQL_YYABORT;
|
||||||
|
Lex->grant_user->user= current_user_and_current_role;
|
||||||
|
}
|
||||||
|
| CREATE USER user
|
||||||
|
{
|
||||||
|
Lex->sql_command= SQLCOM_SHOW_CREATE_USER;
|
||||||
|
Lex->grant_user= $3;
|
||||||
|
}
|
||||||
| PROCEDURE_SYM STATUS_SYM wild_and_where
|
| PROCEDURE_SYM STATUS_SYM wild_and_where
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
|
|
Loading…
Add table
Reference in a new issue