@@ -79,11 +79,15 @@ mysqlnd_run_authentication(
7979struct st_mysqlnd_authentication_plugin * auth_plugin = conn -> m -> fetch_auth_plugin_by_name (requested_protocol );
8080
8181if (!auth_plugin ) {
82- php_error_docref (NULL , E_WARNING , "The server requested authentication method unknown to the client [%s]" , requested_protocol );
83- SET_CLIENT_ERROR (conn -> error_info , CR_NOT_IMPLEMENTED , UNKNOWN_SQLSTATE , "The server requested authentication method unknown to the client" );
84- goto end ;
82+ if (first_call ) {
83+ mnd_pefree (requested_protocol , FALSE);
84+ requested_protocol = mnd_pestrdup (MYSQLND_DEFAULT_AUTH_PROTOCOL , FALSE);
85+ } else {
86+ php_error_docref (NULL , E_WARNING , "The server requested authentication method unknown to the client [%s]" , requested_protocol );
87+ SET_CLIENT_ERROR (conn -> error_info , CR_NOT_IMPLEMENTED , UNKNOWN_SQLSTATE , "The server requested authentication method unknown to the client" );
88+ goto end ;
89+ }
8590}
86- DBG_INF ("plugin found" );
8791
8892{
8993zend_uchar * switch_to_auth_protocol_data = NULL ;
@@ -108,10 +112,13 @@ mysqlnd_run_authentication(
108112
109113DBG_INF_FMT ("salt(%d)=[%.*s]" , plugin_data_len , plugin_data_len , plugin_data );
110114/* The data should be allocated with malloc() */
111- scrambled_data =
112- auth_plugin -> methods .get_auth_data (NULL , & scrambled_data_len , conn , user , passwd , passwd_len ,
113- plugin_data , plugin_data_len , session_options ,
114- conn -> protocol_frame_codec -> data , mysql_flags );
115+ if (auth_plugin ) {
116+ scrambled_data =
117+ auth_plugin -> methods .get_auth_data (NULL , & scrambled_data_len , conn , user , passwd , passwd_len ,
118+ plugin_data , plugin_data_len , session_options ,
119+ conn -> protocol_frame_codec -> data , mysql_flags );
120+ }
121+
115122if (conn -> error_info -> error_no ) {
116123goto end ;
117124}
0 commit comments