Skip to content

Commit b7289d6

Browse files
author
He Zhenxing
committed
Bug#49894 shifted MYSQL_REPLICATION_PLUGIN number
The number for MYSQL_REPLICATION_PLUGIN was shifted when backporting because MYSQL_AUDIT_PLUGIN was not backported. This problem is fixed by backporting only the number of audit plugin and print an error when trying to load audit plugins. Note that replication plugins compiled against old MYSQL_REPLICATION_PLUGIN number will also be recognized as audit plugin and be rejected.
1 parent b17c1a7 commit b7289d6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

include/mysql/plugin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ typedef struct st_mysql_xid MYSQL_XID;
8080
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
8181
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
8282
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
83-
#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */
84-
#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */
83+
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
84+
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
85+
#define MYSQL_MAX_PLUGIN_TYPE_NUM 7 /* The number of plugin types */
8586

8687
/* We use the following strings to define licenses for plugins */
8788
#define PLUGIN_LICENSE_PROPRIETARY 0

sql/sql_plugin.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
4747
{ C_STRING_WITH_LEN("FTPARSER") },
4848
{ C_STRING_WITH_LEN("DAEMON") },
4949
{ C_STRING_WITH_LEN("INFORMATION SCHEMA") },
50+
{ C_STRING_WITH_LEN("AUDIT") },
5051
{ C_STRING_WITH_LEN("REPLICATION") },
5152
};
5253

@@ -87,6 +88,7 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
8788
MYSQL_FTPARSER_INTERFACE_VERSION,
8889
MYSQL_DAEMON_INTERFACE_VERSION,
8990
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
91+
0x0000, /* place holder for audit plugin */
9092
MYSQL_REPLICATION_INTERFACE_VERSION,
9193
};
9294
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
@@ -96,6 +98,7 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
9698
MYSQL_FTPARSER_INTERFACE_VERSION,
9799
MYSQL_DAEMON_INTERFACE_VERSION,
98100
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
101+
0x0000, /* place holder for audit plugin */
99102
MYSQL_REPLICATION_INTERFACE_VERSION,
100103
};
101104

@@ -738,6 +741,14 @@ static bool plugin_add(MEM_ROOT *tmp_root,
738741
name_len))
739742
{
740743
struct st_plugin_int *tmp_plugin_ptr;
744+
745+
if (plugin->type == MYSQL_AUDIT_PLUGIN)
746+
{
747+
/* Bug#49894 */
748+
sql_print_error("Plugin type 'AUDIT' not supported by this server.");
749+
goto err;
750+
}
751+
741752
if (*(int*)plugin->info <
742753
min_plugin_info_interface_version[plugin->type] ||
743754
((*(int*)plugin->info) >> 8) >

0 commit comments

Comments
 (0)