summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_auth.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-27 16:17:10 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-27 17:27:45 +0100
commit32cd373dfd4e5b5710929c534f960694853a02e0 (patch)
treeb819896fb66ced1411c88e3b424d2bf9b2eb6338 /ext/mysqlnd/mysqlnd_auth.c
parent813d4a00b4ce912e58c090f9bb1d0bdd74baf68c (diff)
downloadphp-git-32cd373dfd4e5b5710929c534f960694853a02e0.tar.gz
Handle empty password fast path in caching_sha2_password
If an empty password is used, no additional packets are exchanged during caching_sha2_password auth. We're only looking for an OK/ERR response.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_auth.c')
-rw-r--r--ext/mysqlnd/mysqlnd_auth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index 2a5924a531..55bdb1d3fe 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.c
@@ -1066,8 +1066,13 @@ mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plu
{
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
MYSQLND_PACKET_CACHED_SHA2_RESULT result_packet;
- conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&result_packet);
+ if (passwd_len == 0) {
+ DBG_INF("empty password fast path");
+ DBG_RETURN(PASS);
+ }
+
+ conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&result_packet);
if (FAIL == PACKET_READ(conn, &result_packet)) {
DBG_RETURN(PASS);
}