small cleanups

This commit is contained in:
Andrey Hristov 2011-01-24 13:58:18 +00:00
parent ce4e6f4db5
commit 4439bde560
3 changed files with 6 additions and 14 deletions

View File

@ -577,7 +577,7 @@ mysqlnd_connect_run_authentication(
plugin_data, plugin_data_len, options, mysql_flags TSRMLS_CC);
ret = mysqlnd_auth_handshake(conn, user, passwd, db, db_len, passwd_len, options, mysql_flags, greet_packet->charset_no,
ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, options, mysql_flags, greet_packet->charset_no,
first_call,
requested_protocol,
scrambled_data, scrambled_data_len,
@ -2084,7 +2084,7 @@ MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn,
plugin_data, plugin_data_len, 0, conn->server_capabilities TSRMLS_CC);
ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, db, strlen(db), passwd_len, silent,
ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, strlen(db), silent,
first_call,
requested_protocol,
scrambled_data, scrambled_data_len,

View File

@ -34,9 +34,9 @@ enum_func_status
mysqlnd_auth_handshake(MYSQLND * conn,
const char * const user,
const char * const passwd,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const size_t passwd_len,
const MYSQLND_OPTIONS * const options,
unsigned long mysql_flags,
unsigned int server_charset_no,
@ -158,9 +158,9 @@ mysqlnd_auth_change_user(MYSQLND * const conn,
const char * const user,
const size_t user_len,
const char * const passwd,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const size_t passwd_len,
const zend_bool silent,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
@ -172,14 +172,7 @@ mysqlnd_auth_change_user(MYSQLND * const conn,
size_t * switch_to_auth_protocol_data_len
TSRMLS_DC)
{
/*
User could be max 16 * 3 (utf8), pass is 20 usually, db is up to 64*3
Stack space is not that expensive, so use a bit more to be protected against
buffer overflows.
*/
enum_func_status ret = FAIL;
char buffer[MYSQLND_MAX_ALLOWED_USER_LEN + 1 + SCRAMBLE_LENGTH + MYSQLND_MAX_ALLOWED_DB_LEN + 1 + 2 /* charset*/ ];
char *p = buffer;
const MYSQLND_CHARSET * old_cs = conn->charset;
MYSQLND_PACKET_CHANGE_AUTH_RESPONSE * change_auth_resp_packet = NULL;
MYSQLND_PACKET_CHG_USER_RESPONSE * chg_user_resp = NULL;
@ -230,7 +223,6 @@ mysqlnd_auth_change_user(MYSQLND * const conn,
if (mysqlnd_get_server_version(conn) >= 50123) {
auth_packet->charset_no = conn->charset->nr;
p+=2;
}
if (!PACKET_WRITE(auth_packet, conn)) {

View File

@ -203,9 +203,9 @@ enum_func_status
mysqlnd_auth_handshake(MYSQLND * conn,
const char * const user,
const char * const passwd,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const size_t passwd_len,
const MYSQLND_OPTIONS * const options,
unsigned long mysql_flags,
unsigned int server_charset_no,
@ -224,9 +224,9 @@ mysqlnd_auth_change_user(MYSQLND * const conn,
const char * const user,
const size_t user_len,
const char * const passwd,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const size_t passwd_len,
const zend_bool silent,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,