diff --git a/mysql-test/suite/encryption/r/filekeys_nofile.result b/mysql-test/suite/encryption/r/filekeys_nofile.result index 558ea1ce88c..690f2e61df0 100644 --- a/mysql-test/suite/encryption/r/filekeys_nofile.result +++ b/mysql-test/suite/encryption/r/filekeys_nofile.result @@ -1,7 +1,7 @@ -call mtr.add_suppression("File '' not found"); +call mtr.add_suppression("file-key-management-filename is not set"); call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); -FOUND /File '' not found/ in mysqld.1.err +FOUND /file-key-management-filename is not set/ in mysqld.1.err create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") select plugin_status from information_schema.plugins diff --git a/mysql-test/suite/encryption/t/filekeys_nofile.test b/mysql-test/suite/encryption/t/filekeys_nofile.test index c4505ebec81..46f5cd462d7 100644 --- a/mysql-test/suite/encryption/t/filekeys_nofile.test +++ b/mysql-test/suite/encryption/t/filekeys_nofile.test @@ -1,2 +1,2 @@ -let SEARCH_PATTERN=File '' not found; +let SEARCH_PATTERN=file-key-management-filename is not set; source filekeys_badtest.inc; diff --git a/plugin/file_key_management/file_key_management_plugin.cc b/plugin/file_key_management/file_key_management_plugin.cc index ffe4b940a4d..970fae9c189 100644 --- a/plugin/file_key_management/file_key_management_plugin.cc +++ b/plugin/file_key_management/file_key_management_plugin.cc @@ -16,7 +16,6 @@ #include "parser.h" #include -#include #include static char* filename; @@ -166,13 +165,6 @@ struct st_mariadb_encryption file_key_management_plugin= { static int file_key_management_plugin_init(void *p) { - if (!filename || !filename[0]) - { - my_printf_error(ER_CANT_INITIALIZE_UDF, - "file_key_management-filename is not set", MYF(0)); - return 1; - } - Parser parser(filename, filekey); return parser.parse(&keys); } diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc index 9204f39326d..28cd981df79 100644 --- a/plugin/file_key_management/parser.cc +++ b/plugin/file_key_management/parser.cc @@ -298,8 +298,16 @@ int Parser::parse_line(char **line_ptr, keyentry *key) char* Parser::read_and_decrypt_file(const char *secret) { - int f= my_open(filename, O_RDONLY, MYF(MY_WME)); - if (f < 0) + if (!filename || !filename[0]) + { + my_printf_error(EE_CANT_OPEN_STREAM, + "file-key-management-filename is not set", + MYF(ME_NOREFRESH)); + goto err0; + } + + int f; + if ((f= my_open(filename, O_RDONLY, MYF(MY_WME))) < 0) goto err0; my_off_t file_size;