Skip to content

Commit c4e336e

Browse files
committed
fix the encryption.filekeys_nofile test
and move the error reporting where it belongs
1 parent affff1a commit c4e336e

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

mysql-test/suite/encryption/r/filekeys_nofile.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
call mtr.add_suppression("File '' not found");
1+
call mtr.add_suppression("file-key-management-filename is not set");
22
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
33
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
4-
FOUND /File '' not found/ in mysqld.1.err
4+
FOUND /file-key-management-filename is not set/ in mysqld.1.err
55
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
66
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
77
select plugin_status from information_schema.plugins
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
let SEARCH_PATTERN=File '' not found;
1+
let SEARCH_PATTERN=file-key-management-filename is not set;
22
source filekeys_badtest.inc;

plugin/file_key_management/file_key_management_plugin.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "parser.h"
1818
#include <mysql/plugin_encryption.h>
19-
#include <mysqld_error.h>
2019
#include <string.h>
2120

2221
static char* filename;
@@ -166,13 +165,6 @@ struct st_mariadb_encryption file_key_management_plugin= {
166165

167166
static int file_key_management_plugin_init(void *p)
168167
{
169-
if (!filename || !filename[0])
170-
{
171-
my_printf_error(ER_CANT_INITIALIZE_UDF,
172-
"file_key_management-filename is not set", MYF(0));
173-
return 1;
174-
}
175-
176168
Parser parser(filename, filekey);
177169
return parser.parse(&keys);
178170
}

plugin/file_key_management/parser.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,16 @@ int Parser::parse_line(char **line_ptr, keyentry *key)
298298

299299
char* Parser::read_and_decrypt_file(const char *secret)
300300
{
301-
int f= my_open(filename, O_RDONLY, MYF(MY_WME));
302-
if (f < 0)
301+
if (!filename || !filename[0])
302+
{
303+
my_printf_error(EE_CANT_OPEN_STREAM,
304+
"file-key-management-filename is not set",
305+
MYF(ME_NOREFRESH));
306+
goto err0;
307+
}
308+
309+
int f;
310+
if ((f= my_open(filename, O_RDONLY, MYF(MY_WME))) < 0)
303311
goto err0;
304312

305313
my_off_t file_size;

0 commit comments

Comments
 (0)