Skip to content

Commit 804b950

Browse files
committed
It is possible that change user tries an user who has old password.
Instead of error message that doesn't say much there is more information now.
1 parent 0cbfc91 commit 804b950

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

ext/mysqlnd/mysqlnd.c

+4
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,10 @@ MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn,
18631863
}
18641864
conn->charset = conn->greet_charset;
18651865
memset(&conn->upsert_status, 0, sizeof(conn->upsert_status));
1866+
} else if (ret == FAIL && chg_user_resp->server_asked_323_auth == TRUE) {
1867+
/* old authentication with new server !*/
1868+
DBG_ERR(mysqlnd_old_passwd);
1869+
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
18661870
}
18671871

18681872
SET_ERROR_AFF_ROWS(conn);

ext/mysqlnd/mysqlnd_wireprotocol.c

+1
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,7 @@ php_mysqlnd_chg_user_read(void *_packet, MYSQLND *conn TSRMLS_DC)
16931693
}
16941694

16951695
if (ERROR_MARKER == packet->field_count) {
1696+
packet->server_asked_323_auth = TRUE;
16961697
php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
16971698
packet->error_info.error,
16981699
sizeof(packet->error_info.error),

ext/mysqlnd/mysqlnd_wireprotocol.h

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ typedef struct st_mysqlnd_packet_chg_user_resp {
245245
uint16_t server_capabilities;
246246
/* If error packet, we use these */
247247
MYSQLND_ERROR_INFO error_info;
248+
zend_bool server_asked_323_auth;
248249
} MYSQLND_PACKET_CHG_USER_RESPONSE;
249250

250251

0 commit comments

Comments
 (0)