Skip to content

Commit 8c7ba85

Browse files
committed
Drop extranous parameter
1 parent b17b699 commit 8c7ba85

File tree

6 files changed

+14
-24
lines changed

6 files changed

+14
-24
lines changed

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
7474
- ext/mbstring:
7575
. Added GB18030-2022 to default encoding list for zh-CN.
7676

77+
- ext/mysqlnd:
78+
. Dropped session_options parameter from all methods in mysqlnd_auth.
79+
The same information is present in conn->options and should be used instead.
80+
7781
- ext/standard:
7882
. _php_error_log() now has a formal return type of zend_result.
7983
. _php_error_log() now accepts zend_string* values instead of char*.

ext/mysqlnd/mysqlnd_auth.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ mysqlnd_run_authentication(
4343
const MYSQLND_STRING auth_plugin_data,
4444
const char * const auth_protocol,
4545
const unsigned int charset_no,
46-
const MYSQLND_SESSION_OPTIONS * const session_options,
4746
const zend_ulong mysql_flags,
4847
const bool silent,
4948
const bool is_change_user
@@ -110,15 +109,15 @@ mysqlnd_run_authentication(
110109
scrambled_data = auth_plugin->methods.get_auth_data(
111110
NULL, &scrambled_data_len, conn, user, passwd,
112111
passwd_len, plugin_data, plugin_data_len,
113-
session_options, conn->protocol_frame_codec->data,
112+
conn->protocol_frame_codec->data,
114113
mysql_flags);
115114
}
116115

117116
if (conn->error_info->error_no) {
118117
goto end;
119118
}
120119
if (FALSE == is_change_user) {
121-
ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
120+
ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, mysql_flags,
122121
charset_no,
123122
first_call,
124123
requested_protocol,
@@ -177,14 +176,13 @@ static enum_func_status
177176
mysqlnd_switch_to_ssl_if_needed(MYSQLND_CONN_DATA * const conn,
178177
unsigned int charset_no,
179178
const size_t server_capabilities,
180-
const MYSQLND_SESSION_OPTIONS * const session_options,
181179
const zend_ulong mysql_flags)
182180
{
183181
enum_func_status ret = FAIL;
184182
const MYSQLND_CHARSET * charset;
185183
DBG_ENTER("mysqlnd_switch_to_ssl_if_needed");
186184

187-
if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
185+
if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
188186
charset_no = charset->nr;
189187
}
190188

@@ -210,18 +208,17 @@ mysqlnd_connect_run_authentication(
210208
const char * const authentication_protocol,
211209
const unsigned int charset_no,
212210
const size_t server_capabilities,
213-
const MYSQLND_SESSION_OPTIONS * const session_options,
214211
const zend_ulong mysql_flags
215212
)
216213
{
217214
enum_func_status ret = FAIL;
218215
DBG_ENTER("mysqlnd_connect_run_authentication");
219216

220-
ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
217+
ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, mysql_flags);
221218
if (PASS == ret) {
222219
ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
223220
authentication_plugin_data, authentication_protocol,
224-
charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
221+
charset_no, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
225222
}
226223
DBG_RETURN(ret);
227224
}
@@ -236,7 +233,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
236233
const size_t passwd_len,
237234
const char * const db,
238235
const size_t db_len,
239-
const MYSQLND_SESSION_OPTIONS * const session_options,
240236
const zend_ulong mysql_flags,
241237
const unsigned int server_charset_no,
242238
const bool use_full_blown_auth_packet,
@@ -281,8 +277,8 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
281277
conn->payload_decoder_factory->m.init_auth_packet(&auth_packet);
282278

283279
auth_packet.client_flags = mysql_flags;
284-
auth_packet.max_packet_size = session_options->max_allowed_packet;
285-
if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
280+
auth_packet.max_packet_size = conn->options->max_allowed_packet;
281+
if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
286282
auth_packet.charset_no = charset->nr;
287283
} else {
288284
auth_packet.charset_no = server_charset_no;
@@ -556,7 +552,6 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
556552
size_t * auth_data_len,
557553
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
558554
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
559-
const MYSQLND_SESSION_OPTIONS * const session_options,
560555
const MYSQLND_PFC_DATA * const pfc_data,
561556
const zend_ulong mysql_flags
562557
)
@@ -617,7 +612,6 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
617612
size_t * auth_data_len,
618613
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
619614
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
620-
const MYSQLND_SESSION_OPTIONS * const session_options,
621615
const MYSQLND_PFC_DATA * const pfc_data,
622616
const zend_ulong mysql_flags
623617
)
@@ -820,7 +814,6 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
820814
/* {{{ mysqlnd_sha256_get_rsa_key */
821815
static mysqlnd_rsa_t
822816
mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
823-
const MYSQLND_SESSION_OPTIONS * const session_options,
824817
const MYSQLND_PFC_DATA * const pfc_data
825818
)
826819
{
@@ -894,7 +887,6 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
894887
size_t * auth_data_len,
895888
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
896889
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
897-
const MYSQLND_SESSION_OPTIONS * const session_options,
898890
const MYSQLND_PFC_DATA * const pfc_data,
899891
const zend_ulong mysql_flags
900892
)
@@ -916,7 +908,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
916908
ret[passwd_len] = '\0';
917909
} else {
918910
*auth_data_len = 0;
919-
server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
911+
server_public_key = mysqlnd_sha256_get_rsa_key(conn, pfc_data);
920912

921913
if (server_public_key) {
922914
ALLOCA_FLAG(use_heap);
@@ -1095,7 +1087,6 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
10951087
size_t * auth_data_len,
10961088
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
10971089
const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
1098-
const MYSQLND_SESSION_OPTIONS * const session_options,
10991090
const MYSQLND_PFC_DATA * const pfc_data,
11001091
const zend_ulong mysql_flags
11011092
)

ext/mysqlnd/mysqlnd_auth.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
2424
const size_t passwd_len,
2525
const char * const db,
2626
const size_t db_len,
27-
const MYSQLND_SESSION_OPTIONS * const session_options,
2827
const zend_ulong mysql_flags,
2928
const unsigned int server_charset_no,
3029
const bool use_full_blown_auth_packet,
@@ -75,7 +74,6 @@ mysqlnd_connect_run_authentication(
7574
const char * const authentication_protocol,
7675
const unsigned int charset_no,
7776
const size_t server_capabilities,
78-
const MYSQLND_SESSION_OPTIONS * const session_options,
7977
const zend_ulong mysql_flags
8078
);
8179

@@ -90,7 +88,6 @@ mysqlnd_run_authentication(
9088
const MYSQLND_STRING auth_plugin_data,
9189
const char * const auth_protocol,
9290
const unsigned int charset_no,
93-
const MYSQLND_SESSION_OPTIONS * const session_options,
9491
const zend_ulong mysql_flags,
9592
const bool silent,
9693
const bool is_change_user

ext/mysqlnd/mysqlnd_commands.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,7 @@ MYSQLND_METHOD(mysqlnd_command, handshake)(MYSQLND_CONN_DATA * const conn, const
623623

624624
if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len,
625625
greet_packet.authentication_plugin_data, greet_packet.auth_protocol,
626-
greet_packet.charset_no, greet_packet.server_capabilities,
627-
conn->options, mysql_flags))
626+
greet_packet.charset_no, greet_packet.server_capabilities, mysql_flags))
628627
{
629628
goto err;
630629
}

ext/mysqlnd/mysqlnd_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
13861386
/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */
13871387
ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
13881388
conn->authentication_plugin_data, conn->options->auth_protocol,
1389-
0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
1389+
0 /*charset not used*/, conn->server_capabilities, silent, TRUE/*is_change*/);
13901390

13911391
/*
13921392
Here we should close all statements. Unbuffered queries should not be a

ext/mysqlnd/mysqlnd_structs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,6 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
13231323
size_t * auth_data_len,
13241324
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
13251325
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
1326-
const MYSQLND_SESSION_OPTIONS * const session_options,
13271326
const MYSQLND_PFC_DATA * const pfc_data, const zend_ulong mysql_flags
13281327
);
13291328

0 commit comments

Comments
 (0)