FAQ
rnd ends up as an exported symbol in libmysqlclient, but is too generic
a name.
patch is against 4.1


===== include/mysql_com.h 1.66 vs edited =====
--- 1.66/include/mysql_com.h Fri Feb 7 14:47:07 2003
+++ edited/include/mysql_com.h Mon Mar 17 12:29:53 2003
@@ -298,7 +298,7 @@

void randominit(struct rand_struct *,unsigned long seed1,
unsigned long seed2);
-double rnd(struct rand_struct *);
+double my_rnd(struct rand_struct *);
void make_scrambled_password(char *to,const char *password,
my_bool force_old_scramble,struct rand_struct *rand_st);
int get_password_length(my_bool force_old_scramble);
===== sql/item_func.cc 1.121 vs edited =====
--- 1.121/sql/item_func.cc Thu Mar 13 12:34:32 2003
+++ edited/sql/item_func.cc Mon Mar 17 12:27:40 2003
@@ -840,7 +840,7 @@

double Item_func_rand::val()
{
- return rnd(rand);
+ return my_rnd(rand);
}

longlong Item_func_sign::val_int()
===== sql/mysqld.cc 1.344 vs edited =====
--- 1.344/sql/mysqld.cc Thu Mar 13 11:12:15 2003
+++ edited/sql/mysqld.cc Mon Mar 17 12:28:08 2003
@@ -2759,7 +2759,7 @@
max_used_connections=thread_count-delayed_insert_threads;
thd->thread_id=thread_id++;
for (uint i=0; i < 8 ; i++) // Generate password
teststring
- thd->scramble[i]= (char) (rnd(&sql_rand)*94+33);
+ thd->scramble[i]= (char) (my_rnd(&sql_rand)*94+33);
thd->scramble[8]=0;
// Back it up as old clients may need it
memcpy(thd->old_scramble,thd->scramble,9);
===== sql/password.c 1.22 vs edited =====
--- 1.22/sql/password.c Wed Feb 12 20:55:33 2003
+++ edited/sql/password.c Mon Mar 17 12:30:48 2003
@@ -118,14 +118,14 @@
Generate Random number

SYNOPSIS
- rnd()
+ my_rnd()
rand_st INOUT Structure used for number generation

RETURN
Generated pseudo random number
*/

-double rnd(struct rand_struct *rand_st)
+double my_rnd(struct rand_struct *rand_st)
{
rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
@@ -152,7 +152,7 @@
char *end=target+length;
/* Use pointer arithmetics as it is faster way to do so. */
for (; target<end ; target++)
- *target= (char) (rnd(rand_st)*94+33);
+ *target= (char) (my_rnd(rand_st)*94+33);
}


@@ -293,7 +293,7 @@
{
to[0]=PVERSION41_CHAR; /* New passwords have version prefix */
/* Rnd returns number from 0 to 1 so this would be good salt
generation.*/
- salt=(unsigned short) (rnd(rand_st)*65535+1);
+ salt=(unsigned short) (my_rnd(rand_st)*65535+1);
/* Use only 2 first bytes from it */
sprintf(to+1,"%04x",salt);
/* First hasing is done without salt */
@@ -652,10 +652,10 @@
randominit(&rand_st,hash_pass[0] ^ hash_message[0],
hash_pass[1] ^ hash_message[1]);
while (*msg++)
- *to++= (char) (floor(rnd(&rand_st)*31)+64);
+ *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
if (!old_ver)
{ /* Make it harder to
break */
- char extra=(char) (floor(rnd(&rand_st)*31));
+ char extra=(char) (floor(my_rnd(&rand_st)*31));
while (to_start != to)
*(to_start++)^=extra;
}
@@ -711,11 +711,11 @@
hash_pass[1] ^ hash_message[1]);
to=buff;
for (pos=scrambled ; *pos ; pos++)
- *to++=(char) (floor(rnd(&rand_st)*31)+64);
+ *to++=(char) (floor(my_rnd(&rand_st)*31)+64);
if (old_ver)
extra=0;
else
- extra=(char) (floor(rnd(&rand_st)*31));
+ extra=(char) (floor(my_rnd(&rand_st)*31));
to=buff;
while (*scrambled)
{
===== sql/sql_class.cc 1.107 vs edited =====
--- 1.107/sql/sql_class.cc Fri Feb 28 12:28:18 2003
+++ edited/sql/sql_class.cc Mon Mar 17 12:27:53 2003
@@ -186,7 +186,7 @@
*/
{
pthread_mutex_lock(&LOCK_thread_count);
- ulong tmp=(ulong) (rnd(&sql_rand) * 0xffffffff); /* make all bits
random */
+ ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all
bits random */
pthread_mutex_unlock(&LOCK_thread_count);
randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id);
}
===== sql/sql_crypt.cc 1.4 vs edited =====
--- 1.4/sql/sql_crypt.cc Thu Dec 6 13:10:46 2001
+++ edited/sql/sql_crypt.cc Mon Mar 17 12:28:25 2003
@@ -46,7 +46,7 @@

for (i=0 ; i<= 255 ; i++)
{
- int idx= (uint) (rnd(&rand)*255.0);
+ int idx= (uint) (my_rnd(&rand)*255.0);
char a= decode_buff[idx];
decode_buff[idx]= decode_buff[i];
decode_buff[+i]=a;
@@ -62,7 +62,7 @@
{
for (uint i=0; i < length; i++)
{
- shift^=(uint) (rnd(&rand)*255.0);
+ shift^=(uint) (my_rnd(&rand)*255.0);
uint idx= (uint) (uchar) str[0];
*str++ = (char) ((uchar) encode_buff[idx] ^ shift);
shift^= idx;
@@ -74,7 +74,7 @@
{
for (uint i=0; i < length; i++)
{
- shift^=(uint) (rnd(&rand)*255.0);
+ shift^=(uint) (my_rnd(&rand)*255.0);
uint idx= (uint) ((unsigned char) str[0] ^ shift);
*str = decode_buff[idx];
shift^= (uint) (uchar) *str++;

--
Dennis

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupinternals @
categoriesmysql
postedMar 17, '03 at 12:22p
activeMar 18, '03 at 9:14p
posts2
users2
websitemysql.com
irc#mysql

2 users in discussion

Lenz Grimmer: 1 post Dennis Haney: 1 post

People

Translate

site design / logo © 2021 Grokbase