mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
cleanup: create LEX_USER::reset_auth()
as this is used quite often
This commit is contained in:
@@ -984,7 +984,7 @@ static bool fix_user_plugin_ptr(ACL_USER *user)
|
|||||||
|
|
||||||
- if user->plugin is specified, user->auth is the plugin auth data.
|
- if user->plugin is specified, user->auth is the plugin auth data.
|
||||||
- if user->plugin is mysql_native_password or mysql_old_password,
|
- if user->plugin is mysql_native_password or mysql_old_password,
|
||||||
user->auth if the password hash, and LEX_USER is transformed
|
user->auth is the password hash, and LEX_USER is transformed
|
||||||
to match the next case (that is, user->plugin is cleared).
|
to match the next case (that is, user->plugin is cleared).
|
||||||
- if user->plugin is NOT specified, built-in auth is assumed, that is
|
- if user->plugin is NOT specified, built-in auth is assumed, that is
|
||||||
mysql_native_password or mysql_old_password. In that case,
|
mysql_native_password or mysql_old_password. In that case,
|
||||||
@@ -10156,9 +10156,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
|||||||
thd->make_lex_string(&combo->user, combo->user.str, strlen(combo->user.str));
|
thd->make_lex_string(&combo->user, combo->user.str, strlen(combo->user.str));
|
||||||
thd->make_lex_string(&combo->host, combo->host.str, strlen(combo->host.str));
|
thd->make_lex_string(&combo->host, combo->host.str, strlen(combo->host.str));
|
||||||
|
|
||||||
combo->password= null_lex_str;
|
combo->reset_auth();
|
||||||
combo->plugin= empty_lex_str;
|
|
||||||
combo->auth= empty_lex_str;
|
|
||||||
|
|
||||||
if(au)
|
if(au)
|
||||||
{
|
{
|
||||||
|
@@ -5160,9 +5160,7 @@ void THD::get_definer(LEX_USER *definer, bool role)
|
|||||||
{
|
{
|
||||||
definer->user = invoker_user;
|
definer->user = invoker_user;
|
||||||
definer->host= invoker_host;
|
definer->host= invoker_host;
|
||||||
definer->password= null_lex_str;
|
definer->reset_auth();
|
||||||
definer->plugin= empty_lex_str;
|
|
||||||
definer->auth= empty_lex_str;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@@ -8949,9 +8949,7 @@ void get_default_definer(THD *thd, LEX_USER *definer, bool role)
|
|||||||
}
|
}
|
||||||
definer->user.length= strlen(definer->user.str);
|
definer->user.length= strlen(definer->user.str);
|
||||||
|
|
||||||
definer->password= null_lex_str;
|
definer->reset_auth();
|
||||||
definer->plugin= empty_lex_str;
|
|
||||||
definer->auth= empty_lex_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -9009,7 +9007,7 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
|
|||||||
|
|
||||||
definer->user= *user_name;
|
definer->user= *user_name;
|
||||||
definer->host= *host_name;
|
definer->host= *host_name;
|
||||||
definer->password= null_lex_str;
|
definer->reset_auth();
|
||||||
|
|
||||||
return definer;
|
return definer;
|
||||||
}
|
}
|
||||||
|
@@ -14139,9 +14139,7 @@ user_maybe_role:
|
|||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
$$->user = $1;
|
$$->user = $1;
|
||||||
$$->host= null_lex_str; // User or Role, see get_current_user()
|
$$->host= null_lex_str; // User or Role, see get_current_user()
|
||||||
$$->password= null_lex_str;
|
$$->reset_auth();
|
||||||
$$->plugin= empty_lex_str;
|
|
||||||
$$->auth= empty_lex_str;
|
|
||||||
|
|
||||||
if (check_string_char_length(&$$->user, ER_USERNAME,
|
if (check_string_char_length(&$$->user, ER_USERNAME,
|
||||||
username_char_length,
|
username_char_length,
|
||||||
@@ -14153,9 +14151,7 @@ user_maybe_role:
|
|||||||
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
|
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
$$->user = $1; $$->host=$3;
|
$$->user = $1; $$->host=$3;
|
||||||
$$->password= null_lex_str;
|
$$->reset_auth();
|
||||||
$$->plugin= empty_lex_str;
|
|
||||||
$$->auth= empty_lex_str;
|
|
||||||
|
|
||||||
if (check_string_char_length(&$$->user, ER_USERNAME,
|
if (check_string_char_length(&$$->user, ER_USERNAME,
|
||||||
username_char_length,
|
username_char_length,
|
||||||
@@ -15417,9 +15413,7 @@ current_role:
|
|||||||
if (!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))
|
if (!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
$$->user= current_role;
|
$$->user= current_role;
|
||||||
$$->password= null_lex_str;
|
$$->reset_auth();
|
||||||
$$->plugin= empty_lex_str;
|
|
||||||
$$->auth= empty_lex_str;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -15438,9 +15432,7 @@ grant_role:
|
|||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
$$->user = $1;
|
$$->user = $1;
|
||||||
$$->host= empty_lex_str;
|
$$->host= empty_lex_str;
|
||||||
$$->password= null_lex_str;
|
$$->reset_auth();
|
||||||
$$->plugin= empty_lex_str;
|
|
||||||
$$->auth= empty_lex_str;
|
|
||||||
|
|
||||||
if (check_string_char_length(&$$->user, ER_USERNAME,
|
if (check_string_char_length(&$$->user, ER_USERNAME,
|
||||||
username_char_length,
|
username_char_length,
|
||||||
|
@@ -211,6 +211,12 @@ typedef struct st_lex_user {
|
|||||||
else
|
else
|
||||||
l->length= strxmov(l->str= buf, user.str, "@", host.str, NullS) - buf;
|
l->length= strxmov(l->str= buf, user.str, "@", host.str, NullS) - buf;
|
||||||
}
|
}
|
||||||
|
void reset_auth()
|
||||||
|
{
|
||||||
|
password.length= plugin.length= auth.length= 0;
|
||||||
|
password.str= 0;
|
||||||
|
plugin.str= auth.str= const_cast<char*>("");
|
||||||
|
}
|
||||||
} LEX_USER;
|
} LEX_USER;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user