diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:12:12 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:12:12 +0200 |
commit | b4a0b2c2f862ab0de853dc34e1e56f6159043e45 (patch) | |
tree | 18a0c25fdc9ac0076da19247666414a46434b85e /sql-common | |
parent | 9809f05199aeb0b67991fac41bd86f38730768dc (diff) | |
download | mariadb-git-b4a0b2c2f862ab0de853dc34e1e56f6159043e45.tar.gz |
post-merge fixes.
most tests pass.
5.3 merge is next
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 99 | ||||
-rw-r--r-- | sql-common/my_time.c | 32 |
2 files changed, 17 insertions, 114 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 21f41e4da0b..e6f1eb15c7b 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -4323,7 +4323,7 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR); /* save it in MYSQL */ - memcpy(mysql->scramble, pkt, pkt_len); + memmove(mysql->scramble, pkt, pkt_len); mysql->scramble[pkt_len] = 0; } @@ -4356,100 +4356,3 @@ static int clear_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) return res ? CR_ERROR : CR_OK; } - -/** - client authentication plugin that does native MySQL authentication - using a 20-byte (4.1+) scramble -*/ - -static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) -{ - int pkt_len; - uchar *pkt; - - if (((MCPVIO_EXT *)vio)->mysql_change_user) - { - /* - in mysql_change_user() the client sends the first packet. - we use the old scramble. - */ - pkt= (uchar*)mysql->scramble; - pkt_len= SCRAMBLE_LENGTH + 1; - } - else - { - /* read the scramble */ - if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) - return CR_ERROR; - - if (pkt_len != SCRAMBLE_LENGTH + 1) - return CR_SERVER_HANDSHAKE_ERR; - - /* save it in MYSQL */ - memcpy(mysql->scramble, pkt, SCRAMBLE_LENGTH); - mysql->scramble[SCRAMBLE_LENGTH] = 0; - } - - if (mysql->passwd[0]) - { - char scrambled[SCRAMBLE_LENGTH + 1]; - scramble(scrambled, (char*)pkt, mysql->passwd); - if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH)) - return CR_ERROR; - } - else - if (vio->write_packet(vio, 0, 0)) /* no password */ - return CR_ERROR; - - return CR_OK; -} - - -/** - client authentication plugin that does old MySQL authentication - using an 8-byte (4.0-) scramble -*/ - -static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) -{ - uchar *pkt; - int pkt_len; - - if (((MCPVIO_EXT *)vio)->mysql_change_user) - { - /* - in mysql_change_user() the client sends the first packet. - we use the old scramble. - */ - pkt= (uchar*)mysql->scramble; - pkt_len= SCRAMBLE_LENGTH_323 + 1; - } - else - { - /* read the scramble */ - if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) - return CR_ERROR; - - if (pkt_len != SCRAMBLE_LENGTH_323 + 1 && - pkt_len != SCRAMBLE_LENGTH + 1) - return CR_SERVER_HANDSHAKE_ERR; - - /* save it in MYSQL */ - memcpy(mysql->scramble, pkt, pkt_len); - mysql->scramble[pkt_len] = 0; - } - - if (mysql->passwd[0]) - { - char scrambled[SCRAMBLE_LENGTH_323 + 1]; - scramble_323(scrambled, (char*)pkt, mysql->passwd); - if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH_323 + 1)) - return CR_ERROR; - } - else - if (vio->write_packet(vio, 0, 0)) /* no password */ - return CR_ERROR; - - return CR_OK; -} - diff --git a/sql-common/my_time.c b/sql-common/my_time.c index f5ac64b2d80..d76ec58d623 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1025,30 +1025,30 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type) int my_time_to_str(const MYSQL_TIME *l_time, char *to) { uint extra_hours= 0; - return my_sprintf(to, (to, "%s%02u:%02u:%02u", - (l_time->neg ? "-" : ""), - extra_hours+ l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%s%02u:%02u:%02u", + (l_time->neg ? "-" : ""), + extra_hours+ l_time->hour, + l_time->minute, + l_time->second); } int my_date_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u", - l_time->year, - l_time->month, - l_time->day)); + return sprintf(to, "%04u-%02u-%02u", + l_time->year, + l_time->month, + l_time->day); } int my_datetime_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u", - l_time->year, - l_time->month, - l_time->day, - l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%04u-%02u-%02u %02u:%02u:%02u", + l_time->year, + l_time->month, + l_time->day, + l_time->hour, + l_time->minute, + l_time->second); } |