diff options
author | Andrey Hristov <andrey@php.net> | 2011-01-14 13:00:42 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2011-01-14 13:00:42 +0000 |
commit | 5ca5c2bf43c292b687642adb4b239d651384713e (patch) | |
tree | c9a9b72a3c04ccc44579a68834409b7f5fc31772 /ext/mysqlnd/mysqlnd.c | |
parent | 0048446fddb506a06a37ed7c0f31a28ba4d7d215 (diff) | |
download | php-git-5ca5c2bf43c292b687642adb4b239d651384713e.tar.gz |
Change things to allow passing of the password length
to mysqlnd. This is needed as a password might include
a \0 and thus we need to be binary safe.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 94cd5b89a8..abf33e1788 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -497,6 +497,7 @@ mysqlnd_connect_run_authentication( const char * const passwd, const char * const db, size_t db_len, + size_t passwd_len, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, unsigned long mysql_flags @@ -530,7 +531,7 @@ mysqlnd_connect_run_authentication( DBG_INF("plugin found"); - ret = auth_plugin->methods.auth_handshake(conn, user, passwd, db, db_len, greet_packet, options, mysql_flags, + ret = auth_plugin->methods.auth_handshake(conn, user, passwd, db, db_len, passwd_len, greet_packet, options, mysql_flags, &switch_to_auth_protocol TSRMLS_CC); DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a"); } while (ret == FAIL && switch_to_auth_protocol != NULL); @@ -729,7 +730,9 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn, } #endif - if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, greet_packet, &conn->options, mysql_flags TSRMLS_CC)) { + if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len, + greet_packet, &conn->options, mysql_flags TSRMLS_CC)) + { goto err; } @@ -1912,7 +1915,9 @@ MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn, const char *user, const char *passwd, const char *db, - zend_bool silent TSRMLS_DC) + zend_bool silent, + size_t passwd_len + TSRMLS_DC) { /* User could be max 16 * 3 (utf8), pass is 20 usually, db is up to 64*3 @@ -1962,7 +1967,7 @@ MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn, break; } DBG_INF("plugin found"); - ret = auth_plugin->methods.auth_change_user(conn, user, strlen(user), passwd, db, strlen(db), silent, &switch_to_auth_protocol TSRMLS_CC); + ret = auth_plugin->methods.auth_change_user(conn, user, strlen(user), passwd, db, strlen(db), passwd_len, silent, &switch_to_auth_protocol TSRMLS_CC); DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a"); } while (ret == FAIL && switch_to_auth_protocol != NULL); if (ret == PASS) { |