Skip to content

Commit 32cd373

Browse files
committed
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.
1 parent 813d4a0 commit 32cd373

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/mysqlnd/mysqlnd_auth.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,13 @@ mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plu
10661066
{
10671067
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
10681068
MYSQLND_PACKET_CACHED_SHA2_RESULT result_packet;
1069-
conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&result_packet);
10701069

1070+
if (passwd_len == 0) {
1071+
DBG_INF("empty password fast path");
1072+
DBG_RETURN(PASS);
1073+
}
1074+
1075+
conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&result_packet);
10711076
if (FAIL == PACKET_READ(conn, &result_packet)) {
10721077
DBG_RETURN(PASS);
10731078
}

0 commit comments

Comments
 (0)