diff options
author | unknown <peter@mysql.com> | 2002-11-30 20:58:53 +0300 |
---|---|---|
committer | unknown <peter@mysql.com> | 2002-11-30 20:58:53 +0300 |
commit | c09c434877547abb9243c36ddc267f59ca75a107 (patch) | |
tree | d6fd910fa1f2f46f32ad57ff34b8c30051905e04 /sql/mini_client.cc | |
parent | 05ba93c2793a1ae79f560a0fc153056f3d39ce43 (diff) | |
download | mariadb-git-c09c434877547abb9243c36ddc267f59ca75a107.tar.gz |
SCRUM: Montymise code
fix mysql_change_user() for old clients
include/mysql_com.h:
Mover global defines here
libmysql/libmysql.c:
Remove end spaces from all lines
scripts/mysql_fix_privilege_tables.sh:
Move password modification to separate alter table
sql/mini_client.cc:
Defines, fold long lines
sql/mysqld.cc:
Backup old scramble for mysql_change_user to work from old clients
sql/password.c:
Several minor optimizations
sql/sql_acl.cc:
Remove ending spaces
sql/sql_class.h:
Add old scramble for mysql_change_user to work with old clients
sql/sql_parse.cc:
Remove end spaces.
Diffstat (limited to 'sql/mini_client.cc')
-rw-r--r-- | sql/mini_client.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 7d3b10a34a9..27d6255d82a 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -490,7 +490,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, uint net_read_timeout) { char buff[NAME_LEN+USERNAME_LENGTH+100],*end,*host_info; - char password_hash[20]; + char password_hash[SCRAMBLE41_LENGTH]; my_socket sock; ulong ip_addr; struct sockaddr_in sock_addr; @@ -856,28 +856,29 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, /* Build full password hash as it is required to decode scramble */ password_hash_stage1(buff, passwd); /* Store copy as we'll need it later */ - memcpy(password_hash,buff,20); + memcpy(password_hash,buff,SCRAMBLE41_LENGTH); /* Finally hash complete password using hash we got from server */ password_hash_stage2(password_hash,(char*)net->read_pos); /* Decypt and store scramble 4 = hash for stage2 */ - password_crypt((char*)net->read_pos+4,mysql->scramble_buff,password_hash,20); - mysql->scramble_buff[20]=0; + password_crypt((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,20); + password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH); } else { /* Create password to decode scramble */ create_key_from_old_password(passwd,password_hash); /* Decypt and store scramble 4 = hash for stage2 */ - password_crypt((char*)net->read_pos+4,mysql->scramble_buff,password_hash,20); - mysql->scramble_buff[20]=0; + password_crypt((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, - (my_bool) (mysql->protocol_version == 9)); + scramble(buff, mysql->scramble_buff, passwd,0); } /* Write second package of authentication */ - if (my_net_write(net,buff,20) || net_flush(net)) + if (my_net_write(net,buff,SCRAMBLE41_LENGTH) || net_flush(net)) { net->last_errno= CR_SERVER_LOST; strmov(net->last_error,ER(net->last_errno)); |