mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
1. Built-in plugins (plugin_init): A non-ASCII builtin name is a developer error. Added a check using my_string_repertoire() that prints an error via print_init_failed_error() and returns 1 to abort server startup. 2. Dynamically loaded plugins (plugin_add): Added a pre-validation loop before the registration loop. If any plugin name in the .so is non-ASCII, the entire .so is rejected before any plugin is registered, preventing partial state where valid plugins from the same .so get left INACTIVE in the hash. Added test plugins and MTR tests to verify both rejection of non-ASCII named plugins and successful loading of ASCII named plugins.
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
/* Copyright (c) 2024, MariaDB Corporation.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
|
|
|
/*
|
|
Test plugin: two plugins with pure ASCII names.
|
|
Used by mysql-test/suite/plugins/t/plugin_name_ascii.test
|
|
*/
|
|
|
|
#include <mysql/plugin.h>
|
|
|
|
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
|
#define __attribute__(A)
|
|
#endif
|
|
|
|
static struct st_mysql_daemon plugin1_descriptor = { MYSQL_DAEMON_INTERFACE_VERSION };
|
|
static struct st_mysql_daemon plugin2_descriptor = { MYSQL_DAEMON_INTERFACE_VERSION };
|
|
|
|
static int plugin1_init(void *p __attribute__((unused))) { return 0; }
|
|
static int plugin1_deinit(void *p __attribute__((unused))) { return 0; }
|
|
static int plugin2_init(void *p __attribute__((unused))) { return 0; }
|
|
static int plugin2_deinit(void *p __attribute__((unused))) { return 0; }
|
|
|
|
maria_declare_plugin(plugin_name_ascii)
|
|
{
|
|
MYSQL_DAEMON_PLUGIN,
|
|
&plugin1_descriptor,
|
|
"ascii_plugin_one",
|
|
"MariaDB",
|
|
"Plugin with ASCII name - one",
|
|
PLUGIN_LICENSE_GPL,
|
|
plugin1_init,
|
|
plugin1_deinit,
|
|
0x0100,
|
|
NULL,
|
|
NULL,
|
|
"1.0",
|
|
MariaDB_PLUGIN_MATURITY_STABLE
|
|
},
|
|
{
|
|
MYSQL_DAEMON_PLUGIN,
|
|
&plugin2_descriptor,
|
|
"ascii_plugin_two",
|
|
"MariaDB",
|
|
"Plugin with ASCII name - two",
|
|
PLUGIN_LICENSE_GPL,
|
|
plugin2_init,
|
|
plugin2_deinit,
|
|
0x0100,
|
|
NULL,
|
|
NULL,
|
|
"1.0",
|
|
MariaDB_PLUGIN_MATURITY_STABLE
|
|
}
|
|
maria_declare_plugin_end;
|