@@ -99,6 +99,8 @@ std::mutex callback_mutex;
99
99
100
100
sql::Fido_Callback * fido_callback_instance = nullptr ;
101
101
102
+ bool oci_plugin_is_loaded = false ;
103
+
102
104
static void fido_callback_func (const char * msg)
103
105
{
104
106
if (!fido_callback_instance)
@@ -1023,6 +1025,7 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
1023
1025
" authentication_oci_client" ,
1024
1026
" oci-config-file" ,
1025
1027
*p_s);
1028
+ oci_plugin_is_loaded = true ;
1026
1029
} catch (sql::InvalidArgumentException &e) {
1027
1030
throw ::sql::SQLUnsupportedOptionException (
1028
1031
" Failed to set config file for authentication_oci_client plugin" ,
@@ -1042,6 +1045,7 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
1042
1045
proxy->plugin_option (MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1043
1046
" authentication_oci_client" ,
1044
1047
" authentication-oci-client-config-profile" , *p_s);
1048
+ oci_plugin_is_loaded = true ;
1045
1049
} catch (sql::InvalidArgumentException &e) {
1046
1050
throw ::sql::SQLUnsupportedOptionException (
1047
1051
" Failed to set config profile for authentication_oci_client plugin" ,
@@ -1096,6 +1100,34 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
1096
1100
1097
1101
} /* End of cycle on connection options map */
1098
1102
1103
+ if (oci_plugin_is_loaded) {
1104
+ if (properties.find (OPT_OCI_CONFIG_FILE) == properties.end ()) {
1105
+ // If OCI plugin is loaded, but oci-config-file is not explicitly set
1106
+ // the option value needs resetting.
1107
+ try {
1108
+ proxy->plugin_option (MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1109
+ " authentication_oci_client" ,
1110
+ " oci-config-file" ,
1111
+ nullptr );
1112
+ } catch (sql::InvalidArgumentException &) {
1113
+ // Do nothing, the exception is expected.
1114
+ }
1115
+ }
1116
+
1117
+ if (properties.find (OPT_OCI_CLIENT_CONFIG_PROFILE) == properties.end ()) {
1118
+ // If OCI plugin is loaded, but oci-config-profile is not explicitly set
1119
+ // the option value needs resetting.
1120
+ try {
1121
+ proxy->plugin_option (MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
1122
+ " authentication_oci_client" ,
1123
+ " authentication-oci-client-config-profile" ,
1124
+ nullptr );
1125
+ } catch (sql::InvalidArgumentException &) {
1126
+ // Do nothing, the exception is expected.
1127
+ }
1128
+ }
1129
+
1130
+ }
1099
1131
1100
1132
#undef PROCESS_CONNSTR_OPTION
1101
1133
0 commit comments