diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-27 16:07:28 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-27 17:27:45 +0100 |
commit | 813d4a00b4ce912e58c090f9bb1d0bdd74baf68c (patch) | |
tree | a399a1b419aa1e59d6b496d40761531b9c9e50f7 /ext/mysqlnd/mysqlnd_auth.c | |
parent | e7e1254f3e41db8f92b85b25658f393f7f5bce66 (diff) | |
download | php-git-813d4a00b4ce912e58c090f9bb1d0bdd74baf68c.tar.gz |
Handle error response during caching_sha2_password auth
In particular, this fixes handling of expired passwords.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_auth.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_auth.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index c4bd53d8c3..2a5924a531 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -1073,6 +1073,13 @@ mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plu } switch (result_packet.response_code) { + case 0xFF: + if (result_packet.sqlstate[0]) { + strlcpy(conn->error_info->sqlstate, result_packet.sqlstate, sizeof(conn->error_info->sqlstate)); + DBG_ERR_FMT("ERROR:%u [SQLSTATE:%s] %s", result_packet.error_no, result_packet.sqlstate, result_packet.error); + } + SET_CLIENT_ERROR(conn->error_info, result_packet.error_no, UNKNOWN_SQLSTATE, result_packet.error); + DBG_RETURN(FAIL); case 0xFE: DBG_INF("auth switch response"); *new_auth_protocol = result_packet.new_auth_protocol; |