[MDEV-8914] Provide better error message if file-key-management-filename is not set Created: 2015-10-07  Updated: 2015-10-12  Resolved: 2015-10-12

Status: Closed
Project: MariaDB Server
Component/s: Encryption, Plugins
Affects Version/s: 10.1.7
Fix Version/s: 10.1.8

Type: Bug Priority: Trivial
Reporter: Hartmut Holzgraefe Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File patch.txt    
Issue Links:
Relates
relates to MDEV-7979 file_key_management plugin is not ins... Closed
relates to MDEV-8262 file_key_management plugin install error Closed

 Description   

Right now if file-key-management-filename is unset/empty (which is probably the default state if you naively try to install the plugin the first time) installing the file-key-management plugin fails with the unintuitive error message

MariaDB [test]> install soname 'file_key_management';
ERROR 29 (HY000): File '' not found (Errcode: 2 "No such file or directory")

I'd suggest to check the filename variable for being empty before trying to pass it as a filename, and to issue a different error message if unset:

MariaDB [(none)]> install soname 'file_key_management';
ERROR 2 (HY000): file_key_management_filename unset or empty



 Comments   
Comment by Hartmut Holzgraefe [ 2015-10-07 ]

Suggested fix:

diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc
index 552dd7d..81d839b 100644
--- a/plugin/file_key_management/parser.cc
+++ b/plugin/file_key_management/parser.cc
@@ -156,6 +156,13 @@ bool Parser::parse(Dynamic_array<keyentry> *keys)
     secret= buf;
   }
 
+  if ('\0' == *filename) {
+    my_printf_error(EE_READ, "file_key_management_filename unset or empty",
+                   MYF(ME_NOREFRESH));
+
+    return 1;
+  }
+
   return parse_file(keys, secret);
 }
 

Generated at Thu Feb 08 07:30:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.