Commit 46ec0c5d authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Removed compiler warnings

parent 88cd4126
......@@ -34,6 +34,7 @@ int main(int argc, char **argv)
exit(1);
}
mysql_init(&mysql);
if (!(sock = mysql_real_connect(&mysql,NULL,NULL,NULL,argv[1],0,NULL,0)))
{
fprintf(stderr,"Couldn't connect to engine!\n%s\n",mysql_error(&mysql));
......
......@@ -2317,10 +2317,10 @@ Try also with PIPE or TCP/IP
/* Store copy as we'll need it later */
memcpy(password_hash,buff,SCRAMBLE41_LENGTH);
/* Finally hash complete password using hash we got from server */
password_hash_stage2(password_hash,net->read_pos);
password_hash_stage2(password_hash,(const char*) net->read_pos);
/* Decypt and store scramble 4 = hash for stage2 */
password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash,
SCRAMBLE41_LENGTH);
password_crypt((const char*) net->read_pos+4,mysql->scramble_buff,
password_hash, SCRAMBLE41_LENGTH);
mysql->scramble_buff[SCRAMBLE41_LENGTH]=0;
/* Encode scramble with password. Recycle buffer */
password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH);
......@@ -2534,10 +2534,10 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
/* Store copy as we'll need it later */
memcpy(password_hash,buff,SCRAMBLE41_LENGTH);
/* Finally hash complete password using hash we got from server */
password_hash_stage2(password_hash,net->read_pos);
password_hash_stage2(password_hash, (const char*) net->read_pos);
/* Decypt and store scramble 4 = hash for stage2 */
password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash,
SCRAMBLE41_LENGTH);
password_crypt((const char*) net->read_pos+4, mysql->scramble_buff,
password_hash, SCRAMBLE41_LENGTH);
mysql->scramble_buff[SCRAMBLE41_LENGTH]=0;
/* Encode scramble with password. Recycle buffer */
password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH);
......@@ -2547,8 +2547,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
/* Create password to decode scramble */
create_key_from_old_password(passwd,password_hash);
/* Decypt and store scramble 4 = hash for stage2 */
password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash,
SCRAMBLE41_LENGTH);
password_crypt((const char*) net->read_pos+4,mysql->scramble_buff,
password_hash, SCRAMBLE41_LENGTH);
mysql->scramble_buff[SCRAMBLE41_LENGTH]=0;
/* Finally scramble decoded scramble with password */
scramble(buff, mysql->scramble_buff, passwd,
......@@ -4059,7 +4059,7 @@ static void store_param_str(NET *net, MYSQL_BIND *param)
ulong length= *param->length;
char *to= (char *) net_store_length((char *) net->write_pos, length);
memcpy(to, param->buffer, length);
net->write_pos= to+length;
net->write_pos= (uchar*) to+length;
}
......@@ -4211,7 +4211,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
}
length= (ulong) (net->write_pos - net->buff);
/* TODO: Look into avoding the following memdup */
if (!(param_data= my_memdup( net->buff, length, MYF(0))))
if (!(param_data= my_memdup((const char*) net->buff, length, MYF(0))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY);
DBUG_RETURN(1);
......@@ -4538,19 +4538,22 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length)
switch(param->buffer_type) {
case MYSQL_TYPE_TINY:
{
uchar data= (uchar)my_strntol(system_charset_info,value,length,10,NULL,&err);
uchar data= (uchar)my_strntol(system_charset_info,value,length,10,NULL,
&err);
*buffer= data;
break;
}
case MYSQL_TYPE_SHORT:
{
short data= (short)my_strntol(system_charset_info,value,length,10,NULL,&err);
short data= (short)my_strntol(system_charset_info,value,length,10,NULL,
&err);
int2store(buffer, data);
break;
}
case MYSQL_TYPE_LONG:
{
int32 data= (int32)my_strntol(system_charset_info,value,length,10,NULL,&err);
int32 data= (int32)my_strntol(system_charset_info,value,length,10,NULL,
&err);
int4store(buffer, data);
break;
}
......@@ -4738,7 +4741,7 @@ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param,
}
default:
length= net_field_length(row);
send_data_str(param,*row,length);
send_data_str(param,(char*) *row,length);
break;
}
*row+= length;
......
......@@ -236,7 +236,7 @@ void password_hash_stage1(char *to, const char *password)
{
if (*password == ' ' || *password == '\t')
continue;/* skip space in password */
sha1_input(&context,(int8*)&password[0],1);
sha1_input(&context,(uint8*) &password[0],1);
}
sha1_result(&context,(uint8*)to);
}
......@@ -259,9 +259,9 @@ void password_hash_stage2(char *to,const char *salt)
{
SHA1_CONTEXT context;
sha1_reset(&context);
sha1_input(&context,(uint8*)salt,4);
sha1_input(&context,to,SHA1_HASH_SIZE);
sha1_result(&context,(uint8*)to);
sha1_input(&context,(uint8*) salt, 4);
sha1_input(&context,(uint8*) to, SHA1_HASH_SIZE);
sha1_result(&context,(uint8*) to);
}
......@@ -295,14 +295,14 @@ void make_scrambled_password(char *to,const char *password,
else /* New password 4.1 password scrambling */
{
to[0]=PVERSION41_CHAR; /* New passwords have version prefix */
/* Random returns number from 0 to 1 so this would be good salt generation.*/
/* Rnd returns number from 0 to 1 so this would be good salt generation.*/
salt=rnd(rand_st)*65535+1;
/* Use only 2 first bytes from it */
sprintf(to+1,"%04x",salt);
/* First hasing is done without salt */
password_hash_stage1(digest,password);
password_hash_stage1((char*) digest, password);
/* Second stage is done with salt */
password_hash_stage2(digest,(char*)to+1),
password_hash_stage2((char*) digest,(char*)to+1),
/* Print resulting hash into the password*/
sprintf(to+5,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
......@@ -376,7 +376,7 @@ my_bool validate_password(const char* password, const char* message,
password_hash_stage2(buffer,tmpsalt);
/* Convert password to salt to compare */
get_salt_from_bin_password(salt_candidate,buffer,salt[0]);
get_salt_from_bin_password(salt_candidate,(uchar*) buffer,salt[0]);
/* Now we shall get exactly the same password as we have stored for user */
for (salt_end=salt+5 ; salt < salt_end; )
......
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