summaryrefslogtreecommitdiff
path: root/sql/mf_iocache_encr.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-09-08 17:07:34 +0200
committerSergei Golubchik <serg@mariadb.org>2015-09-09 14:22:22 +0200
commit7bd2f20e880a5871635260c0a96448631c28b2c5 (patch)
tree08624574102ced268f0a0ecab693727c8c74d14a /sql/mf_iocache_encr.cc
parent39b46ae934bfa886314f918068d1e195970fe65e (diff)
downloadmariadb-git-7bd2f20e880a5871635260c0a96448631c28b2c5.tar.gz
make encrypt-binlog and encrypt-tmp-files to fail if no encryption
--encrypt-binlog and --encrypt-tmp-files used to mean "encrypt XXX if encryption is available, otherwise don't encrypt", now they mean "encrypt or fail with an error".
Diffstat (limited to 'sql/mf_iocache_encr.cc')
-rw-r--r--sql/mf_iocache_encr.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 96658e2e3d0..ae314d826a0 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -230,7 +230,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
Note that encrypt_tmp_files variable is read-only.
*/
-void init_io_cache_encryption()
+int init_io_cache_encryption()
{
if (encrypt_tmp_files)
{
@@ -241,20 +241,23 @@ void init_io_cache_encryption()
keyid= ENCRYPTION_KEY_SYSTEM_DATA;
keyver= encryption_key_get_latest_version(keyid);
}
- }
- else
- keyver= ENCRYPTION_KEY_VERSION_INVALID;
+ if (keyver == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ sql_print_error("Failed to enable encryption of temporary files");
+ return 1;
+ }
- if (keyver != ENCRYPTION_KEY_VERSION_INVALID)
- {
- sql_print_information("Using encryption key id %d for temporary files", keyid);
- _my_b_encr_read= my_b_encr_read;
- _my_b_encr_write= my_b_encr_write;
- }
- else
- {
- _my_b_encr_read= 0;
- _my_b_encr_write= 0;
+ if (keyver != ENCRYPTION_KEY_NOT_ENCRYPTED)
+ {
+ sql_print_information("Using encryption key id %d for temporary files", keyid);
+ _my_b_encr_read= my_b_encr_read;
+ _my_b_encr_write= my_b_encr_write;
+ return 0;
+ }
}
+
+ _my_b_encr_read= 0;
+ _my_b_encr_write= 0;
+ return 0;
}