summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-13 15:53:18 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-13 15:53:18 +0200
commita63ecdd3b14e7abfd482131c924567bd25aa231a (patch)
treedc20d248b63f5dc477b5701978425924a376f6ff /mysql-test
parentf6ff0c4916852517c2f1a0327056a807ffc27b74 (diff)
downloadmariadb-git-a63ecdd3b14e7abfd482131c924567bd25aa231a.tar.gz
Added FLUSH DES_KEY_FILE.
New HEX() function. Final (?) cleanup of des_encrypt() / des_decrypt(). Added missing files to Makefiles. Docs/Makefile.am: Add missing files Docs/manual.texi: Added information about HEX() and des_encrypt() / des_decrypt(). include/mysql_com.h: Added FLUSH DES_KEY_FILE myisam/ft_update.c: Removed compiler warnings mysql-test/mysql-test-run.sh: Fixes needed for des_key tests. mysql-test/r/func_crypt.result: Moved crypt test from func_str to func_crypt mysql-test/r/func_encrypt.result: Moved crypt test from func_str to func_crypt mysql-test/r/func_str.result: Moved crypt test from func_str to func_crypt mysql-test/t/func_crypt.test: Moved crypt test from func_str to func_crypt mysql-test/t/func_encrypt.test: New tests mysql-test/t/func_str.test: Moved crypt test from func_str to func_crypt sql/des_key_file.cc: Changes needed for FLUSH DES_KEY_FILE sql/item_create.cc: New HEX() function sql/item_strfunc.cc: Changes needed for FLUSH DES_KEY_FILE sql/item_strfunc.h: New HEX() function sql/item_timefunc.cc: cleanup sql/lex.h: FLUSH DES_KEY_FILE sql/mysql_priv.h: FLUSH DES_KEY_FILE sql/mysqld.cc: FLUSH DES_KEY_FILE sql/sql_parse.cc: Cleanup sql_yacc.yy sql/sql_yacc.yy: Cleanup sql_yacc.yy
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh5
-rw-r--r--mysql-test/r/func_crypt.result3
-rw-r--r--mysql-test/r/func_encrypt.resultbin6980 -> 8764 bytes
-rw-r--r--mysql-test/r/func_str.result3
-rw-r--r--mysql-test/std_data/des_key_file4
-rw-r--r--mysql-test/t/func_crypt.test3
-rw-r--r--mysql-test/t/func_encrypt-master.opt1
-rw-r--r--mysql-test/t/func_encrypt.test105
-rw-r--r--mysql-test/t/func_str.test2
9 files changed, 75 insertions, 51 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 4a9764efa5b..f2f0c2a4234 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -76,7 +76,6 @@ sleep_until_file_exists ()
exit 1;
}
-
# No paths below as we can't be sure where the program is!
BASENAME=`which basename | head -1`
@@ -993,7 +992,7 @@ run_testcase ()
then
if [ -f $master_opt_file ] ;
then
- EXTRA_MASTER_OPT=`$CAT $master_opt_file`
+ EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
stop_master
start_master
else
@@ -1008,7 +1007,7 @@ run_testcase ()
if [ -f $slave_opt_file ] ;
then
- EXTRA_SLAVE_OPT=`$CAT $slave_opt_file`
+ EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
do_slave_restart=1
else
if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 54f2865454d..cf464ec21b2 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -1,3 +1,6 @@
select length(encrypt('foo', 'ff')) <> 0;
length(encrypt('foo', 'ff')) <> 0
1
+select password('test'),length(encrypt('test')),encrypt('test','aa');
+password('test') length(encrypt('test')) encrypt('test','aa')
+378b243e220ca493 13 aaqPiZY5xR5l.
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index 9d16e2c7dfe..39c734999b2 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
Binary files differ
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 28a4870cfc6..5aca1f6b021 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -77,9 +77,6 @@ this is a REAL test
select soundex(''),soundex('he'),soundex('hello all folks');
soundex('') soundex('he') soundex('hello all folks')
H000 H4142
-select password('test'),length(encrypt('test')),encrypt('test','aa');
-password('test') length(encrypt('test')) encrypt('test','aa')
-378b243e220ca493 13 aaqPiZY5xR5l.
select md5('hello');
md5('hello')
5d41402abc4b2a76b9719d911017c592
diff --git a/mysql-test/std_data/des_key_file b/mysql-test/std_data/des_key_file
new file mode 100644
index 00000000000..fa53802d449
--- /dev/null
+++ b/mysql-test/std_data/des_key_file
@@ -0,0 +1,4 @@
+5 default_password
+1 password1
+4 password4
+2 password2
diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test
index ddc0816e301..f01504d3691 100644
--- a/mysql-test/t/func_crypt.test
+++ b/mysql-test/t/func_crypt.test
@@ -1,2 +1,3 @@
-
select length(encrypt('foo', 'ff')) <> 0;
+--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
+select password('test'),length(encrypt('test')),encrypt('test','aa');
diff --git a/mysql-test/t/func_encrypt-master.opt b/mysql-test/t/func_encrypt-master.opt
new file mode 100644
index 00000000000..0b042f52e9a
--- /dev/null
+++ b/mysql-test/t/func_encrypt-master.opt
@@ -0,0 +1 @@
+--des-key-file=$MYSQL_TEST_DIR/std_data/des_key_file
diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test
index 9c59281328c..3b6acc54ec9 100644
--- a/mysql-test/t/func_encrypt.test
+++ b/mysql-test/t/func_encrypt.test
@@ -1,46 +1,67 @@
-- source include/have_openssl.inc
-use test;
-drop table if exists x;
-create table x (x blob);
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','a'));
-insert into x values (des_encrypt('ab','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','ab'));
-insert into x values (des_encrypt('abc','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abc'));
-insert into x values (des_encrypt('abcd','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcd'));
-insert into x values (des_encrypt('abcde','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcde'));
-insert into x values (des_encrypt('abcdef','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdef'));
-insert into x values (des_encrypt('abcdefg','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefg'));
-insert into x values (des_encrypt('abcdefgh','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefgh'));
-insert into x values (des_encrypt('abcdefghi','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghi'));
-insert into x values (des_encrypt('abcdefghij','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghij'));
-insert into x values (des_encrypt('abcdefghijk','The quick red fox jumped over the lazy brown dog'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghijk'));
-insert into x values (des_encrypt('The quick red fox jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('quick red fox jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('red fox jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('fox jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('lazy brown dog','sabakala'));
-insert into x values (des_encrypt('brown dog','sabakala'));
-insert into x values (des_encrypt('dog','sabakala'));
-insert into x values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-insert into x values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-select * from x;
-select des_decrypt(x,'sabakala') from x;
-drop table x;
+drop table if exists t1;
+create table t1 (x blob);
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','a'));
+insert into t1 values (des_encrypt('ab','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','ab'));
+insert into t1 values (des_encrypt('abc','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abc'));
+insert into t1 values (des_encrypt('abcd','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcd'));
+insert into t1 values (des_encrypt('abcde','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcde'));
+insert into t1 values (des_encrypt('abcdef','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdef'));
+insert into t1 values (des_encrypt('abcdefg','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefg'));
+insert into t1 values (des_encrypt('abcdefgh','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefgh'));
+insert into t1 values (des_encrypt('abcdefghi','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghi'));
+insert into t1 values (des_encrypt('abcdefghij','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghij'));
+insert into t1 values (des_encrypt('abcdefghijk','The quick red fox jumped over the lazy brown dog'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghijk'));
+insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('quick red fox jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('red fox jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('fox jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('brown dog','sabakala'));
+insert into t1 values (des_encrypt('dog','sabakala'));
+insert into t1 values (des_encrypt('dog!','sabakala'));
+insert into t1 values (des_encrypt('dog!!','sabakala'));
+insert into t1 values (des_encrypt('dog!!!','sabakala'));
+insert into t1 values (des_encrypt('dog!!!!','sabakala'));
+insert into t1 values (des_encrypt('dog!!!!!','sabakala'));
+insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
+insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
+select hex(x), hex(des_decrypt(x,'sabakala')) from t1;
+select des_decrypt(x,'sabakala') as s from t1 having s like '%dog%';
+drop table t1;
+#
+# Test default keys
+#
+select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
+select des_decrypt(des_encrypt("hello",4));
+select des_decrypt(des_encrypt("hello",'test'),'test');
+select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
+select des_decrypt(des_encrypt("hello"),'default_password');
+select des_decrypt(des_encrypt("hello",4),'password4');
+# Test flush
+SET @a=des_decrypt(des_encrypt("hello"));
+flush des_key_file;
+select @a = des_decrypt(des_encrypt("hello"));
+
+# Test usage of wrong password
+select hex("hello");
+select hex(des_decrypt(des_encrypt("hello",4),'password2'));
+select hex(des_decrypt(des_encrypt("hello","hidden")));
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 27d7f2e68d5..fd6ff0d70e7 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -35,8 +35,6 @@ select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
select soundex(''),soundex('he'),soundex('hello all folks');
---replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
-select password('test'),length(encrypt('test')),encrypt('test','aa');
select md5('hello');
select repeat('monty',5),concat('*',space(5),'*');
select reverse('abc'),reverse('abcd');