mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
C cleanups
This commit is contained in:
@ -319,7 +319,7 @@ void randominit(struct rand_struct *, unsigned long seed1,
|
|||||||
double my_rnd(struct rand_struct *);
|
double my_rnd(struct rand_struct *);
|
||||||
void create_random_string(char *to, uint length, struct rand_struct *rand_st);
|
void create_random_string(char *to, uint length, struct rand_struct *rand_st);
|
||||||
|
|
||||||
void hash_password(ulong *to, const char *password, uint password_len);
|
void hash_password(unsigned long *to, const char *password, uint password_len);
|
||||||
void make_scrambled_password_323(char *to, const char *password);
|
void make_scrambled_password_323(char *to, const char *password);
|
||||||
void scramble_323(char *to, const char *message, const char *password);
|
void scramble_323(char *to, const char *message, const char *password);
|
||||||
my_bool check_scramble_323(const char *, const char *message,
|
my_bool check_scramble_323(const char *, const char *message,
|
||||||
|
@ -594,6 +594,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
const char *passwd, const char *db)
|
const char *passwd, const char *db)
|
||||||
{
|
{
|
||||||
char buff[512],*end=buff;
|
char buff[512],*end=buff;
|
||||||
|
NET *net= &mysql->net;
|
||||||
|
ulong pkt_length;
|
||||||
DBUG_ENTER("mysql_change_user");
|
DBUG_ENTER("mysql_change_user");
|
||||||
|
|
||||||
if (!user)
|
if (!user)
|
||||||
@ -627,8 +629,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
/* Write authentication package */
|
/* Write authentication package */
|
||||||
simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
|
simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
|
||||||
|
|
||||||
NET *net= &mysql->net;
|
pkt_length= net_safe_read(mysql);
|
||||||
ulong pkt_length= net_safe_read(mysql);
|
|
||||||
|
|
||||||
if (pkt_length == packet_error)
|
if (pkt_length == packet_error)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -170,15 +170,15 @@ void scramble_323(char *to, const char *message, const char *password)
|
|||||||
|
|
||||||
if (password && password[0])
|
if (password && password[0])
|
||||||
{
|
{
|
||||||
char *to_start=to;
|
char extra, *to_start=to;
|
||||||
|
const char *message_end= message + SCRAMBLE_LENGTH_323;
|
||||||
hash_password(hash_pass,password, strlen(password));
|
hash_password(hash_pass,password, strlen(password));
|
||||||
hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
|
hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
|
||||||
randominit(&rand_st,hash_pass[0] ^ hash_message[0],
|
randominit(&rand_st,hash_pass[0] ^ hash_message[0],
|
||||||
hash_pass[1] ^ hash_message[1]);
|
hash_pass[1] ^ hash_message[1]);
|
||||||
const char *message_end= message + SCRAMBLE_LENGTH_323;
|
|
||||||
for (; message < message_end; message++)
|
for (; message < message_end; message++)
|
||||||
*to++= (char) (floor(my_rnd(&rand_st)*31)+64);
|
*to++= (char) (floor(my_rnd(&rand_st)*31)+64);
|
||||||
char extra=(char) (floor(my_rnd(&rand_st)*31));
|
extra=(char) (floor(my_rnd(&rand_st)*31));
|
||||||
while (to_start != to)
|
while (to_start != to)
|
||||||
*(to_start++)^=extra;
|
*(to_start++)^=extra;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user