List:Internals« Previous MessageNext Message »
From:stewart Date:June 30 2008 3:22am
Subject:[patch 03/10] WL4271: Encrypted Online Backup: add symbols to parser
View as plain text  
---
 mysql-test/r/backup_encrypted_syntax_basic.result |   18 +++++++++++
 mysql-test/t/backup_encrypted_syntax_basic.test   |   17 ++++++++++
 sql/lex.h                                         |    3 +
 sql/sql_lex.h                                     |    4 ++
 sql/sql_yacc.yy                                   |   35 +++++++++++++++++++++-
 5 files changed, 76 insertions(+), 1 deletion(-)

Index: stew-encrypted-backup/sql/sql_yacc.yy
===================================================================
--- stew-encrypted-backup.orig/sql/sql_yacc.yy	2008-06-26 02:33:16.895617036 +1000
+++ stew-encrypted-backup/sql/sql_yacc.yy	2008-06-26 02:57:11.870619695 +1000
@@ -749,6 +749,9 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  ELSEIF_SYM
 %token  ENABLE_SYM
 %token  ENCLOSED
+%token  ENCRYPTION_ALGORITHM_SYM
+%token  ENCRYPTION_KEYSIZE_SYM
+%token  ENCRYPTION_KEYFILE_SYM
 %token  END                           /* SQL-2003-R */
 %token  ENDS_SYM
 %token  END_OF_INPUT                  /* INTERNAL */
@@ -1221,6 +1224,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
         NCHAR_STRING opt_component key_cache_name
         sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
         opt_constraint constraint opt_ident
+	opt_encryption_algorithm opt_encryption_keyfile opt_encryption_password
 
 %type <lex_str_ptr>
         opt_table_alias
@@ -1247,6 +1251,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
         ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
         opt_transactional_lock_timeout
         /* opt_lock_timeout_value */
+	opt_encryption_keysize
 
 %type <m_fk_option>
         delete_option
@@ -6309,6 +6314,10 @@ backup:
           TO_SYM
           TEXT_STRING_sys
           opt_compression
+	  opt_encryption_algorithm
+	  opt_encryption_keysize
+	  opt_encryption_keyfile
+	  opt_encryption_password
           {
             LEX *lex= Lex;
             if (lex->sphead)
@@ -6317,7 +6326,11 @@ backup:
               MYSQL_YYABORT;
             }
             lex->sql_command = SQLCOM_BACKUP;
-            lex->backup_dir = $5; 
+            lex->backup_dir = $5;
+	    lex->encryption_algorithm= $7;
+	    lex->encryption_keysize= $8;
+	    lex->encryption_keyfile= $9;
+	    lex->encryption_password= $10;
           }
         | BACKUP_TEST_SYM
           database_list
@@ -6348,6 +6361,26 @@ opt_compression_algorithm:
           }
         ;
 
+opt_encryption_algorithm:
+	/* empty */	{ $$= null_lex_str; }
+	| ENCRYPTION_ALGORITHM_SYM opt_equal IDENT_sys	{ $$= $3; }
+	;
+
+opt_encryption_keysize:
+	/* empty */	{ $$= 0; }
+	| ENCRYPTION_KEYSIZE_SYM opt_equal ulong_num	{ $$= $3; }
+	;
+
+opt_encryption_keyfile:
+	/* empty */		{ $$= null_lex_str; }
+	| ENCRYPTION_KEYFILE_SYM opt_equal TEXT_STRING_sys	{ $$= $3; }
+	;
+
+opt_encryption_password:
+	/* empty */		{ $$= null_lex_str; }
+	| PASSWORD opt_equal TEXT_STRING_sys	    { $$= $3; }
+	;
+
 database_list:
           '*'
           {
Index: stew-encrypted-backup/sql/lex.h
===================================================================
--- stew-encrypted-backup.orig/sql/lex.h	2008-06-26 02:33:16.171618306 +1000
+++ stew-encrypted-backup/sql/lex.h	2008-06-26 02:49:45.983644987 +1000
@@ -183,6 +183,9 @@ static SYMBOL symbols[] = {
   { "ELSEIF",           SYM(ELSEIF_SYM)},
   { "ENABLE",		SYM(ENABLE_SYM)},
   { "ENCLOSED",		SYM(ENCLOSED)},
+  { "ENCRYPTION_ALGORITHM", SYM(ENCRYPTION_ALGORITHM_SYM)},
+  { "ENCRYPTION_KEYSIZE", SYM(ENCRYPTION_KEYSIZE_SYM)},
+  { "ENCRYPTION_KEYFILE", SYM(ENCRYPTION_KEYFILE_SYM)},
   { "END",		SYM(END)},
   { "ENDS",		SYM(ENDS_SYM)},
   { "ENGINE",		SYM(ENGINE_SYM)},
Index: stew-encrypted-backup/sql/sql_lex.h
===================================================================
--- stew-encrypted-backup.orig/sql/sql_lex.h	2008-06-26 02:33:16.411618162 +1000
+++ stew-encrypted-backup/sql/sql_lex.h	2008-06-26 02:50:38.063807707 +1000
@@ -1526,6 +1526,10 @@ typedef struct st_lex : public Query_tab
   LEX_STRING name;
   char *help_arg;
   LEX_STRING backup_dir;				/* For RESTORE/BACKUP */
+  LEX_STRING encryption_algorithm;
+  ulong encryption_keysize;
+  LEX_STRING encryption_keyfile;
+  LEX_STRING encryption_password;
   bool backup_compression;
   char* to_log;                                 /* For PURGE MASTER LOGS TO */
   char* x509_subject,*x509_issuer,*ssl_cipher;
Index: stew-encrypted-backup/mysql-test/r/backup_encrypted_syntax_basic.result
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ stew-encrypted-backup/mysql-test/r/backup_encrypted_syntax_basic.result	2008-06-26
02:49:46.018621982 +1000
@@ -0,0 +1,18 @@
+BACKUP DATABASE test TO 'test.ba';
+backup_id
+1
+BACKUP DATABASE test TO 'test1.ba' ENCRYPTION_ALGORITHM=foo;
+backup_id
+2
+BACKUP DATABASE test TO 'test2.ba' ENCRYPTION_ALGORITHM=aes;
+backup_id
+3
+BACKUP DATABASE test TO 'test3.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128;
+backup_id
+4
+BACKUP DATABASE test TO 'test4.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128
PASSWORD='pants';
+backup_id
+5
+BACKUP DATABASE test TO 'test5.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128
ENCRYPTION_KEYFILE='foo.key';
+backup_id
+6
Index: stew-encrypted-backup/mysql-test/t/backup_encrypted_syntax_basic.test
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ stew-encrypted-backup/mysql-test/t/backup_encrypted_syntax_basic.test	2008-06-26
02:49:46.053791951 +1000
@@ -0,0 +1,17 @@
+--source include/not_embedded.inc
+
+BACKUP DATABASE test TO 'test.ba';
+BACKUP DATABASE test TO 'test1.ba' ENCRYPTION_ALGORITHM=foo;
+BACKUP DATABASE test TO 'test2.ba' ENCRYPTION_ALGORITHM=aes;
+BACKUP DATABASE test TO 'test3.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128;
+BACKUP DATABASE test TO 'test4.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128
PASSWORD='pants';
+BACKUP DATABASE test TO 'test5.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128
ENCRYPTION_KEYFILE='foo.key';
+
+
+--remove_file $MYSQLTEST_VARDIR/master-data/test.ba
+--remove_file $MYSQLTEST_VARDIR/master-data/test1.ba
+--remove_file $MYSQLTEST_VARDIR/master-data/test2.ba
+--remove_file $MYSQLTEST_VARDIR/master-data/test3.ba
+--remove_file $MYSQLTEST_VARDIR/master-data/test4.ba
+--remove_file $MYSQLTEST_VARDIR/master-data/test5.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