Bug #56767: Make sure client plugins in 1054 are compatible with
connectors plugins Implemented changes needed to keep the client plugin API compatible with the existing plugins : 1. Provided an options() client plugin API to let the application pass options to the plugin after loading it 2. Added "License" (const char *) to specify the client plugin's license 3. Added "mysql_api" as a placeholder that the client library can use to pass function pointers to the plugin so that the plugin can call the C lib back. 4. Updated the existing client plugins to comply with the API change. 5. Added more detailed error message generation for Windows.
This commit is contained in:
parent
dd2e3db48f
commit
fee2a518b4
@ -50,8 +50,11 @@
|
|||||||
const char *author; \
|
const char *author; \
|
||||||
const char *desc; \
|
const char *desc; \
|
||||||
unsigned int version[3]; \
|
unsigned int version[3]; \
|
||||||
|
const char *license; \
|
||||||
|
void *mysql_api; \
|
||||||
int (*init)(char *, size_t, int, va_list); \
|
int (*init)(char *, size_t, int, va_list); \
|
||||||
int (*deinit)();
|
int (*deinit)(); \
|
||||||
|
int (*options)(const char *option, const void *);
|
||||||
|
|
||||||
struct st_mysql_client_plugin
|
struct st_mysql_client_plugin
|
||||||
{
|
{
|
||||||
@ -142,5 +145,20 @@ struct st_mysql_client_plugin *
|
|||||||
mysql_client_register_plugin(struct st_mysql *mysql,
|
mysql_client_register_plugin(struct st_mysql *mysql,
|
||||||
struct st_mysql_client_plugin *plugin);
|
struct st_mysql_client_plugin *plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
set plugin options
|
||||||
|
|
||||||
|
Can be used to set extra options and affect behavior for a plugin.
|
||||||
|
This function may be called multiple times to set several options
|
||||||
|
|
||||||
|
@param plugin an st_mysql_client_plugin structure
|
||||||
|
@param option a string which specifies the option to set
|
||||||
|
@param value value for the option.
|
||||||
|
|
||||||
|
@retval 0 on success, 1 in case of failure
|
||||||
|
**/
|
||||||
|
int STDCALL mysql_plugin_options(struct st_mysql_client_plugin *plugin,
|
||||||
|
const char *option,
|
||||||
|
const void *value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -104,3 +104,4 @@ EXPORTS
|
|||||||
mysql_server_end
|
mysql_server_end
|
||||||
mysql_set_character_set
|
mysql_set_character_set
|
||||||
mysql_get_character_set_info
|
mysql_get_character_set_info
|
||||||
|
mysql_plugin_options
|
||||||
|
@ -319,8 +319,11 @@ mysql_declare_client_plugin(AUTHENTICATION)
|
|||||||
"Sergei Golubchik",
|
"Sergei Golubchik",
|
||||||
"Dialog Client Authentication Plugin",
|
"Dialog Client Authentication Plugin",
|
||||||
{0,1,0},
|
{0,1,0},
|
||||||
|
"GPL",
|
||||||
|
NULL,
|
||||||
init_dialog,
|
init_dialog,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
perform_dialog
|
perform_dialog
|
||||||
mysql_end_client_plugin;
|
mysql_end_client_plugin;
|
||||||
|
|
||||||
|
@ -196,6 +196,9 @@ mysql_declare_client_plugin(AUTHENTICATION)
|
|||||||
"Georgi Kodinov",
|
"Georgi Kodinov",
|
||||||
"Dialog Client Authentication Plugin",
|
"Dialog Client Authentication Plugin",
|
||||||
{0,1,0},
|
{0,1,0},
|
||||||
|
"GPL",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
test_plugin_client
|
test_plugin_client
|
||||||
|
@ -2283,6 +2283,9 @@ static auth_plugin_t native_password_client_plugin=
|
|||||||
"R.J.Silk, Sergei Golubchik",
|
"R.J.Silk, Sergei Golubchik",
|
||||||
"Native MySQL authentication",
|
"Native MySQL authentication",
|
||||||
{1, 0, 0},
|
{1, 0, 0},
|
||||||
|
"GPL",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
native_password_auth_client
|
native_password_auth_client
|
||||||
@ -2296,6 +2299,9 @@ static auth_plugin_t old_password_client_plugin=
|
|||||||
"R.J.Silk, Sergei Golubchik",
|
"R.J.Silk, Sergei Golubchik",
|
||||||
"Old MySQL-3.23 authentication",
|
"Old MySQL-3.23 authentication",
|
||||||
{1, 0, 0},
|
{1, 0, 0},
|
||||||
|
"GPL",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
old_password_auth_client
|
old_password_auth_client
|
||||||
|
@ -322,6 +322,9 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
|||||||
char dlpath[FN_REFLEN+1];
|
char dlpath[FN_REFLEN+1];
|
||||||
void *sym, *dlhandle;
|
void *sym, *dlhandle;
|
||||||
struct st_mysql_client_plugin *plugin;
|
struct st_mysql_client_plugin *plugin;
|
||||||
|
#ifdef WIN32
|
||||||
|
char win_errormsg[2048];
|
||||||
|
#endif
|
||||||
|
|
||||||
DBUG_ENTER ("mysql_load_plugin_v");
|
DBUG_ENTER ("mysql_load_plugin_v");
|
||||||
DBUG_PRINT ("entry", ("name=%s type=%d int argc=%d", name, type, argc));
|
DBUG_PRINT ("entry", ("name=%s type=%d int argc=%d", name, type, argc));
|
||||||
@ -359,8 +362,15 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
|||||||
if ((dlhandle= dlopen(dlpath, RTLD_NOW)))
|
if ((dlhandle= dlopen(dlpath, RTLD_NOW)))
|
||||||
goto have_plugin;
|
goto have_plugin;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DBUG_PRINT ("info", ("failed to dlopen"));
|
DBUG_PRINT ("info", ("failed to dlopen"));
|
||||||
|
#ifdef WIN32
|
||||||
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
0, GetLastError(), 0, win_errormsg, 2048, NULL);
|
||||||
|
errormsg= win_errormsg;
|
||||||
|
#else
|
||||||
errmsg= dlerror();
|
errmsg= dlerror();
|
||||||
|
#endif
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,3 +461,15 @@ mysql_client_find_plugin(MYSQL *mysql, const char *name, int type)
|
|||||||
DBUG_RETURN (p);
|
DBUG_RETURN (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* see <mysql/client_plugin.h> for a full description */
|
||||||
|
int STDCALL mysql_plugin_options(struct st_mysql_client_plugin *plugin,
|
||||||
|
const char *option,
|
||||||
|
const void *value)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("mysql_plugin_options");
|
||||||
|
/* does the plugin support options call? */
|
||||||
|
if (!plugin || !plugin->options)
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
DBUG_RETURN(plugin->options(option, value));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user