Skip to content

Commit e7e1254

Browse files
committed
Add support for caching_sha2_password in change user authentication
Same as for connection handshakes.
1 parent 03ee36d commit e7e1254

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ext/mysqlnd/mysqlnd_auth.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ mysqlnd_run_authentication(
138138
ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent,
139139
first_call,
140140
requested_protocol,
141+
auth_plugin, plugin_data, plugin_data_len,
141142
scrambled_data, scrambled_data_len,
142143
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
143144
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
@@ -377,6 +378,9 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
377378
const zend_bool silent,
378379
const zend_bool use_full_blown_auth_packet,
379380
const char * const auth_protocol,
381+
struct st_mysqlnd_authentication_plugin * auth_plugin,
382+
const zend_uchar * const orig_auth_plugin_data,
383+
const size_t orig_auth_plugin_data_len,
380384
const zend_uchar * const auth_plugin_data,
381385
const size_t auth_plugin_data_len,
382386
char ** switch_to_auth_protocol,
@@ -442,6 +446,15 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
442446
PACKET_FREE(&auth_packet);
443447
}
444448

449+
if (auth_plugin && auth_plugin->methods.handle_server_response) {
450+
if (FAIL == auth_plugin->methods.handle_server_response(auth_plugin, conn,
451+
orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len,
452+
switch_to_auth_protocol, switch_to_auth_protocol_len,
453+
switch_to_auth_protocol_data, switch_to_auth_protocol_data_len)) {
454+
goto end;
455+
}
456+
}
457+
445458
ret = PACKET_READ(conn, &chg_user_resp);
446459
COPY_CLIENT_ERROR(conn->error_info, chg_user_resp.error_info);
447460

ext/mysqlnd/mysqlnd_auth.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
5353
const zend_bool silent,
5454
const zend_bool use_full_blown_auth_packet,
5555
const char * const auth_protocol,
56+
struct st_mysqlnd_authentication_plugin * auth_plugin,
57+
const zend_uchar * const orig_auth_plugin_data,
58+
const size_t orig_auth_plugin_data_len,
5659
const zend_uchar * auth_plugin_data,
5760
const size_t auth_plugin_data_len,
5861
char ** switch_to_auth_protocol,

0 commit comments

Comments
 (0)