Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
- ext/mbstring:
. Added GB18030-2022 to default encoding list for zh-CN.

- ext/mysqlnd:
. Dropped session_options parameter from all methods in mysqlnd_auth.
The same information is present in conn->options and should be used instead.

- ext/standard:
. _php_error_log() now has a formal return type of zend_result.
. _php_error_log() now accepts zend_string* values instead of char*.
Expand Down
25 changes: 8 additions & 17 deletions ext/mysqlnd/mysqlnd_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ mysqlnd_run_authentication(
const MYSQLND_STRING auth_plugin_data,
const char * const auth_protocol,
const unsigned int charset_no,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags,
const bool silent,
const bool is_change_user
Expand Down Expand Up @@ -110,15 +109,15 @@ mysqlnd_run_authentication(
scrambled_data = auth_plugin->methods.get_auth_data(
NULL, &scrambled_data_len, conn, user, passwd,
passwd_len, plugin_data, plugin_data_len,
session_options, conn->protocol_frame_codec->data,
conn->protocol_frame_codec->data,
mysql_flags);
}

if (conn->error_info->error_no) {
goto end;
}
if (FALSE == is_change_user) {
ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, mysql_flags,
charset_no,
first_call,
requested_protocol,
Expand Down Expand Up @@ -177,14 +176,13 @@ static enum_func_status
mysqlnd_switch_to_ssl_if_needed(MYSQLND_CONN_DATA * const conn,
unsigned int charset_no,
const size_t server_capabilities,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags)
{
enum_func_status ret = FAIL;
const MYSQLND_CHARSET * charset;
DBG_ENTER("mysqlnd_switch_to_ssl_if_needed");

if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
charset_no = charset->nr;
}

Expand All @@ -210,18 +208,17 @@ mysqlnd_connect_run_authentication(
const char * const authentication_protocol,
const unsigned int charset_no,
const size_t server_capabilities,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags
)
{
enum_func_status ret = FAIL;
DBG_ENTER("mysqlnd_connect_run_authentication");

ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, mysql_flags);
if (PASS == ret) {
ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
authentication_plugin_data, authentication_protocol,
charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
charset_no, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
}
DBG_RETURN(ret);
}
Expand All @@ -236,7 +233,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags,
const unsigned int server_charset_no,
const bool use_full_blown_auth_packet,
Expand Down Expand Up @@ -281,8 +277,8 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
conn->payload_decoder_factory->m.init_auth_packet(&auth_packet);

auth_packet.client_flags = mysql_flags;
auth_packet.max_packet_size = session_options->max_allowed_packet;
if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
auth_packet.max_packet_size = conn->options->max_allowed_packet;
if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
auth_packet.charset_no = charset->nr;
} else {
auth_packet.charset_no = server_charset_no;
Expand Down Expand Up @@ -556,7 +552,6 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data,
const zend_ulong mysql_flags
)
Expand Down Expand Up @@ -617,7 +612,6 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data,
const zend_ulong mysql_flags
)
Expand Down Expand Up @@ -820,7 +814,6 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
/* {{{ mysqlnd_sha256_get_rsa_key */
static mysqlnd_rsa_t
mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data
)
{
Expand Down Expand Up @@ -894,7 +887,6 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data,
const zend_ulong mysql_flags
)
Expand All @@ -916,7 +908,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
ret[passwd_len] = '\0';
} else {
*auth_data_len = 0;
server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
server_public_key = mysqlnd_sha256_get_rsa_key(conn, pfc_data);

if (server_public_key) {
ALLOCA_FLAG(use_heap);
Expand Down Expand Up @@ -1095,7 +1087,6 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data,
const zend_ulong mysql_flags
)
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqlnd/mysqlnd_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags,
const unsigned int server_charset_no,
const bool use_full_blown_auth_packet,
Expand Down Expand Up @@ -75,7 +74,6 @@ mysqlnd_connect_run_authentication(
const char * const authentication_protocol,
const unsigned int charset_no,
const size_t server_capabilities,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags
);

Expand All @@ -90,7 +88,6 @@ mysqlnd_run_authentication(
const MYSQLND_STRING auth_plugin_data,
const char * const auth_protocol,
const unsigned int charset_no,
const MYSQLND_SESSION_OPTIONS * const session_options,
const zend_ulong mysql_flags,
const bool silent,
const bool is_change_user
Expand Down
3 changes: 1 addition & 2 deletions ext/mysqlnd/mysqlnd_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,7 @@ MYSQLND_METHOD(mysqlnd_command, handshake)(MYSQLND_CONN_DATA * const conn, const

if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len,
greet_packet.authentication_plugin_data, greet_packet.auth_protocol,
greet_packet.charset_no, greet_packet.server_capabilities,
conn->options, mysql_flags))
greet_packet.charset_no, greet_packet.server_capabilities, mysql_flags))
{
goto err;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqlnd/mysqlnd_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */
ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
conn->authentication_plugin_data, conn->options->auth_protocol,
0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
0 /*charset not used*/, conn->server_capabilities, silent, TRUE/*is_change*/);

/*
Here we should close all statements. Unbuffered queries should not be a
Expand Down
1 change: 0 additions & 1 deletion ext/mysqlnd/mysqlnd_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,6 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data, const zend_ulong mysql_flags
);

Expand Down