@@ -596,11 +596,15 @@ mysqlnd_run_authentication(
596
596
struct st_mysqlnd_authentication_plugin * auth_plugin = conn -> m -> fetch_auth_plugin_by_name (requested_protocol );
597
597
598
598
if (!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
+ }
602
607
}
603
- DBG_INF ("plugin found" );
604
608
605
609
{
606
610
zend_uchar * switch_to_auth_protocol_data = NULL ;
@@ -625,9 +629,12 @@ mysqlnd_run_authentication(
625
629
626
630
DBG_INF_FMT ("salt(%d)=[%.*s]" , plugin_data_len , plugin_data_len , plugin_data );
627
631
/* 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
+
631
638
if (conn -> error_info -> error_no ) {
632
639
goto end ;
633
640
}
0 commit comments