summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_auth.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-27 14:40:54 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-27 17:27:45 +0100
commite7e1254f3e41db8f92b85b25658f393f7f5bce66 (patch)
tree0599a92308f349bd8ce5a0d5d0acd52201966530 /ext/mysqlnd/mysqlnd_auth.c
parent03ee36d1c526b402e1e5f283ee6f1631f3f61982 (diff)
downloadphp-git-e7e1254f3e41db8f92b85b25658f393f7f5bce66.tar.gz
Add support for caching_sha2_password in change user authentication
Same as for connection handshakes.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_auth.c')
-rw-r--r--ext/mysqlnd/mysqlnd_auth.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index a1aaebd9da..c4bd53d8c3 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.c
@@ -138,6 +138,7 @@ mysqlnd_run_authentication(
ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent,
first_call,
requested_protocol,
+ auth_plugin, plugin_data, plugin_data_len,
scrambled_data, scrambled_data_len,
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
@@ -377,6 +378,9 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
const zend_bool silent,
const zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
+ struct st_mysqlnd_authentication_plugin * auth_plugin,
+ const zend_uchar * const orig_auth_plugin_data,
+ const size_t orig_auth_plugin_data_len,
const zend_uchar * const auth_plugin_data,
const size_t auth_plugin_data_len,
char ** switch_to_auth_protocol,
@@ -442,6 +446,15 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
PACKET_FREE(&auth_packet);
}
+ if (auth_plugin && auth_plugin->methods.handle_server_response) {
+ if (FAIL == auth_plugin->methods.handle_server_response(auth_plugin, conn,
+ orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len,
+ switch_to_auth_protocol, switch_to_auth_protocol_len,
+ switch_to_auth_protocol_data, switch_to_auth_protocol_data_len)) {
+ goto end;
+ }
+ }
+
ret = PACKET_READ(conn, &chg_user_resp);
COPY_CLIENT_ERROR(conn->error_info, chg_user_resp.error_info);