diff options
author | unknown <kostja@oak.local> | 2003-07-09 18:24:43 +0400 |
---|---|---|
committer | unknown <kostja@oak.local> | 2003-07-09 18:24:43 +0400 |
commit | 04a75388e4e127652685bb8010d04fbb7c5e3b0b (patch) | |
tree | 9774a7006312380fb4dbc92767fe0c009a485b12 /libmysql | |
parent | 531a5d76bf5c38589df89985fa43b6a0d215b28e (diff) | |
parent | db3e9344d6ccfd5b39d8fa2499e5dcb2ed90f808 (diff) | |
download | mariadb-git-04a75388e4e127652685bb8010d04fbb7c5e3b0b.tar.gz |
resolved conflict with pulled changeset
include/mysql.h:
Auto merged
include/mysql_com.h:
Auto merged
libmysql/libmysql.c:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_create.h:
Auto merged
sql/lex.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
include/mysqld_error.h:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/set_var.h:
manually resolved conflict
sql/share/czech/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/danish/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/dutch/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/english/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/estonian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/french/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/german/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/greek/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/hungarian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/italian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/japanese/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/korean/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/norwegian-ny/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/norwegian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/polish/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/portuguese/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/romanian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/russian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/serbian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/slovak/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/spanish/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/swedish/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
sql/share/ukrainian/errmsg.txt:
manually resolved conflict with ER_VARIABLE_IS_NOT_STRUCT
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 1461d2fa128..ee7fd6a2576 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -616,41 +616,53 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, /* Store user into the buffer */ end=strmov(end,user)+1; - /* - We always start with old type handshake the only difference is message sent - If server handles secure connection type we'll not send the real scramble - */ - if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + /* write scrambled password according to server capabilities */ + if (passwd[0]) { - if (passwd[0]) + if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) { - /* Prepare false scramble */ - bfill(end, SCRAMBLE_LENGTH, 'x'); - end+=SCRAMBLE_LENGTH; - *end=0; - + *end++= SCRAMBLE_LENGTH; + scramble(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH; } - else /* For empty password */ - *end=0; /* zero length scramble */ + else + end= scramble_323(end, mysql->scramble_323, passwd); } else - { - /* - Real scramble is only sent to old servers. This can be blocked - by calling mysql_options(MYSQL *, MYSQL_SECURE_CONNECT, (char*) &1); - */ - end=scramble(end, mysql->scramble_buff, passwd, - (my_bool) (mysql->protocol_version == 9)); - } + *end++= '\0'; // empty password /* Add database if needed */ - end=strmov(end+1,db ? db : ""); + end= strmov(end, db ? db : "") + 1; /* Write authentication package */ simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1); - if (mysql_autenticate(mysql, passwd)) + NET *net= &mysql->net; + ulong pkt_length= net_safe_read(mysql); + + if (pkt_length == packet_error) goto error; + if (net->read_pos[0] == mysql->scramble_323[0] && + pkt_length == SCRAMBLE_LENGTH_323 + 1 && + mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + /* + By sending this very specific reply server asks us to send scrambled + password in old format. The reply contains scramble_323. + */ + scramble_323(buff, mysql->scramble_323, passwd); + if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net)) + { + net->last_errno= CR_SERVER_LOST; + strmov(net->sqlstate, unknown_sqlstate); + strmov(net->last_error,ER(net->last_errno)); + goto error; + } + /* Read what server thinks about out new auth message report */ + if (net_safe_read(mysql) == packet_error) + goto error; + } + /* Free old connect information */ my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); |