summaryrefslogtreecommitdiff
path: root/sql/encryption.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-08-08 14:52:08 +0200
committerSergei Golubchik <serg@mariadb.org>2017-08-08 14:52:08 +0200
commit5099d6de61fd03b8225dfba9e4becb13b5a74c67 (patch)
tree48f137e6d7a239604f8cd5e0cce0938f7c09d9b4 /sql/encryption.cc
parent8e8d42ddf0291b2364fef8e3224e65d596ef4202 (diff)
downloadmariadb-git-5099d6de61fd03b8225dfba9e4becb13b5a74c67.tar.gz
MDEV-12863 No table can be created after second encryption plugin attempted to load
when deinitializing encryption plugins, disable server-wide encryption only if this plugin is the one that is used for encryption.
Diffstat (limited to 'sql/encryption.cc')
-rw-r--r--sql/encryption.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/encryption.cc b/sql/encryption.cc
index a92296e8b66..52eab262570 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -98,19 +98,27 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
int finalize_encryption_plugin(st_plugin_int *plugin)
{
- encryption_handler.encryption_key_get_func=
- (uint (*)(uint, uint, uchar*, uint*))no_key;
- encryption_handler.encryption_key_get_latest_version_func= no_key;
- encryption_handler.encryption_ctx_size_func= zero_size;
+ bool used= plugin_ref_to_int(encryption_manager) == plugin;
+
+ if (used)
+ {
+ encryption_handler.encryption_key_get_func=
+ (uint (*)(uint, uint, uchar*, uint*))no_key;
+ encryption_handler.encryption_key_get_latest_version_func= no_key;
+ encryption_handler.encryption_ctx_size_func= zero_size;
+ }
if (plugin && plugin->plugin->deinit && plugin->plugin->deinit(NULL))
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
- if (encryption_manager)
+
+ if (used)
+ {
plugin_unlock(NULL, encryption_manager);
- encryption_manager= 0;
+ encryption_manager= 0;
+ }
return 0;
}