summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-06-16 19:01:22 +0200
committerSergei Golubchik <sergii@pisem.net>2010-06-16 19:01:22 +0200
commit97d610d69f46366fe1e9a3b8738d9bd4b8043eed (patch)
treed958819780d332342115ce892fe3b9f326757b83 /sql/sql_plugin.cc
parent9b48499dc44ef8a7b1722a273f12a3198ec7784b (diff)
downloadmariadb-git-97d610d69f46366fe1e9a3b8738d9bd4b8043eed.tar.gz
--plugin_maturity command-line option
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 7512150856c..71c735fee66 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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;