List:Internals« Previous MessageNext Message »
From:stewart Date:June 30 2008 3:22am
Subject:[patch 09/10] WL4271 Encrypted online backup: pass restore options to backup kernel
View as plain text  
---
 mysql-test/r/backup_encrypted_syntax_basic.result |    2 -
 mysql-test/t/backup_encrypted_syntax_basic.test   |    2 -
 sql/backup/backup_kernel.h                        |    6 ++++
 sql/backup/kernel.cc                              |   27 +++++++++++++++++++---
 4 files changed, 31 insertions(+), 6 deletions(-)

Index: stew-encrypted-backup/sql/backup/backup_kernel.h
===================================================================
--- stew-encrypted-backup.orig/sql/backup/backup_kernel.h	2008-06-26 03:01:51.702661577
+1000
+++ stew-encrypted-backup/sql/backup/backup_kernel.h	2008-06-26 13:32:18.027064073 +1000
@@ -72,7 +72,11 @@ class Backup_restore_ctx: public backup:
                                    LEX_STRING encryption_keyfile,
                                    LEX_STRING encryption_password);
 
-  Restore_info* prepare_for_restore(LEX_STRING location, const char*);  
+  Restore_info* prepare_for_restore(LEX_STRING location, const char*,
+                                    LEX_STRING encryption_algorithm,
+                                    ulong encryption_keysize,
+                                    LEX_STRING encryption_keyfile,
+                                    LEX_STRING encryption_password);
 
   int do_backup();
   int do_restore();
Index: stew-encrypted-backup/sql/backup/kernel.cc
===================================================================
--- stew-encrypted-backup.orig/sql/backup/kernel.cc	2008-06-26 12:51:04.059067421 +1000
+++ stew-encrypted-backup/sql/backup/kernel.cc	2008-06-26 13:31:34.083038543 +1000
@@ -196,8 +196,12 @@ execute_backup_command(THD *thd, LEX *le
 
   case SQLCOM_RESTORE:
   {
-    Restore_info *info= context.prepare_for_restore(lex->backup_dir, thd->query);
-    
+    Restore_info *info= context.prepare_for_restore(lex->backup_dir, thd->query,
+                                                  lex->encryption_algorithm,
+                                                  lex->encryption_keysize,
+                                                  lex->encryption_keyfile,
+                                                  lex->encryption_password);
+
     if (!info || !info->is_valid())
       DBUG_RETURN(send_error(context, ER_BACKUP_RESTORE_PREPARE));
     
@@ -603,7 +607,11 @@ Backup_restore_ctx::prepare_for_backup(L
   @note This function reports errors.
  */ 
 Restore_info* 
-Backup_restore_ctx::prepare_for_restore(LEX_STRING location, const char *query)
+Backup_restore_ctx::prepare_for_restore(LEX_STRING location, const char *query,
+                                        LEX_STRING encryption_algorithm,
+                                        ulong encryption_keysize,
+                                        LEX_STRING encryption_keyfile,
+                                        LEX_STRING encryption_password)
 {
   using namespace backup;  
 
@@ -631,6 +639,19 @@ Backup_restore_ctx::prepare_for_restore(
    */
 
   backup::String path(location);
+  backup::String encryption_algorithm_str(encryption_algorithm);
+  backup::String encryption_keyfile_str(encryption_keyfile);
+  backup::String encryption_password_str(encryption_password);
+
+  if(encryption_algorithm_str.ptr()
+     || encryption_keyfile_str.ptr()
+     || encryption_password_str.ptr()
+     || encryption_keysize)
+  {
+    fatal_error(ER_NOT_SUPPORTED_YET, "Encrypted Restore");
+    return NULL;
+  }
+
   Input_stream *s= new Input_stream(*this, path);
   
   if (!s)
Index: stew-encrypted-backup/mysql-test/r/backup_encrypted_syntax_basic.result
===================================================================
---
stew-encrypted-backup.orig/mysql-test/r/backup_encrypted_syntax_basic.result	2008-06-26
13:31:22.024066918 +1000
+++ stew-encrypted-backup/mysql-test/r/backup_encrypted_syntax_basic.result	2008-06-26
13:31:34.083038543 +1000
@@ -14,4 +14,4 @@ BACKUP DATABASE test TO 'test5.ba' ENCRY
 ERROR 42000: This version of MySQL doesn't yet support 'Encryption with keyfile'
 use test;
 RESTORE FROM 'test4.ba' ENCRYPTION_ALGORITHM=aes PASSWORD='pants';
-ERROR HY000: Can't read backup location 'test4.ba'
+ERROR 42000: This version of MySQL doesn't yet support 'Encrypted Restore'
Index: stew-encrypted-backup/mysql-test/t/backup_encrypted_syntax_basic.test
===================================================================
--- stew-encrypted-backup.orig/mysql-test/t/backup_encrypted_syntax_basic.test	2008-06-26
13:31:22.016045654 +1000
+++ stew-encrypted-backup/mysql-test/t/backup_encrypted_syntax_basic.test	2008-06-26
13:31:34.087047220 +1000
@@ -12,7 +12,7 @@ BACKUP DATABASE test TO 'test4.ba' ENCRY
 BACKUP DATABASE test TO 'test5.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128
ENCRYPTION_KEYFILE='foo.key';
 
 use test;
---error 1630
+--error 1235
 RESTORE FROM 'test4.ba' ENCRYPTION_ALGORITHM=aes PASSWORD='pants';
 
 --remove_file $MYSQLTEST_VARDIR/master-data/test.ba

-- 
Stewart Smith
Thread
[patch 00/10] Encrypted online backupstewart30 Jun
  • [patch 01/10] Bug #37654 lex backup_compression not being set when no compressionstewart30 Jun
  • [patch 02/10] Basic backup and restore teststewart30 Jun
  • [patch 03/10] WL4271: Encrypted Online Backup: add symbols to parserstewart30 Jun
  • [patch 05/10] WL4271 Encrypted online backup: display correct message for no yassl/not implementedstewart30 Jun
  • [patch 04/10] WL4271 Encrypted online backup: pass encryption information to backup kernel, return ER_NOT_SUPPORTED_YETstewart30 Jun
  • [patch 06/10] WL4271 Encrypted online backup: my_crypt_io: an IO abstraction allowing for filteringstewart30 Jun
  • [patch 08/10] WL4271 Encrypted online backup: encrypted restore syntaxstewart30 Jun
  • [patch 07/10] WL4271 Encrytped backup: implement basic AES Encyrptionstewart30 Jun
  • [patch 09/10] WL4271 Encrypted online backup: pass restore options to backup kernelstewart30 Jun
  • [patch 10/10] WL4271 Encrypted online backup: decrypt encrytped backupstewart30 Jun