Commit d6370cb5 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

cleanup: execute test_if_create_new_users as part of grant_stage0

There is identical logic for all grant functions. If a grant grants to
non existant users they are created if the SQL mode is not
NO_AUTO_CREATE_USER *and* the user granting has rights to create users.

This check is done via test_if_create_new_users. Refactor all code such
that this check is only done in one (or three places for-now till more
refactoring happens).
parent 9859ce04
This diff is collapsed.
......@@ -348,6 +348,7 @@ class Sql_cmd_grant: public Sql_cmd
{
protected:
enum_sql_command m_command;
bool m_create_new_users;
List<LEX_USER> m_resolved_users;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
void warn_hostname_requires_resolving(THD *thd, List<LEX_USER> &list);
......@@ -356,7 +357,7 @@ class Sql_cmd_grant: public Sql_cmd
#endif
public:
Sql_cmd_grant(enum_sql_command command)
:m_command(command)
:m_command(command), m_create_new_users(false)
{ }
bool is_revoke() const { return m_command == SQLCOM_REVOKE; }
enum_sql_command sql_command_code() const { return m_command; }
......@@ -394,8 +395,10 @@ class Sql_cmd_grant_object: public Sql_cmd_grant
class Sql_cmd_grant_table: public Sql_cmd_grant_object
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool execute_table_mask(THD *thd);
bool execute_exact_table(THD *thd, TABLE_LIST *table);
bool execute_grant_database_or_global(THD *thd);
bool execute_grant_global(THD *thd);
bool execute_grant_database(THD *thd);
bool execute_grant_table(THD *thd, TABLE_LIST *table);
#endif
public:
Sql_cmd_grant_table(enum_sql_command command, Grant_privilege &grant)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment