fix a case where automatic procedure grant was changing user's password
phase out make_password_from_salt() to be removed in 10.1
This commit is contained in:
parent
865b83e9a4
commit
44cf4d6751
@ -618,14 +618,17 @@ void scramble_323(char *to, const char *message, const char *password);
|
|||||||
my_bool check_scramble_323(const unsigned char *reply, const char *message,
|
my_bool check_scramble_323(const unsigned char *reply, const char *message,
|
||||||
unsigned long *salt);
|
unsigned long *salt);
|
||||||
void get_salt_from_password_323(unsigned long *res, const char *password);
|
void get_salt_from_password_323(unsigned long *res, const char *password);
|
||||||
|
#if MYSQL_VERSION_ID < 100100
|
||||||
void make_password_from_salt_323(char *to, const unsigned long *salt);
|
void make_password_from_salt_323(char *to, const unsigned long *salt);
|
||||||
|
#endif
|
||||||
void make_scrambled_password(char *to, const char *password);
|
void make_scrambled_password(char *to, const char *password);
|
||||||
void scramble(char *to, const char *message, const char *password);
|
void scramble(char *to, const char *message, const char *password);
|
||||||
my_bool check_scramble(const unsigned char *reply, const char *message,
|
my_bool check_scramble(const unsigned char *reply, const char *message,
|
||||||
const unsigned char *hash_stage2);
|
const unsigned char *hash_stage2);
|
||||||
void get_salt_from_password(unsigned char *res, const char *password);
|
void get_salt_from_password(unsigned char *res, const char *password);
|
||||||
|
#if MYSQL_VERSION_ID < 100100
|
||||||
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
|
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
|
||||||
|
#endif
|
||||||
char *octet2hex(char *to, const char *str, unsigned int len);
|
char *octet2hex(char *to, const char *str, unsigned int len);
|
||||||
|
|
||||||
/* end of password.c */
|
/* end of password.c */
|
||||||
|
@ -284,4 +284,23 @@ DROP EVENT teste_bug11763507;
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# -- End of 5.1 tests
|
# -- End of 5.1 tests
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
grant create routine on test.* to foo1@localhost identified by 'foo';
|
||||||
|
update mysql.user set password = replace(password, '*', '-') where user='foo1';
|
||||||
|
show grants;
|
||||||
|
Grants for foo1@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
|
||||||
|
GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
|
||||||
|
flush privileges;
|
||||||
|
show grants;
|
||||||
|
Grants for foo1@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
|
||||||
|
GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
|
||||||
|
create procedure spfoo() select 1;
|
||||||
|
show grants;
|
||||||
|
Grants for foo1@localhost
|
||||||
|
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
|
||||||
|
GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
|
||||||
|
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`spfoo` TO 'foo1'@'localhost'
|
||||||
|
drop procedure spfoo;
|
||||||
|
drop user foo1@localhost;
|
||||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||||
|
@ -461,6 +461,26 @@ DROP EVENT teste_bug11763507;
|
|||||||
--echo # -- End of 5.1 tests
|
--echo # -- End of 5.1 tests
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# A case of SHOW GRANTS
|
||||||
|
# (creating a new procedure changes the password)
|
||||||
|
#
|
||||||
|
grant create routine on test.* to foo1@localhost identified by 'foo';
|
||||||
|
update mysql.user set password = replace(password, '*', '-') where user='foo1';
|
||||||
|
--connect (foo,localhost,foo1,foo)
|
||||||
|
show grants;
|
||||||
|
--connection default
|
||||||
|
flush privileges;
|
||||||
|
--connection foo
|
||||||
|
show grants;
|
||||||
|
create procedure spfoo() select 1;
|
||||||
|
show grants;
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
--disconnect foo
|
||||||
|
drop procedure spfoo;
|
||||||
|
drop user foo1@localhost;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Restore global concurrent_insert value. Keep in the end of the test file.
|
# Restore global concurrent_insert value. Keep in the end of the test file.
|
||||||
#
|
#
|
||||||
|
@ -9840,7 +9840,6 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
|||||||
List<LEX_USER> user_list;
|
List<LEX_USER> user_list;
|
||||||
bool result;
|
bool result;
|
||||||
ACL_USER *au;
|
ACL_USER *au;
|
||||||
char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
|
|
||||||
Dummy_error_handler error_handler;
|
Dummy_error_handler error_handler;
|
||||||
DBUG_ENTER("sp_grant_privileges");
|
DBUG_ENTER("sp_grant_privileges");
|
||||||
|
|
||||||
@ -9881,33 +9880,10 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
|||||||
|
|
||||||
if(au)
|
if(au)
|
||||||
{
|
{
|
||||||
if (au->salt_len)
|
|
||||||
{
|
|
||||||
if (au->salt_len == SCRAMBLE_LENGTH)
|
|
||||||
{
|
|
||||||
make_password_from_salt(passwd_buff, au->salt);
|
|
||||||
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
|
|
||||||
}
|
|
||||||
else if (au->salt_len == SCRAMBLE_LENGTH_323)
|
|
||||||
{
|
|
||||||
make_password_from_salt_323(passwd_buff, (ulong *) au->salt);
|
|
||||||
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_PASSWD_LENGTH,
|
|
||||||
ER(ER_PASSWD_LENGTH), SCRAMBLED_PASSWORD_CHAR_LENGTH);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
combo->password.str= passwd_buff;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (au->plugin.str != native_password_plugin_name.str &&
|
if (au->plugin.str != native_password_plugin_name.str &&
|
||||||
au->plugin.str != old_password_plugin_name.str)
|
au->plugin.str != old_password_plugin_name.str)
|
||||||
{
|
|
||||||
combo->plugin= au->plugin;
|
combo->plugin= au->plugin;
|
||||||
combo->auth= au->auth_string;
|
combo->auth= au->auth_string;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_list.push_back(combo))
|
if (user_list.push_back(combo))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user