@@ -596,11 +596,15 @@ mysqlnd_run_authentication(
596596struct st_mysqlnd_authentication_plugin * auth_plugin = conn -> m -> fetch_auth_plugin_by_name (requested_protocol );
597597
598598if (!auth_plugin ) {
599- php_error_docref (NULL , E_WARNING , "The server requested authentication method unknown to the client [%s]" , requested_protocol );
600- SET_CLIENT_ERROR (* conn -> error_info , CR_NOT_IMPLEMENTED , UNKNOWN_SQLSTATE , "The server requested authentication method unknown to the client" );
601- goto end ;
599+ if (first_call ) {
600+ mnd_pefree (requested_protocol , FALSE);
601+ requested_protocol = mnd_pestrdup (MYSQLND_DEFAULT_AUTH_PROTOCOL , FALSE);
602+ } else {
603+ php_error_docref (NULL , E_WARNING , "The server requested authentication method unknown to the client [%s]" , requested_protocol );
604+ SET_CLIENT_ERROR (* conn -> error_info , CR_NOT_IMPLEMENTED , UNKNOWN_SQLSTATE , "The server requested authentication method unknown to the client" );
605+ goto end ;
606+ }
602607}
603- DBG_INF ("plugin found" );
604608
605609{
606610zend_uchar * switch_to_auth_protocol_data = NULL ;
@@ -625,9 +629,12 @@ mysqlnd_run_authentication(
625629
626630DBG_INF_FMT ("salt(%d)=[%.*s]" , plugin_data_len , plugin_data_len , plugin_data );
627631/* The data should be allocated with malloc() */
628- scrambled_data =
629- auth_plugin -> methods .get_auth_data (NULL , & scrambled_data_len , conn , user , passwd , passwd_len ,
630- plugin_data , plugin_data_len , options , & conn -> net -> data -> options , mysql_flags );
632+ if (auth_plugin ) {
633+ scrambled_data =
634+ auth_plugin -> methods .get_auth_data (NULL , & scrambled_data_len , conn , user , passwd , passwd_len ,
635+ plugin_data , plugin_data_len , options , & conn -> net -> data -> options , mysql_flags );
636+ }
637+
631638if (conn -> error_info -> error_no ) {
632639goto end ;
633640}
0 commit comments