1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

--plugin_maturity command-line option

This commit is contained in:
Sergei Golubchik
2010-06-16 19:01:22 +02:00
parent 9b48499dc4
commit 97d610d69f
10 changed files with 68 additions and 31 deletions

View File

@@ -37,6 +37,18 @@ static TYPELIB global_plugin_typelib=
char *opt_plugin_load= NULL;
char *opt_plugin_dir_ptr;
char opt_plugin_dir[FN_REFLEN];
uint plugin_maturity;
/*
not really needed now, this map will become essential when we add more
maturity levels. We cannot change existing maturity constants,
so the next value - even if it will be MariaDB_PLUGIN_MATURITY_VERY_BUGGY -
will inevitably be larger than MariaDB_PLUGIN_MATURITY_STABLE.
To be able to compare them we use this mapping array
*/
uint plugin_maturity_map[]=
{ 0, 1, 2, 3, 4, 5, 6 };
/*
When you ad a new plugin type, add both a string and make sure that the
init and deinit array are correctly updated.
@@ -953,6 +965,17 @@ static bool plugin_add(MEM_ROOT *tmp_root,
report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, 0, buf);
goto err;
}
if (plugin_maturity_map[plugin->maturity] < plugin_maturity)
{
char buf[256];
strxnmov(buf, sizeof(buf) - 1, "Loading of ",
plugin_maturity_names[plugin->maturity],
" plugins is prohibited by --plugin-maturity=",
plugin_maturity_names[plugin_maturity],
NullS);
report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, 0, buf);
goto err;
}
tmp.plugin= plugin;
tmp.name.str= (char *)plugin->name;
tmp.name.length= name_len;