Commit c4e336e0 authored by Sergei Golubchik's avatar Sergei Golubchik

fix the encryption.filekeys_nofile test

and move the error reporting where it belongs
parent affff1ae
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
......
let SEARCH_PATTERN=File '' not found;
let SEARCH_PATTERN=file-key-management-filename is not set;
source filekeys_badtest.inc;
......@@ -16,7 +16,6 @@
#include "parser.h"
#include <mysql/plugin_encryption.h>
#include <mysqld_error.h>
#include <string.h>
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);
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment