summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore19
-rw-r--r--BitKeeper/etc/collapsed10
-rw-r--r--Makefile.am18
-rwxr-xr-xclient/CMakeLists.txt2
-rw-r--r--client/Makefile.am31
-rw-r--r--client/mysql.cc27
-rw-r--r--client/mysql_upgrade.c37
-rw-r--r--client/mysqltest.c83
-rw-r--r--client/readline.cc3
-rw-r--r--extra/yassl/README66
-rw-r--r--extra/yassl/examples/client/client.cpp75
-rw-r--r--extra/yassl/examples/echoclient/echoclient.cpp25
-rw-r--r--extra/yassl/examples/echoserver/echoserver.cpp11
-rw-r--r--extra/yassl/examples/server/server.cpp33
-rw-r--r--extra/yassl/include/factory.hpp7
-rw-r--r--extra/yassl/include/openssl/prefix_ssl.h4
-rw-r--r--extra/yassl/include/openssl/ssl.h9
-rw-r--r--extra/yassl/include/socket_wrapper.hpp6
-rw-r--r--extra/yassl/include/yassl_error.hpp5
-rw-r--r--extra/yassl/include/yassl_imp.hpp15
-rw-r--r--extra/yassl/include/yassl_int.hpp11
-rw-r--r--extra/yassl/include/yassl_types.hpp3
-rw-r--r--extra/yassl/src/handshake.cpp101
-rw-r--r--extra/yassl/src/make.bat2
-rw-r--r--extra/yassl/src/socket_wrapper.cpp10
-rw-r--r--extra/yassl/src/ssl.cpp152
-rw-r--r--extra/yassl/src/yassl_error.cpp12
-rw-r--r--extra/yassl/src/yassl_imp.cpp151
-rw-r--r--extra/yassl/src/yassl_int.cpp160
-rw-r--r--extra/yassl/taocrypt/benchmark/make.bat2
-rw-r--r--extra/yassl/taocrypt/include/aes.hpp13
-rw-r--r--extra/yassl/taocrypt/include/algebra.hpp3
-rw-r--r--extra/yassl/taocrypt/include/arc4.hpp3
-rw-r--r--extra/yassl/taocrypt/include/asn.hpp6
-rw-r--r--extra/yassl/taocrypt/include/block.hpp7
-rw-r--r--extra/yassl/taocrypt/include/blowfish.hpp18
-rw-r--r--extra/yassl/taocrypt/include/des.hpp25
-rw-r--r--extra/yassl/taocrypt/include/integer.hpp10
-rw-r--r--extra/yassl/taocrypt/include/md5.hpp7
-rw-r--r--extra/yassl/taocrypt/include/misc.hpp19
-rw-r--r--extra/yassl/taocrypt/include/modes.hpp22
-rw-r--r--extra/yassl/taocrypt/include/ripemd.hpp7
-rw-r--r--extra/yassl/taocrypt/include/rsa.hpp3
-rw-r--r--extra/yassl/taocrypt/include/sha.hpp7
-rw-r--r--extra/yassl/taocrypt/include/twofish.hpp17
-rw-r--r--extra/yassl/taocrypt/src/aes.cpp26
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp6
-rw-r--r--extra/yassl/taocrypt/src/arc4.cpp15
-rw-r--r--extra/yassl/taocrypt/src/blowfish.cpp25
-rw-r--r--extra/yassl/taocrypt/src/des.cpp54
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp79
-rw-r--r--extra/yassl/taocrypt/src/make.bat5
-rw-r--r--extra/yassl/taocrypt/src/md4.cpp6
-rw-r--r--extra/yassl/taocrypt/src/md5.cpp37
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp138
-rw-r--r--extra/yassl/taocrypt/src/random.cpp3
-rw-r--r--extra/yassl/taocrypt/src/ripemd.cpp38
-rw-r--r--extra/yassl/taocrypt/src/sha.cpp41
-rw-r--r--extra/yassl/taocrypt/src/twofish.cpp25
-rw-r--r--extra/yassl/taocrypt/test/make.bat2
-rw-r--r--extra/yassl/taocrypt/test/test.cpp2
-rw-r--r--extra/yassl/testsuite/make.bat2
-rw-r--r--extra/yassl/testsuite/test.hpp67
-rw-r--r--include/Makefile.am1
-rw-r--r--include/abi_check.ic914
-rw-r--r--include/my_sys.h19
-rw-r--r--myisam/mi_open.c21
-rw-r--r--myisam/myisampack.c2
-rw-r--r--mysql-test/Makefile.am24
-rw-r--r--mysql-test/lib/mtr_cases.pl4
-rw-r--r--mysql-test/lib/mtr_io.pl14
-rw-r--r--mysql-test/lib/mtr_misc.pl1
-rw-r--r--mysql-test/lib/mtr_process.pl5
-rw-r--r--mysql-test/lib/mtr_report.pl7
-rw-r--r--mysql-test/mysql-test-run-shell.sh (renamed from mysql-test/mysql-test-run.sh)0
-rwxr-xr-xmysql-test/mysql-test-run.pl477
-rw-r--r--mysql-test/r/alter_table.result132
-rw-r--r--mysql-test/r/bigint.result11
-rw-r--r--mysql-test/r/date_formats.result66
-rw-r--r--mysql-test/r/default.result92
-rw-r--r--mysql-test/r/fix_priv_tables.result36
-rw-r--r--mysql-test/r/fix_priv_tabs.result0
-rw-r--r--mysql-test/r/func_misc.result7
-rw-r--r--mysql-test/r/func_time.result6
-rw-r--r--mysql-test/r/have_mysql_upgrade.result2
-rw-r--r--mysql-test/r/information_schema.result2
-rw-r--r--mysql-test/r/init_connect.result2
-rw-r--r--mysql-test/r/key_cache.result4
-rw-r--r--mysql-test/r/limit.result1
-rw-r--r--mysql-test/r/lowercase_fs_off.result1
-rw-r--r--mysql-test/r/mysql.result6
-rw-r--r--mysql-test/r/mysql_upgrade.result127
-rw-r--r--mysql-test/r/mysqladmin.result4
-rw-r--r--mysql-test/r/mysqldump.result6
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/r/read_only.result5
-rw-r--r--mysql-test/r/rpl000015.result2
-rw-r--r--mysql-test/r/rpl_deadlock.result2
-rw-r--r--mysql-test/r/rpl_drop_db.result2
-rw-r--r--mysql-test/r/rpl_ignore_revoke.result1
-rw-r--r--mysql-test/r/rpl_init_slave.result3
-rw-r--r--mysql-test/r/rpl_max_relay_size.result2
-rw-r--r--mysql-test/r/rpl_sp.result24
-rw-r--r--mysql-test/r/rpl_timezone.result2
-rw-r--r--mysql-test/r/rpl_variables.result2
-rw-r--r--mysql-test/r/sp.result85
-rw-r--r--mysql-test/r/type_float.result2
-rw-r--r--mysql-test/r/udf.result35
-rw-r--r--mysql-test/r/varbinary.result52
-rw-r--r--mysql-test/r/view_grant.result14
-rw-r--r--mysql-test/std_data/bug19371.MYDbin0 -> 40 bytes
-rw-r--r--mysql-test/std_data/bug19371.MYIbin0 -> 1024 bytes
-rw-r--r--mysql-test/std_data/bug19371.frmbin0 -> 8578 bytes
-rw-r--r--mysql-test/t/alter_table.test115
-rw-r--r--mysql-test/t/bigint.test9
-rw-r--r--mysql-test/t/date_formats.test8
-rw-r--r--mysql-test/t/default.test58
-rw-r--r--mysql-test/t/fix_priv_tables.test66
-rw-r--r--mysql-test/t/func_misc.test7
-rw-r--r--mysql-test/t/func_time.test12
-rw-r--r--mysql-test/t/information_schema.test2
-rw-r--r--mysql-test/t/init_connect.test4
-rw-r--r--mysql-test/t/key_cache.test7
-rw-r--r--mysql-test/t/limit.test2
-rw-r--r--mysql-test/t/lowercase_fs_off.test1
-rw-r--r--mysql-test/t/mysql.test18
-rw-r--r--mysql-test/t/mysql_delimiter.sql10
-rwxr-xr-xmysql-test/t/mysql_delimiter_19799.sql1
-rw-r--r--mysql-test/t/mysql_upgrade.test20
-rw-r--r--mysql-test/t/mysqladmin.test32
-rw-r--r--mysql-test/t/mysqldump.test6
-rw-r--r--mysql-test/t/mysqltest.test40
-rw-r--r--mysql-test/t/read_only.test12
-rw-r--r--mysql-test/t/rpl000015.test2
-rw-r--r--mysql-test/t/rpl_deadlock.test3
-rw-r--r--mysql-test/t/rpl_drop_db.test7
-rw-r--r--mysql-test/t/rpl_ignore_revoke.test4
-rw-r--r--mysql-test/t/rpl_init_slave.test6
-rw-r--r--mysql-test/t/rpl_max_relay_size.test5
-rw-r--r--mysql-test/t/rpl_sp.test28
-rw-r--r--mysql-test/t/rpl_timezone.test7
-rw-r--r--mysql-test/t/rpl_variables.test6
-rw-r--r--mysql-test/t/sp.test77
-rw-r--r--mysql-test/t/system_mysql_db_fix30020-master.opt (renamed from mysql-test/t/system_mysql_db_fix-master.opt)0
-rw-r--r--mysql-test/t/system_mysql_db_fix30020.test (renamed from mysql-test/t/system_mysql_db_fix.test)6
-rw-r--r--mysql-test/t/system_mysql_db_fix40123-master.opt1
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test79
-rw-r--r--mysql-test/t/udf.test39
-rw-r--r--mysql-test/t/varbinary.test43
-rw-r--r--mysql-test/t/view_grant.test16
-rwxr-xr-xmysys/CMakeLists.txt3
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/my_getopt.c6
-rw-r--r--mysys/my_getpagesize.c41
-rw-r--r--mysys/my_mmap.c7
-rw-r--r--scripts/mysql_fix_privilege_tables.sh18
-rw-r--r--scripts/mysql_fix_privilege_tables.sql172
-rw-r--r--sql-common/my_time.c4
-rw-r--r--sql/field_conv.cc24
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/item.cc1
-rw-r--r--sql/item_func.cc66
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/item_timefunc.cc18
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/mysqld.cc28
-rw-r--r--sql/sp.cc9
-rw-r--r--sql/sql_base.cc10
-rw-r--r--sql/sql_handler.cc38
-rw-r--r--sql/sql_parse.cc144
-rw-r--r--sql/sql_table.cc123
-rw-r--r--sql/udf_example.c31
-rw-r--r--sql/udf_example.def2
-rw-r--r--strings/strtod.c20
-rw-r--r--support-files/mysql.server.sh2
-rw-r--r--tests/Makefile.am14
-rw-r--r--tools/Makefile.am11
-rw-r--r--vio/Makefile.am38
178 files changed, 3650 insertions, 2009 deletions
diff --git a/.bzrignore b/.bzrignore
index 8455c05b220..ca4ba1432aa 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -9,6 +9,8 @@
*.d
*.da
*.exe
+*.gcda
+*.gcno
*.gcov
*.idb
*.la
@@ -209,6 +211,11 @@ bdb/dist/autom4te.cache/requests
bdb/dist/autom4te.cache/traces.0
bdb/dist/config.hin
bdb/dist/configure
+bdb/dist/db.h
+bdb/dist/db_config.h
+bdb/dist/db_cxx.h
+bdb/dist/db_int.h
+bdb/dist/include.tcl
bdb/dist/tags
bdb/dist/template/db_server_proc
bdb/dist/template/gen_client_ret
@@ -334,6 +341,7 @@ client/sql_string.cpp
client/ssl_test
client/thimble
client/thread_test
+client/tmp.diff
client_debug/*
client_release/*
client_test
@@ -697,6 +705,7 @@ mysql-test/r/*.err
mysql-test/r/*.log
mysql-test/r/*.out
mysql-test/r/*.reject
+mysql-test/r/*.warnings
mysql-test/r/alter_table.err
mysql-test/r/archive.err
mysql-test/r/bdb-alter-table-1.err
@@ -762,10 +771,12 @@ mysql-test/r/rpl000016.eval
mysql-test/r/rpl_log.eval
mysql-test/r/slave-running.eval
mysql-test/r/slave-stopped.eval
+mysql-test/r/tmp.result
mysql-test/r/udf.log
mysql-test/share/mysql
mysql-test/std_data/*.pem
mysql-test/t/index_merge.load
+mysql-test/t/tmp.test
mysql-test/var
mysql-test/var/*
mysql.kdevprj
@@ -1322,11 +1333,3 @@ win/vs71cache.txt
win/vs8cache.txt
zlib/*.ds?
zlib/*.vcproj
-mysql-test/r/*.warnings
-bdb/dist/db.h
-bdb/dist/db_config.h
-bdb/dist/db_cxx.h
-bdb/dist/db_int.h
-bdb/dist/include.tcl
-*.gcda
-*.gcno
diff --git a/BitKeeper/etc/collapsed b/BitKeeper/etc/collapsed
index 10bc7a2182a..5ff033b2163 100644
--- a/BitKeeper/etc/collapsed
+++ b/BitKeeper/etc/collapsed
@@ -18,4 +18,14 @@
452c6c6dAjuNghfc1ObZ_UQ5SCl85g
4538a7b0EbDHHkWPbIwxO6ZIDdg6Dg
454a7ef8gdvE_ddMlJyghvOAkKPNOQ
+454bb488ijVLOUK_GFjcoISE0GxPUA
+454bb9a8AwlGRC_wWLS2sNMoRBMRGw
+454c946ciQoR4dfTBZ0RTBmGJKp6lw
+454f6e7eAnfLD9OCbGr5X9KiKvfKcQ
+454f704bJiJy0_Nx2drY9P5kK3uOzg
454f8960jsVT_kMKJtZ9OCgXoba0xQ
+454fa71cxshxszXJQYa9jbo0-_hAHw
+4550b0ceIcozdgQhWFUTAtWkN196lA
+4554a95d7txO1DuO9G3nAizI3SkFAA
+4554b3722d71SbPiI2Gx-RhbZjmuIQ
+4558b3d73Cxjlb7Wv1oytdSTthxDfw
diff --git a/Makefile.am b/Makefile.am
index 6038825c928..81ff4cf5a86 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -129,23 +129,11 @@ test-force:
./mysql-test-run --force && \
./mysql-test-run --ps-protocol --force
-# We are testing a new Perl version of the test script
-test-pl:
+test-force-mem:
cd mysql-test; \
- ./mysql-test-run.pl && \
- ./mysql-test-run.pl --ps-protocol
-
-test-force-pl:
- cd mysql-test; \
- ./mysql-test-run.pl --force && \
- ./mysql-test-run.pl --ps-protocol --force
+ ./mysql-test-run --force --mem && \
+ ./mysql-test-run --ps-protocol --force --mem
#used by autopush.pl to run memory based tests
-test-force-pl-mem:
- cd mysql-test; \
- ./mysql-test-run.pl --force --mem && \
- ./mysql-test-run.pl --ps-protocol --force --mem
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 09a6a3f1e2a..d37d99ad479 100755
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -66,7 +66,7 @@ TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug yassl taocrypt zlib wsock
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wsock32)
-ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c)
+ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
diff --git a/client/Makefile.am b/client/Makefile.am
index 29624f2017f..db578b05da4 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -16,11 +16,6 @@
# This file is public domain and comes with NO WARRANTY of any kind
-if HAVE_YASSL
- yassl_dummy_link_fix= $(top_srcdir)/extra/yassl/src/dummy.cpp
-else
- yassl_dummy_link_fix=
-endif
#AUTOMAKE_OPTIONS = nostdinc
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include \
@@ -40,27 +35,29 @@ mysqladmin_SOURCES = mysqladmin.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysqltest_SOURCES= mysqltest.c \
$(top_srcdir)/mysys/my_getsystime.c \
- $(top_srcdir)/mysys/my_copy.c \
- $(yassl_dummy_link_fix)
+ $(top_srcdir)/mysys/my_copy.c
+
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
-mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c $(top_srcdir)/mysys/my_new.cc
+mysqlbinlog_SOURCES = mysqlbinlog.cc \
+ $(top_srcdir)/mysys/mf_tempdir.c \
+ $(top_srcdir)/mysys/my_new.cc
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
-mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
-mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
-mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
-mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
+mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
+mysqltestmanagerc_SOURCES= mysqlmanagerc.c
+mysqlcheck_SOURCES= mysqlcheck.c
+mysqlshow_SOURCES= mysqlshow.c
mysqldump_SOURCES= mysqldump.c my_user.c \
- $(top_srcdir)/mysys/mf_getdate.c \
- $(yassl_dummy_link_fix)
-mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix)
-mysql_upgrade_SOURCES= mysql_upgrade.c $(yassl_dummy_link_fix)
+ $(top_srcdir)/mysys/mf_getdate.c
+mysqlimport_SOURCES= mysqlimport.c
+mysql_upgrade_SOURCES= mysql_upgrade.c \
+ $(top_srcdir)/mysys/my_getpagesize.c
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
- -DDATADIR="\"$(localstatedir)\""
+ -DDATADIR="\"$(localstatedir)\""
EXTRA_DIST = get_password.c CMakeLists.txt
diff --git a/client/mysql.cc b/client/mysql.cc
index cd24e1d5ce2..61d25eff3e2 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -819,10 +819,23 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
default_charset_used= 1;
break;
case OPT_DELIMITER:
- if (argument == disabled_my_option)
+ if (argument == disabled_my_option)
+ {
strmov(delimiter, DEFAULT_DELIMITER);
- else
- strmake(delimiter, argument, sizeof(delimiter) - 1);
+ }
+ else
+ {
+ /* Check that delimiter does not contain a backslash */
+ if (!strstr(argument, "\\"))
+ {
+ strmake(delimiter, argument, sizeof(delimiter) - 1);
+ }
+ else
+ {
+ put_info("DELIMITER cannot contain a backslash character", INFO_ERROR);
+ return 0;
+ }
+ }
delimiter_length= (uint)strlen(delimiter);
delimiter_str= delimiter;
break;
@@ -3040,6 +3053,14 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
INFO_ERROR);
return 0;
}
+ else
+ {
+ if (strstr(tmp, "\\"))
+ {
+ put_info("DELIMITER cannot contain a backslash character", INFO_ERROR);
+ return 0;
+ }
+ }
strmake(delimiter, tmp, sizeof(delimiter) - 1);
delimiter_length= (int)strlen(delimiter);
delimiter_str= delimiter;
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 520d87b5ed7..cce4b440be0 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -31,10 +31,12 @@
const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe";
const char *mysqld_name= "mysqld.exe";
+#define EXTRA_CLIENT_PATHS "client/release", "client/debug"
#else
const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql";
const char *mysqld_name= "mysqld";
+#define EXTRA_CLIENT_PATHS "client"
#endif /*__WIN__*/
extern TYPELIB sql_protocol_typelib;
@@ -499,8 +501,9 @@ int main(int argc, char **argv)
"mysql", NullS))
{
ret= 1;
- puts("Can't find data directory. Please restart with"
- " --datadir=path-to-writable-data-dir");
+ fprintf(stderr,
+ "Can't find data directory. Please restart with"
+ " --datadir=path-to-writable-data-dir");
goto error;
}
@@ -543,11 +546,13 @@ int main(int argc, char **argv)
}
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
- "bin", NullS))
+ "bin", EXTRA_CLIENT_PATHS, NullS))
{
ret= 1;
- printf("Can't find program '%s'\n", mysqlcheck_name);
- puts("Please restart with --basedir=mysql-install-directory");
+ fprintf(stderr,
+ "Can't find program '%s'\n"
+ "Please restart with --basedir=mysql-install-directory",
+ mysqlcheck_name);
goto error;
}
else
@@ -569,7 +574,7 @@ int main(int argc, char **argv)
ret= system(cmdline.str);
if (ret)
{
- printf("Error executing '%s'\n", cmdline.str);
+ fprintf(stderr, "Error executing '%s'\n", cmdline.str);
goto error;
}
@@ -580,12 +585,13 @@ int main(int argc, char **argv)
fix_priv_tables:
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
- "bin", NullS))
+ "bin", EXTRA_CLIENT_PATHS, NullS))
{
ret= 1;
- puts("Could not find MySQL command-line client (mysql).\n"
- "Please use --basedir to specify the directory"
- " where MySQL is installed.");
+ fprintf(stderr,
+ "Could not find MySQL command-line client (mysql).\n"
+ "Please use --basedir to specify the directory"
+ " where MySQL is installed.");
goto error;
}
else
@@ -593,16 +599,17 @@ fix_priv_tables:
if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0),
path, sizeof(path),
- "support_files", "share/mysql", "scripts",
+ "support_files", "share", "share/mysql", "scripts",
NullS)
&& find_file(MYSQL_FIX_PRIV_TABLES_NAME, "/usr/local/mysql", MYF(0),
path, sizeof(path),
"share/mysql", NullS))
{
ret= 1;
- puts("Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
- "Please use --basedir to specify the directory"
- " where MySQL is installed");
+ fprintf(stderr,
+ "Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
+ "Please use --basedir to specify the directory"
+ " where MySQL is installed");
goto error;
}
else
@@ -623,7 +630,7 @@ fix_priv_tables:
ret= system(cmdline.str);
if (ret)
- printf("Error executing '%s'\n", cmdline.str);
+ fprintf(stderr, "Error executing '%s'\n", cmdline.str);
error:
dynstr_free(&cmdline);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 77d7ddd345e..7b0437c4413 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -32,7 +32,7 @@
Holyfoot
*/
-#define MTEST_VERSION "3.0"
+#define MTEST_VERSION "3.1"
#include <my_global.h>
#include <mysql_embed.h>
@@ -273,6 +273,7 @@ enum enum_commands {
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT,
+ Q_CHMOD_FILE,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@@ -353,8 +354,10 @@ const char *command_names[]=
"copy_file",
"perl",
"die",
+
/* Don't execute any more commands, compare result */
"exit",
+ "chmod",
0
};
@@ -721,6 +724,20 @@ void close_connections()
}
+void close_statements()
+{
+ struct st_connection *con;
+ DBUG_ENTER("close_statements");
+ for (con= connections; con < next_con; con++)
+ {
+ if (con->stmt)
+ mysql_stmt_close(con->stmt);
+ con->stmt= 0;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
void close_files()
{
DBUG_ENTER("close_files");
@@ -1811,6 +1828,46 @@ void do_copy_file(struct st_command *command)
/*
SYNOPSIS
+ do_chmod_file
+ command command handle
+
+ DESCRIPTION
+ chmod <octal> <file>
+ Change file permission of <file>
+
+*/
+
+void do_chmod_file(struct st_command *command)
+{
+ ulong mode= 0;
+ static DYNAMIC_STRING ds_mode;
+ static DYNAMIC_STRING ds_file;
+ const struct command_arg chmod_file_args[] = {
+ "mode", ARG_STRING, TRUE, &ds_mode, "Mode of file",
+ "file", ARG_STRING, TRUE, &ds_file, "Filename of file to modify"
+ };
+ DBUG_ENTER("do_chmod_file");
+
+ check_command_args(command, command->first_argument,
+ chmod_file_args,
+ sizeof(chmod_file_args)/sizeof(struct command_arg),
+ ' ');
+
+ /* Parse what mode to set */
+ if (ds_mode.length != 4 ||
+ str2int(ds_mode.str, 8, 0, INT_MAX, &mode) == NullS)
+ die("You must write a 4 digit octal number for mode");
+
+ DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str));
+ handle_command_error(command, chmod(ds_file.str, mode));
+ dynstr_free(&ds_mode);
+ dynstr_free(&ds_file);
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ SYNOPSIS
do_file_exists
command called command
@@ -2857,6 +2914,10 @@ void do_close_connection(struct st_command *command)
}
}
#endif
+ if (next_con->stmt)
+ mysql_stmt_close(next_con->stmt);
+ next_con->stmt= 0;
+
mysql_close(&con->mysql);
if (con->util_mysql)
mysql_close(con->util_mysql);
@@ -4196,8 +4257,9 @@ void init_win_path_patterns()
/* List of string patterns to match in order to find paths */
const char* paths[] = { "$MYSQL_TEST_DIR",
"$MYSQL_TMP_DIR",
- "./test/", 0 };
- int num_paths= 3;
+ "$MYSQLTEST_VARDIR",
+ "./test/" };
+ int num_paths= sizeof(paths)/sizeof(char*);
int i;
char* p;
@@ -4217,6 +4279,13 @@ void init_win_path_patterns()
else
p= my_strdup(paths[i], MYF(MY_FAE));
+ /* Don't insert zero length strings in patterns array */
+ if (strlen(p) == 0)
+ {
+ my_free(p, MYF(0));
+ continue;
+ }
+
if (insert_dynamic(&patterns, (gptr) &p))
die(NullS);
@@ -4266,7 +4335,7 @@ void fix_win_paths(const char *val, int len)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
DBUG_PRINT("info", ("pattern: %s", *pattern));
- if (strlen(*pattern) == 0) continue;
+
/* Search for the path in string */
while ((p= strstr(val, *pattern)))
{
@@ -5687,6 +5756,7 @@ int main(int argc, char **argv)
case Q_FILE_EXIST: do_file_exist(command); break;
case Q_WRITE_FILE: do_write_file(command); break;
case Q_COPY_FILE: do_copy_file(command); break;
+ case Q_CHMOD_FILE: do_chmod_file(command); break;
case Q_PERL: do_perl(command); break;
case Q_DELIMITER:
do_delimiter(command);
@@ -5833,6 +5903,7 @@ int main(int argc, char **argv)
break;
case Q_DISABLE_PS_PROTOCOL:
ps_protocol_enabled= 0;
+ close_statements();
break;
case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol;
@@ -6519,7 +6590,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
{
my_regex_t r;
my_regmatch_t *subs;
- char *buf_end, *replace_end;
+ char *replace_end;
char *buf= *buf_p;
int len;
int buf_len, need_buf_len;
@@ -6539,8 +6610,6 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
SECURE_REG_BUF
- buf_end= buf + buf_len;
-
if (icase)
cflags|= REG_ICASE;
diff --git a/client/readline.cc b/client/readline.cc
index 3d524633d69..52abe1045b7 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -51,7 +51,8 @@ char *batch_readline(LINE_BUFFER *line_buff)
if (!(pos=intern_read_line(line_buff,&out_length)))
return 0;
if (out_length && pos[out_length-1] == '\n')
- out_length--; /* Remove '\n' */
+ if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
+ out_length--; /* Remove '\r' */
line_buff->read_length=out_length;
pos[out_length]=0;
return pos;
diff --git a/extra/yassl/README b/extra/yassl/README
index 2af4e98fe4c..fbeffd9db77 100644
--- a/extra/yassl/README
+++ b/extra/yassl/README
@@ -1,4 +1,56 @@
-yaSSL Release notes, version 1.4.0 (08/13/06)
+yaSSL Release notes, version 1.5.0 (11/09/06)
+
+ This release of yaSSL contains bug fixes, portability enhancements,
+ and full TLS 1.1 support. Use the functions:
+
+ SSL_METHOD *TLSv1_1_server_method(void);
+ SSL_METHOD *TLSv1_1_client_method(void);
+
+ or the SSLv23 versions (even though yaSSL doesn't support SSL 2.0 the v23
+ means to pick the highest of SSL 3.0, TLS 1.0, or TLS 1.1.
+
+
+See normal build instructions below under 1.0.6.
+See libcurl build instructions below under 1.3.0.
+
+
+
+****************yaSSL Release notes, version 1.4.5 (10/15/06)
+
+
+ This release of yaSSL contains bug fixes, portability enhancements,
+ zlib compression support, removal of assembly instructions at runtime if
+ not supported, and initial TLS 1.1 support.
+
+
+ Compression Notes: yaSSL uses zlib for compression and the compression
+ should only be used if yaSSL is at both ends because the implementation
+ details aren't yet standard. If you'd like to turn compression on use
+ the SSL_set_compression() function on the client before calling
+ SSL_connect(). If both the client and server were built with zlib support
+ then the connection will use compression. If the client isn't built with
+ support then SSL_set_compression() will return an error (-1).
+
+ To build yaSSL with zlib support on Unix simply have zlib support on your
+ system and configure will find it if it's in the standard locations. If
+ it's somewhere else use the option ./configure --with-zlib=DIR. If you'd
+ like to disable compression support in yaSSL use ./configure --without-zlib.
+
+ To build yaSSL with zlib support on Windows:
+
+ 1) download zlib from http://www.zlib.net/
+ 2) follow the instructions in zlib from projects/visualc6/README.txt
+ for how to add the zlib project into the yaSSL workspace noting that
+ you'll need to add configuration support for "Win32 Debug" and
+ "Win32 Release" in note 3 under "To use:".
+ 3) define HAVE_LIBZ when building yaSSL
+
+
+See normal build instructions below under 1.0.6.
+See libcurl build instructions below under 1.3.0.
+
+
+********************yaSSL Release notes, version 1.4.0 (08/13/06)
This release of yaSSL contains bug fixes, portability enhancements,
@@ -122,18 +174,6 @@ Choose (Re)Build All from the project workspace
run Debug\testsuite.exe from yaSSL-Home\testsuite to test the build
---To enable ia32 assembly for TaoCrypt ciphers and message digests
-
- On MSVC this is always on
-
- On GCC **, use ./configure --enable-ia32-asm
-
- ** This isn't on by default because of the use of intel syntax and the
- problem that olders versions of gas have with some addressing statements.
- If you enable this and get assemler errors during compilation or can't
- pass the TaoCrypt tests, please send todd@yassl.com a message and disable
- this option in the meantime.
-
***************** yaSSL Release notes, version 1.0.5
diff --git a/extra/yassl/examples/client/client.cpp b/extra/yassl/examples/client/client.cpp
index d655011deb6..6c3cdf04dc1 100644
--- a/extra/yassl/examples/client/client.cpp
+++ b/extra/yassl/examples/client/client.cpp
@@ -5,6 +5,35 @@
//#define TEST_RESUME
+void ClientError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
+{
+ SSL_CTX_free(ctx);
+ SSL_free(ssl);
+ tcp_close(sockfd);
+ err_sys(msg);
+}
+
+
+#ifdef NON_BLOCKING
+ void NonBlockingSSL_Connect(SSL* ssl, SSL_CTX* ctx, SOCKET_T& sockfd)
+ {
+ int ret = SSL_connect(ssl);
+ while (ret =! SSL_SUCCESS && SSL_get_error(ssl, 0) ==
+ SSL_ERROR_WANT_READ) {
+ printf("... client would block\n");
+ #ifdef _WIN32
+ Sleep(1000);
+ #else
+ sleep(1);
+ #endif
+ ret = SSL_connect(ssl);
+ }
+ if (ret != SSL_SUCCESS)
+ ClientError(ctx, ssl, sockfd, "SSL_connect failed");
+ }
+#endif
+
+
void client_test(void* args)
{
#ifdef _WIN32
@@ -18,6 +47,9 @@ void client_test(void* args)
set_args(argc, argv, *static_cast<func_args*>(args));
tcp_connect(sockfd);
+#ifdef NON_BLOCKING
+ tcp_set_nonblocking(sockfd);
+#endif
SSL_METHOD* method = TLSv1_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
@@ -27,13 +59,13 @@ void client_test(void* args)
SSL_set_fd(ssl, sockfd);
+
+#ifdef NON_BLOCKING
+ NonBlockingSSL_Connect(ssl, ctx, sockfd);
+#else
if (SSL_connect(ssl) != SSL_SUCCESS)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL_connect failed");
- }
+ ClientError(ctx, ssl, sockfd, "SSL_connect failed");
+#endif
showPeer(ssl);
const char* cipher = 0;
@@ -49,16 +81,14 @@ void client_test(void* args)
char msg[] = "hello yassl!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL_write failed");
- }
+ ClientError(ctx, ssl, sockfd, "SSL_write failed");
char reply[1024];
- reply[SSL_read(ssl, reply, sizeof(reply))] = 0;
+ int input = SSL_read(ssl, reply, sizeof(reply));
+ if (input > 0) {
+ reply[input] = 0;
printf("Server response: %s\n", reply);
+ }
#ifdef TEST_RESUME
SSL_SESSION* session = SSL_get_session(ssl);
@@ -75,24 +105,17 @@ void client_test(void* args)
SSL_set_session(sslResume, session);
if (SSL_connect(sslResume) != SSL_SUCCESS)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL resume failed");
- }
+ ClientError(ctx, sslResume, sockfd, "SSL_resume failed");
showPeer(sslResume);
if (SSL_write(sslResume, msg, sizeof(msg)) != sizeof(msg))
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL_write failed");
- }
+ ClientError(ctx, sslResume, sockfd, "SSL_write failed");
- reply[SSL_read(sslResume, reply, sizeof(reply))] = 0;
+ input = SSL_read(sslResume, reply, sizeof(reply));
+ if (input > 0) {
+ reply[input] = 0;
printf("Server response: %s\n", reply);
+ }
SSL_shutdown(sslResume);
SSL_free(sslResume);
diff --git a/extra/yassl/examples/echoclient/echoclient.cpp b/extra/yassl/examples/echoclient/echoclient.cpp
index 983254bf8a7..e2c33c7cda2 100644
--- a/extra/yassl/examples/echoclient/echoclient.cpp
+++ b/extra/yassl/examples/echoclient/echoclient.cpp
@@ -3,6 +3,15 @@
#include "../../testsuite/test.hpp"
+void EchoClientError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
+{
+ SSL_CTX_free(ctx);
+ SSL_free(ssl);
+ tcp_close(sockfd);
+ err_sys(msg);
+}
+
+
void echoclient_test(void* args)
{
#ifdef _WIN32
@@ -35,7 +44,7 @@ void echoclient_test(void* args)
tcp_connect(sockfd);
- SSL_METHOD* method = TLSv1_client_method();
+ SSL_METHOD* method = SSLv23_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_certs(ctx);
SSL* ssl = SSL_new(ctx);
@@ -43,12 +52,7 @@ void echoclient_test(void* args)
SSL_set_fd(ssl, sockfd);
if (SSL_connect(ssl) != SSL_SUCCESS)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL_connect failed");
- }
+ EchoClientError(ctx, ssl, sockfd, "SSL_connect failed");
char send[1024];
char reply[1024];
@@ -57,12 +61,7 @@ void echoclient_test(void* args)
int sendSz = strlen(send) + 1;
if (SSL_write(ssl, send, sendSz) != sendSz)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- err_sys("SSL_write failed");
- }
+ EchoClientError(ctx, ssl, sockfd, "SSL_write failed");
if (strncmp(send, "quit", 4) == 0) {
fputs("sending server shutdown command: quit!\n", fout);
diff --git a/extra/yassl/examples/echoserver/echoserver.cpp b/extra/yassl/examples/echoserver/echoserver.cpp
index cd31fedddd8..92613744ba0 100644
--- a/extra/yassl/examples/echoserver/echoserver.cpp
+++ b/extra/yassl/examples/echoserver/echoserver.cpp
@@ -56,7 +56,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
tcp_listen(sockfd);
- SSL_METHOD* method = TLSv1_server_method();
+ SSL_METHOD* method = SSLv23_server_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_serverCerts(ctx);
@@ -87,8 +87,12 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
- if (SSL_accept(ssl) != SSL_SUCCESS)
- EchoError(ctx, ssl, sockfd, clientfd, "SSL_accept failed");
+ if (SSL_accept(ssl) != SSL_SUCCESS) {
+ printf("SSL_accept failed\n");
+ SSL_free(ssl);
+ tcp_close(clientfd);
+ continue;
+ }
char command[1024];
int echoSz(0);
@@ -130,6 +134,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
if (SSL_write(ssl, command, echoSz) != echoSz)
EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
}
+ SSL_shutdown(ssl);
SSL_free(ssl);
tcp_close(clientfd);
}
diff --git a/extra/yassl/examples/server/server.cpp b/extra/yassl/examples/server/server.cpp
index d0bf70cd634..75ce4224770 100644
--- a/extra/yassl/examples/server/server.cpp
+++ b/extra/yassl/examples/server/server.cpp
@@ -13,6 +13,26 @@ void ServerError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
}
+#ifdef NON_BLOCKING
+ void NonBlockingSSL_Accept(SSL* ssl, SSL_CTX* ctx, SOCKET_T& clientfd)
+ {
+ int ret = SSL_accept(ssl);
+ while (ret != SSL_SUCCESS && SSL_get_error(ssl, 0) ==
+ SSL_ERROR_WANT_READ) {
+ printf("... server would block\n");
+ #ifdef _WIN32
+ Sleep(1000);
+ #else
+ sleep(1);
+ #endif
+ ret = SSL_accept(ssl);
+ }
+ if (ret != SSL_SUCCESS)
+ ServerError(ctx, ssl, clientfd, "SSL_accept failed");
+ }
+#endif
+
+
THREAD_RETURN YASSL_API server_test(void* args)
{
#ifdef _WIN32
@@ -33,7 +53,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL_METHOD* method = TLSv1_server_method();
SSL_CTX* ctx = SSL_CTX_new(method);
- //SSL_CTX_set_cipher_list(ctx, "RC4-SHA");
+ //SSL_CTX_set_cipher_list(ctx, "RC4-SHA:RC4-MD5");
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0);
set_serverCerts(ctx);
DH* dh = set_tmpDH(ctx);
@@ -41,15 +61,22 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
+#ifdef NON_BLOCKING
+ NonBlockingSSL_Accept(ssl, ctx, clientfd);
+#else
if (SSL_accept(ssl) != SSL_SUCCESS)
ServerError(ctx, ssl, clientfd, "SSL_accept failed");
+#endif
showPeer(ssl);
printf("Using Cipher Suite: %s\n", SSL_get_cipher(ssl));
char command[1024];
- command[SSL_read(ssl, command, sizeof(command))] = 0;
+ int input = SSL_read(ssl, command, sizeof(command));
+ if (input > 0) {
+ command[input] = 0;
printf("First client command: %s\n", command);
+ }
char msg[] = "I hear you, fa shizzle!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
@@ -57,6 +84,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
DH_free(dh);
SSL_CTX_free(ctx);
+ SSL_shutdown(ssl);
SSL_free(ssl);
tcp_close(clientfd);
@@ -82,3 +110,4 @@ THREAD_RETURN YASSL_API server_test(void* args)
}
#endif // NO_MAIN_DRIVER
+
diff --git a/extra/yassl/include/factory.hpp b/extra/yassl/include/factory.hpp
index 04d742431dc..dc25cf0ee70 100644
--- a/extra/yassl/include/factory.hpp
+++ b/extra/yassl/include/factory.hpp
@@ -42,12 +42,7 @@
namespace STL = STL_NAMESPACE;
-// VC60 workaround: it doesn't allow typename in some places
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
- #define CPP_TYPENAME
-#else
- #define CPP_TYPENAME typename
-#endif
+
namespace yaSSL {
diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h
index aa3f799cf80..dc6e3ef81f0 100644
--- a/extra/yassl/include/openssl/prefix_ssl.h
+++ b/extra/yassl/include/openssl/prefix_ssl.h
@@ -52,6 +52,7 @@
#define SSL_set_session yaSSL_set_session
#define SSL_get_session yaSSL_get_session
#define SSL_SESSION_set_timeout yaSSL_SESSION_set_timeout
+#define SSL_CTX_set_session_cache_mode yaSSL_CTX_set_session_cache_mode
#define SSL_get_peer_certificate yaSSL_get_peer_certificate
#define SSL_get_verify_result yaSSL_get_verify_result
#define SSL_CTX_set_verify yaSSL_CTX_set_verify
@@ -98,6 +99,8 @@
#define SSLv3_client_method yaSSLv3_client_method
#define TLSv1_server_method yaTLSv1_server_method
#define TLSv1_client_method yaTLSv1_client_method
+#define TLSv1_1_server_method yaTLSv1_1_server_method
+#define TLSv1_1_client_method yaTLSv1_1_client_method
#define SSLv23_server_method yaSSLv23_server_method
#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file
#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file
@@ -159,3 +162,4 @@
#define MD5_Init yaMD5_Init
#define MD5_Update yaMD5_Update
#define MD5_Final yaMD5_Final
+#define SSL_set_compression yaSSL_set_compression
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index 5e7290d2a7a..67c49a808fd 100644
--- a/extra/yassl/include/openssl/ssl.h
+++ b/extra/yassl/include/openssl/ssl.h
@@ -41,7 +41,7 @@
#include "rsa.h"
-#define YASSL_VERSION "1.4.3"
+#define YASSL_VERSION "1.5.0"
#if defined(__cplusplus)
@@ -228,6 +228,7 @@ void SSL_load_error_strings(void);
int SSL_set_session(SSL *ssl, SSL_SESSION *session);
SSL_SESSION* SSL_get_session(SSL* ssl);
long SSL_SESSION_set_timeout(SSL_SESSION*, long);
+long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode);
X509* SSL_get_peer_certificate(SSL*);
long SSL_get_verify_result(SSL*);
@@ -361,6 +362,8 @@ SSL_METHOD *SSLv3_server_method(void);
SSL_METHOD *SSLv3_client_method(void);
SSL_METHOD *TLSv1_server_method(void);
SSL_METHOD *TLSv1_client_method(void);
+SSL_METHOD *TLSv1_1_server_method(void);
+SSL_METHOD *TLSv1_1_client_method(void);
SSL_METHOD *SSLv23_server_method(void);
int SSL_CTX_use_certificate_file(SSL_CTX*, const char*, int);
@@ -531,6 +534,10 @@ void MD5_Final(unsigned char*, MD5_CTX*);
#define SSL_DEFAULT_CIPHER_LIST "" /* default all */
+/* yaSSL adds */
+int SSL_set_compression(SSL*); /* turn on yaSSL zlib compression */
+
+
#if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE)
diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp
index 9fc0d62f90e..bc82384d85e 100644
--- a/extra/yassl/include/socket_wrapper.hpp
+++ b/extra/yassl/include/socket_wrapper.hpp
@@ -70,8 +70,8 @@ typedef unsigned char byte;
// Wraps Windows Sockets and BSD Sockets
class Socket {
socket_t socket_; // underlying socket descriptor
- bool wouldBlock_; // for non-blocking data
- bool blocking_; // is option set
+ bool wouldBlock_; // if non-blocking data, for last read
+ bool nonBlocking_; // is option set
public:
explicit Socket(socket_t s = INVALID_SOCKET);
~Socket();
@@ -85,7 +85,7 @@ public:
bool wait();
bool WouldBlock() const;
- bool IsBlocking() const;
+ bool IsNonBlocking() const;
void closeSocket();
void shutDown(int how = SD_SEND);
diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp
index 72b79b05dbd..f820e5811d9 100644
--- a/extra/yassl/include/yassl_error.hpp
+++ b/extra/yassl/include/yassl_error.hpp
@@ -56,7 +56,10 @@ enum YasslError {
receive_error = 114,
certificate_error = 115,
privateKey_error = 116,
- badVersion_error = 117
+ badVersion_error = 117,
+ compress_error = 118,
+ decompress_error = 119,
+ pms_version_error = 120
// !!!! add error message to .cpp !!!!
diff --git a/extra/yassl/include/yassl_imp.hpp b/extra/yassl/include/yassl_imp.hpp
index 180d7fe7fe1..f51a902b2a5 100644
--- a/extra/yassl/include/yassl_imp.hpp
+++ b/extra/yassl/include/yassl_imp.hpp
@@ -132,7 +132,6 @@ class Data : public Message {
public:
Data();
Data(uint16 len, opaque* b);
- Data(uint16 len, const opaque* w);
friend output_buffer& operator<<(output_buffer&, const Data&);
@@ -141,9 +140,9 @@ public:
ContentType get_type() const;
uint16 get_length() const;
- const opaque* get_buffer() const;
void set_length(uint16 l);
opaque* set_buffer();
+ void SetData(uint16, const opaque*);
void Process(input_buffer&, SSL&);
private:
Data(const Data&); // hide copy
@@ -232,11 +231,11 @@ public:
void Process(input_buffer&, SSL&);
const opaque* get_random() const;
- friend void buildClientHello(SSL&, ClientHello&, CompressionMethod);
+ friend void buildClientHello(SSL&, ClientHello&);
friend void ProcessOldClientHello(input_buffer& input, SSL& ssl);
ClientHello();
- explicit ClientHello(ProtocolVersion pv);
+ ClientHello(ProtocolVersion pv, bool useCompression);
private:
ClientHello(const ClientHello&); // hide copy
ClientHello& operator=(const ClientHello&); // and assign
@@ -253,7 +252,7 @@ class ServerHello : public HandShakeBase {
opaque cipher_suite_[SUITE_LEN];
CompressionMethod compression_method_;
public:
- explicit ServerHello(ProtocolVersion pv);
+ ServerHello(ProtocolVersion pv, bool useCompression);
ServerHello();
friend input_buffer& operator>>(input_buffer&, ServerHello&);
@@ -629,8 +628,11 @@ struct Connection {
bool send_server_key_; // server key exchange?
bool master_clean_; // master secret clean?
bool TLS_; // TLSv1 or greater
+ bool TLSv1_1_; // TLSv1.1 or greater
bool sessionID_Set_; // do we have a session
- ProtocolVersion version_;
+ bool compression_; // zlib compression?
+ ProtocolVersion version_; // negotiated version
+ ProtocolVersion chVersion_; // client hello version
RandomPool& random_;
Connection(ProtocolVersion v, RandomPool& ran);
@@ -640,6 +642,7 @@ struct Connection {
void CleanPreMaster();
void CleanMaster();
void TurnOffTLS();
+ void TurnOffTLS1_1();
private:
Connection(const Connection&); // hide copy
Connection& operator=(const Connection&); // and assign
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index 0edff289b61..4a3c0ba4e20 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -431,6 +431,7 @@ private:
DH_Parms dhParms_;
pem_password_cb passwordCb_;
void* userData_;
+ bool sessionCacheOff_;
Stats stats_;
Mutex mutex_; // for Stats
public:
@@ -445,6 +446,7 @@ public:
const Stats& GetStats() const;
pem_password_cb GetPasswordCb() const;
void* GetUserData() const;
+ bool GetSessionCacheOff() const;
void setVerifyPeer();
void setVerifyNone();
@@ -453,6 +455,7 @@ public:
bool SetDH(const DH&);
void SetPasswordCb(pem_password_cb cb);
void SetUserData(void*);
+ void SetSessionCacheOff();
void IncrementStats(StatsField);
void AddCA(x509* ca);
@@ -600,6 +603,7 @@ public:
const Socket& getSocket() const;
YasslError GetError() const;
bool GetMultiProtocol() const;
+ bool CompressionOn() const;
Crypto& useCrypto();
Security& useSecurity();
@@ -617,9 +621,12 @@ public:
void set_preMaster(const opaque*, uint);
void set_masterSecret(const opaque*);
void SetError(YasslError);
+ int SetCompression();
+ void UnSetCompression();
// helpers
bool isTLS() const;
+ bool isTLSv1_1() const;
void order_error();
void makeMasterSecret();
void makeTLSMasterSecret();
@@ -653,6 +660,10 @@ private:
};
+// compression
+int Compress(const byte*, int, input_buffer&);
+int DeCompress(input_buffer&, int, input_buffer&);
+
// conversion functions
void c32to24(uint32, uint24&);
diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp
index e602ee180bf..646c71afddf 100644
--- a/extra/yassl/include/yassl_types.hpp
+++ b/extra/yassl/include/yassl_types.hpp
@@ -211,6 +211,7 @@ const int FINISHED_LABEL_SZ = 15; // TLS finished lable length
const int SEED_LEN = RAN_LEN * 2; // TLS seed, client + server random
const int DEFAULT_TIMEOUT = 500; // Default Session timeout in seconds
const int MAX_RECORD_SIZE = 16384; // 2^14, max size by standard
+const int COMPRESS_EXTRA = 1024; // extra compression possible addition
typedef uint8 Cipher; // first byte is always 0x00 for SSLv3 & TLS
@@ -222,7 +223,7 @@ typedef opaque* DistinguishedName;
typedef bool IsExportable;
-enum CompressionMethod { no_compression = 0 };
+enum CompressionMethod { no_compression = 0, zlib = 221 };
enum CipherType { stream, block };
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index 25f36c4ea8c..c03d72ff2ef 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -40,9 +40,11 @@ namespace yaSSL {
// Build a client hello message from cipher suites and compression method
-void buildClientHello(SSL& ssl, ClientHello& hello,
- CompressionMethod compression = no_compression)
+void buildClientHello(SSL& ssl, ClientHello& hello)
{
+ // store for pre master secret
+ ssl.useSecurity().use_connection().chVersion_ = hello.client_version_;
+
ssl.getCrypto().get_random().Fill(hello.random_, RAN_LEN);
if (ssl.getSecurity().get_resuming()) {
hello.id_len_ = ID_LEN;
@@ -55,7 +57,6 @@ void buildClientHello(SSL& ssl, ClientHello& hello,
memcpy(hello.cipher_suites_, ssl.getSecurity().get_parms().suites_,
hello.suite_len_);
hello.comp_len_ = 1;
- hello.compression_methods_ = compression;
hello.set_length(sizeof(ProtocolVersion) +
RAN_LEN +
@@ -83,7 +84,7 @@ void buildServerHello(SSL& ssl, ServerHello& hello)
hello.cipher_suite_[0] = ssl.getSecurity().get_parms().suite_[0];
hello.cipher_suite_[1] = ssl.getSecurity().get_parms().suite_[1];
- hello.compression_method_ = no_compression;
+ hello.compression_method_ = hello.compression_method_;
hello.set_length(sizeof(ProtocolVersion) + RAN_LEN + ID_LEN +
sizeof(hello.id_len_) + SUITE_LEN + SIZEOF_ENUM);
@@ -151,12 +152,18 @@ void buildHeaders(SSL& ssl, HandShakeHeader& hsHeader,
// add handshake from buffer into md5 and sha hashes, exclude record header
-void hashHandShake(SSL& ssl, const output_buffer& output)
+void hashHandShake(SSL& ssl, const output_buffer& output, bool removeIV = false)
{
uint sz = output.get_size() - RECORD_HEADER;
const opaque* buffer = output.get_buffer() + RECORD_HEADER;
+ if (removeIV) { // TLSv1_1 IV
+ uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
+ sz -= blockSz;
+ buffer += blockSz;
+ }
+
ssl.useHashes().use_MD5().update(buffer, sz);
ssl.useHashes().use_SHA().update(buffer, sz);
}
@@ -229,6 +236,18 @@ void decrypt_message(SSL& ssl, input_buffer& input, uint sz)
ssl.useCrypto().use_cipher().decrypt(plain.get_buffer(), cipher, sz);
memcpy(cipher, plain.get_buffer(), sz);
ssl.useSecurity().use_parms().encrypt_size_ = sz;
+
+ if (ssl.isTLSv1_1()) // IV
+ input.set_current(input.get_current() +
+ ssl.getCrypto().get_cipher().get_blockSize());
+}
+
+
+// output operator for input_buffer
+output_buffer& operator<<(output_buffer& output, const input_buffer& input)
+{
+ output.write(input.get_buffer(), input.get_size());
+ return output;
}
@@ -239,9 +258,12 @@ void cipherFinished(SSL& ssl, Finished& fin, output_buffer& output)
uint finishedSz = ssl.isTLS() ? TLS_FINISHED_SZ : FINISHED_SZ;
uint sz = RECORD_HEADER + HANDSHAKE_HEADER + finishedSz + digestSz;
uint pad = 0;
+ uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
+
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
+ if (ssl.isTLSv1_1())
+ sz += blockSz; // IV
sz += 1; // pad byte
- uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
pad = (sz - RECORD_HEADER) % blockSz;
pad = blockSz - pad;
sz += pad;
@@ -252,14 +274,21 @@ void cipherFinished(SSL& ssl, Finished& fin, output_buffer& output)
buildHeaders(ssl, hsHeader, rlHeader, fin);
rlHeader.length_ = sz - RECORD_HEADER; // record header includes mac
// and pad, hanshake doesn't
+ input_buffer iv;
+ if (ssl.isTLSv1_1() && ssl.getSecurity().get_parms().cipher_type_== block){
+ iv.allocate(blockSz);
+ ssl.getCrypto().get_random().Fill(iv.get_buffer(), blockSz);
+ iv.add_size(blockSz);
+ }
+ uint ivSz = iv.get_size();
output.allocate(sz);
- output << rlHeader << hsHeader << fin;
+ output << rlHeader << iv << hsHeader << fin;
- hashHandShake(ssl, output);
+ hashHandShake(ssl, output, ssl.isTLSv1_1() ? true : false);
opaque digest[SHA_LEN]; // max size
if (ssl.isTLS())
- TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER,
- output.get_size() - RECORD_HEADER, handshake);
+ TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER + ivSz,
+ output.get_size() - RECORD_HEADER - ivSz, handshake);
else
hmac(ssl, digest, output.get_buffer() + RECORD_HEADER,
output.get_size() - RECORD_HEADER, handshake);
@@ -282,9 +311,12 @@ void buildMessage(SSL& ssl, output_buffer& output, const Message& msg)
uint digestSz = ssl.getCrypto().get_digest().get_digestSize();
uint sz = RECORD_HEADER + msg.get_length() + digestSz;
uint pad = 0;
+ uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
+
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
+ if (ssl.isTLSv1_1()) // IV
+ sz += blockSz;
sz += 1; // pad byte
- uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
pad = (sz - RECORD_HEADER) % blockSz;
pad = blockSz - pad;
sz += pad;
@@ -294,13 +326,21 @@ void buildMessage(SSL& ssl, output_buffer& output, const Message& msg)
buildHeader(ssl, rlHeader, msg);
rlHeader.length_ = sz - RECORD_HEADER; // record header includes mac
// and pad, hanshake doesn't
+ input_buffer iv;
+ if (ssl.isTLSv1_1() && ssl.getSecurity().get_parms().cipher_type_== block){
+ iv.allocate(blockSz);
+ ssl.getCrypto().get_random().Fill(iv.get_buffer(), blockSz);
+ iv.add_size(blockSz);
+ }
+
+ uint ivSz = iv.get_size();
output.allocate(sz);
- output << rlHeader << msg;
+ output << rlHeader << iv << msg;
opaque digest[SHA_LEN]; // max size
if (ssl.isTLS())
- TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER,
- output.get_size() - RECORD_HEADER, msg.get_type());
+ TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER + ivSz,
+ output.get_size() - RECORD_HEADER - ivSz, msg.get_type());
else
hmac(ssl, digest, output.get_buffer() + RECORD_HEADER,
output.get_size() - RECORD_HEADER, msg.get_type());
@@ -456,6 +496,10 @@ void buildSHA_CertVerify(SSL& ssl, byte* digest)
// some clients still send sslv2 client hello
void ProcessOldClientHello(input_buffer& input, SSL& ssl)
{
+ if (input.get_remaining() < 2) {
+ ssl.SetError(bad_input);
+ return;
+ }
byte b0 = input[AUTO];
byte b1 = input[AUTO];
@@ -721,6 +765,7 @@ int DoProcessReply(SSL& ssl)
// each message in record, can be more than 1 if not encrypted
if (ssl.getSecurity().get_parms().pending_ == false) // cipher on
decrypt_message(ssl, buffer, hdr.length_);
+
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_));
if (!msg.get()) {
ssl.SetError(factory_error);
@@ -744,13 +789,13 @@ void processReply(SSL& ssl)
if (DoProcessReply(ssl))
// didn't complete process
- if (!ssl.getSocket().IsBlocking()) {
- // keep trying now
+ if (!ssl.getSocket().IsNonBlocking()) {
+ // keep trying now, blocking ok
while (!ssl.GetError())
if (DoProcessReply(ssl) == 0) break;
}
else
- // user will have try again later
+ // user will have try again later, non blocking
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
}
@@ -761,7 +806,8 @@ void sendClientHello(SSL& ssl)
ssl.verifyState(serverNull);
if (ssl.GetError()) return;
- ClientHello ch(ssl.getSecurity().get_connection().version_);
+ ClientHello ch(ssl.getSecurity().get_connection().version_,
+ ssl.getSecurity().get_connection().compression_);
RecordLayerHeader rlHeader;
HandShakeHeader hsHeader;
output_buffer out;
@@ -859,6 +905,7 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
buildFinished(ssl, ssl.useHashes().use_verify(), client); // client
}
else {
+ if (!ssl.getSecurity().GetContext()->GetSessionCacheOff())
GetSessions().add(ssl); // store session
if (side == client_end)
buildFinished(ssl, ssl.useHashes().use_verify(), server); // server
@@ -885,7 +932,20 @@ int sendData(SSL& ssl, const void* buffer, int sz)
for (;;) {
int len = min(sz - sent, MAX_RECORD_SIZE);
output_buffer out;
- const Data data(len, static_cast<const opaque*>(buffer) + sent);
+ input_buffer tmp;
+
+ Data data;
+
+ if (ssl.CompressionOn()) {
+ if (Compress(static_cast<const opaque*>(buffer) + sent, len,
+ tmp) == -1) {
+ ssl.SetError(compress_error);
+ return -1;
+ }
+ data.SetData(tmp.get_size(), tmp.get_buffer());
+ }
+ else
+ data.SetData(len, static_cast<const opaque*>(buffer) + sent);
buildMessage(ssl, out, data);
ssl.Send(out.get_buffer(), out.get_size());
@@ -947,7 +1007,8 @@ void sendServerHello(SSL& ssl, BufferOutput buffer)
ssl.verifyState(clientHelloComplete);
if (ssl.GetError()) return;
- ServerHello sh(ssl.getSecurity().get_connection().version_);
+ ServerHello sh(ssl.getSecurity().get_connection().version_,
+ ssl.getSecurity().get_connection().compression_);
RecordLayerHeader rlHeader;
HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer);
diff --git a/extra/yassl/src/make.bat b/extra/yassl/src/make.bat
index 148427a6f41..dde305721a7 100644
--- a/extra/yassl/src/make.bat
+++ b/extra/yassl/src/make.bat
@@ -1,7 +1,7 @@
REM quick and dirty build file for testing different MSDEVs
setlocal
-set myFLAGS= /I../include /I../mySTL /I../taocrypt/include /W3 /c /ZI
+set myFLAGS= /I../include /I../taocrypt/mySTL /I../taocrypt/include /W3 /c /ZI
cl %myFLAGS% buffer.cpp
cl %myFLAGS% cert_wrapper.cpp
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index 70944831884..f281b81a24a 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -63,7 +63,7 @@ namespace yaSSL {
Socket::Socket(socket_t s)
- : socket_(s), wouldBlock_(false), blocking_(false)
+ : socket_(s), wouldBlock_(false), nonBlocking_(false)
{}
@@ -148,8 +148,8 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags)
if (recvd == -1) {
if (get_lastError() == SOCKET_EWOULDBLOCK ||
get_lastError() == SOCKET_EAGAIN) {
- wouldBlock_ = true;
- blocking_ = true; // socket can block, only way to tell for win32
+ wouldBlock_ = true; // would have blocked this time only
+ nonBlocking_ = true; // socket nonblocking, win32 only way to tell
return 0;
}
}
@@ -191,9 +191,9 @@ bool Socket::WouldBlock() const
}
-bool Socket::IsBlocking() const
+bool Socket::IsNonBlocking() const
{
- return blocking_;
+ return nonBlocking_;
}
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index fe4661b5946..ec2e99adecb 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -184,10 +184,22 @@ SSL_METHOD* TLSv1_client_method()
}
+SSL_METHOD* TLSv1_1_server_method()
+{
+ return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,2));
+}
+
+
+SSL_METHOD* TLSv1_1_client_method()
+{
+ return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,2));
+}
+
+
SSL_METHOD* SSLv23_server_method()
{
// compatibility only, no version 2 support, but does SSL 3 and TLS 1
- return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,1), true);
+ return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,2), true);
}
@@ -196,7 +208,7 @@ SSL_METHOD* SSLv23_client_method()
// compatibility only, no version 2 support, but does SSL 3 and TLS 1
// though it sends TLS1 hello not SSLv2 so SSLv3 only servers will decline
// TODO: maybe add support to send SSLv2 hello ???
- return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,1), true);
+ return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,2), true);
}
@@ -407,7 +419,6 @@ int SSL_shutdown(SSL* ssl)
Alert alert(warning, close_notify);
sendAlert(*ssl, alert);
ssl->useLog().ShowTCP(ssl->getSocket().get_fd(), true);
- ssl->useSocket().closeSocket();
GetErrors().Remove();
@@ -415,8 +426,21 @@ int SSL_shutdown(SSL* ssl)
}
+/* on by default but allow user to turn off */
+long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode)
+{
+ if (mode == SSL_SESS_CACHE_OFF)
+ ctx->SetSessionCacheOff();
+
+ return SSL_SUCCESS;
+}
+
+
SSL_SESSION* SSL_get_session(SSL* ssl)
{
+ if (ssl->getSecurity().GetContext()->GetSessionCacheOff())
+ return 0;
+
return GetSessions().lookup(
ssl->getSecurity().get_connection().sessionID_);
}
@@ -424,6 +448,9 @@ SSL_SESSION* SSL_get_session(SSL* ssl)
int SSL_set_session(SSL* ssl, SSL_SESSION* session)
{
+ if (ssl->getSecurity().GetContext()->GetSessionCacheOff())
+ return SSL_FAILURE;
+
ssl->set_session(session);
return SSL_SUCCESS;
}
@@ -512,6 +539,19 @@ int SSL_get_error(SSL* ssl, int /*previous*/)
}
+
+/* turn on yaSSL zlib compression
+ returns 0 for success, else error (not built in)
+ only need to turn on for client, becuase server on by default if built in
+ but calling for server will tell you whether it's available or not
+*/
+int SSL_set_compression(SSL* ssl)
+{
+ return ssl->SetCompression();
+}
+
+
+
X509* SSL_get_peer_certificate(SSL* ssl)
{
return ssl->getCrypto().get_certManager().get_peerX509();
@@ -1359,6 +1399,56 @@ int SSL_pending(SSL* ssl)
}
+void SSL_CTX_set_default_passwd_cb(SSL_CTX* ctx, pem_password_cb cb)
+{
+ ctx->SetPasswordCb(cb);
+}
+
+
+int SSLeay_add_ssl_algorithms() // compatibility only
+{
+ return 1;
+}
+
+
+void ERR_remove_state(unsigned long)
+{
+ GetErrors().Remove();
+}
+
+
+int ERR_GET_REASON(int l)
+{
+ return l & 0xfff;
+}
+
+
+unsigned long err_helper(bool peek = false)
+{
+ int ysError = GetErrors().Lookup(peek);
+
+ // translate cert error for libcurl, it uses OpenSSL hex code
+ switch (ysError) {
+ case TaoCrypt::SIG_OTHER_E:
+ return CERTFICATE_ERROR;
+ break;
+ default :
+ return 0;
+ }
+}
+
+
+unsigned long ERR_peek_error()
+{
+ return err_helper(true);
+}
+
+
+unsigned long ERR_get_error()
+{
+ return err_helper();
+}
+
// functions for stunnel
@@ -1477,13 +1567,6 @@ int SSL_pending(SSL* ssl)
}
- long SSL_CTX_set_session_cache_mode(SSL_CTX*, long)
- {
- // TDOD:
- return SSL_SUCCESS;
- }
-
-
long SSL_CTX_set_timeout(SSL_CTX*, long)
{
// TDOD:
@@ -1498,12 +1581,6 @@ int SSL_pending(SSL* ssl)
}
- void SSL_CTX_set_default_passwd_cb(SSL_CTX* ctx, pem_password_cb cb)
- {
- ctx->SetPasswordCb(cb);
- }
-
-
int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX*, const char*, int)
{
// TDOD:
@@ -1555,49 +1632,6 @@ int SSL_pending(SSL* ssl)
}
- int SSLeay_add_ssl_algorithms() // compatibility only
- {
- return 1;
- }
-
-
- void ERR_remove_state(unsigned long)
- {
- GetErrors().Remove();
- }
-
-
- int ERR_GET_REASON(int l)
- {
- return l & 0xfff;
- }
-
- unsigned long err_helper(bool peek = false)
- {
- int ysError = GetErrors().Lookup(peek);
-
- // translate cert error for libcurl, it uses OpenSSL hex code
- switch (ysError) {
- case TaoCrypt::SIG_OTHER_E:
- return CERTFICATE_ERROR;
- break;
- default :
- return 0;
- }
- }
-
-
- unsigned long ERR_peek_error()
- {
- return err_helper(true);
- }
-
-
- unsigned long ERR_get_error()
- {
- return err_helper();
- }
-
// end stunnel needs
diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp
index 3531c0a2c74..25c595f40bc 100644
--- a/extra/yassl/src/yassl_error.cpp
+++ b/extra/yassl/src/yassl_error.cpp
@@ -133,6 +133,18 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "protocl version mismatch", max);
break;
+ case compress_error :
+ strncpy(buffer, "compression error", max);
+ break;
+
+ case decompress_error :
+ strncpy(buffer, "decompression error", max);
+ break;
+
+ case pms_version_error :
+ strncpy(buffer, "bad PreMasterSecret version error", max);
+ break;
+
// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index bd07f8b70f2..bf10c4b8932 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -87,7 +87,7 @@ void EncryptedPreMasterSecret::build(SSL& ssl)
opaque tmp[SECRET_LEN];
memset(tmp, 0, sizeof(tmp));
ssl.getCrypto().get_random().Fill(tmp, SECRET_LEN);
- ProtocolVersion pv = ssl.getSecurity().get_connection().version_;
+ ProtocolVersion pv = ssl.getSecurity().get_connection().chVersion_;
tmp[0] = pv.major_;
tmp[1] = pv.minor_;
ssl.set_preMaster(tmp, SECRET_LEN);
@@ -233,6 +233,10 @@ void EncryptedPreMasterSecret::read(SSL& ssl, input_buffer& input)
rsa.decrypt(preMasterSecret, secret_, length_,
ssl.getCrypto().get_random());
+ ProtocolVersion pv = ssl.getSecurity().get_connection().chVersion_;
+ if (pv.major_ != preMasterSecret[0] || pv.minor_ != preMasterSecret[1])
+ ssl.SetError(pms_version_error); // continue deriving for timing attack
+
ssl.set_preMaster(preMasterSecret, SECRET_LEN);
ssl.makeMasterSecret();
}
@@ -437,6 +441,7 @@ Parameters::Parameters(ConnectionEnd ce, const Ciphers& ciphers,
ProtocolVersion pv, bool haveDH) : entity_(ce)
{
pending_ = true; // suite not set yet
+ strncpy(cipher_name_, "NONE", 5);
if (ciphers.setSuites_) { // use user set list
suites_size_ = ciphers.suiteSz_;
@@ -445,6 +450,7 @@ Parameters::Parameters(ConnectionEnd ce, const Ciphers& ciphers,
}
else
SetSuites(pv, ce == server_end && !haveDH); // defaults
+
}
@@ -613,14 +619,18 @@ output_buffer& operator<<(output_buffer& output, const HandShakeHeader& hdr)
void HandShakeHeader::Process(input_buffer& input, SSL& ssl)
{
ssl.verifyState(*this);
+ if (ssl.GetError()) return;
const HandShakeFactory& hsf = ssl.getFactory().getHandShake();
mySTL::auto_ptr<HandShakeBase> hs(hsf.CreateObject(type_));
if (!hs.get()) {
ssl.SetError(factory_error);
return;
}
- hashHandShake(ssl, input, c24to32(length_));
+ uint len = c24to32(length_);
+ hashHandShake(ssl, input, len);
+
+ hs->set_length(len);
input >> *hs;
hs->Process(input, ssl);
}
@@ -849,11 +859,17 @@ void Alert::Process(input_buffer& input, SSL& ssl)
opaque mac[SHA_LEN];
input.read(mac, digestSz);
+ if (ssl.getSecurity().get_parms().cipher_type_ == block) {
+ int ivExtra = 0;
opaque fill;
- int padSz = ssl.getSecurity().get_parms().encrypt_size_ - aSz -
- digestSz;
+
+ if (ssl.isTLSv1_1())
+ ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
+ int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
+ aSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
+ }
// verify
if (memcmp(mac, verify, digestSz)) {
@@ -879,9 +895,13 @@ Data::Data(uint16 len, opaque* b)
{}
-Data::Data(uint16 len, const opaque* w)
- : length_(len), buffer_(0), write_buffer_(w)
-{}
+void Data::SetData(uint16 len, const opaque* buffer)
+{
+ assert(write_buffer_ == 0);
+
+ length_ = len;
+ write_buffer_ = buffer;
+}
input_buffer& Data::set(input_buffer& in)
{
@@ -907,17 +927,12 @@ uint16 Data::get_length() const
}
-const opaque* Data::get_buffer() const
-{
- return write_buffer_;
-}
-
-
void Data::set_length(uint16 l)
{
length_ = l;
}
+
opaque* Data::set_buffer()
{
return buffer_;
@@ -937,27 +952,42 @@ void Data::Process(input_buffer& input, SSL& ssl)
{
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
int pad = 0, padByte = 0;
+ int ivExtra = 0;
+
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
- pad = *(input.get_buffer() + input.get_current() + msgSz - 1);
+ if (ssl.isTLSv1_1()) // IV
+ ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
+ pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
padByte = 1;
}
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
- int dataSz = msgSz - digestSz - pad - padByte;
+ int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
opaque verify[SHA_LEN];
+ const byte* rawData = input.get_buffer() + input.get_current();
+
// read data
- if (dataSz) {
+ if (dataSz) { // could be compressed
+ if (ssl.CompressionOn()) {
+ input_buffer tmp;
+ if (DeCompress(input, dataSz, tmp) == -1) {
+ ssl.SetError(decompress_error);
+ return;
+ }
+ ssl.addData(NEW_YS input_buffer(tmp.get_size(),
+ tmp.get_buffer(), tmp.get_size()));
+ }
+ else {
input_buffer* data;
ssl.addData(data = NEW_YS input_buffer(dataSz));
input.read(data->get_buffer(), dataSz);
data->add_size(dataSz);
+ }
if (ssl.isTLS())
- TLS_hmac(ssl, verify, data->get_buffer(), dataSz, application_data,
- true);
+ TLS_hmac(ssl, verify, rawData, dataSz, application_data, true);
else
- hmac(ssl, verify, data->get_buffer(), dataSz, application_data,
- true);
+ hmac(ssl, verify, rawData, dataSz, application_data, true);
}
// read mac and fill
@@ -1220,6 +1250,13 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
if (ssl.isTLS() && server_version_.minor_ < 1)
// downgrade to SSLv3
ssl.useSecurity().use_connection().TurnOffTLS();
+ else if (ssl.isTLSv1_1() && server_version_.minor_ == 1)
+ // downdrage to TLSv1
+ ssl.useSecurity().use_connection().TurnOffTLS1_1();
+ }
+ else if (ssl.isTLSv1_1() && server_version_.minor_ < 2) {
+ ssl.SetError(badVersion_error);
+ return;
}
else if (ssl.isTLS() && server_version_.minor_ < 1) {
ssl.SetError(badVersion_error);
@@ -1252,6 +1289,10 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
ssl.useSecurity().set_resuming(false);
ssl.useLog().Trace("server denied resumption");
}
+
+ if (ssl.CompressionOn() && !compression_method_)
+ ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request
+
ssl.useStates().useClient() = serverHelloComplete;
}
@@ -1263,8 +1304,9 @@ ServerHello::ServerHello()
}
-ServerHello::ServerHello(ProtocolVersion pv)
- : server_version_(pv)
+ServerHello::ServerHello(ProtocolVersion pv, bool useCompression)
+ : server_version_(pv),
+ compression_method_(useCompression ? zlib : no_compression)
{
memset(random_, 0, RAN_LEN);
memset(session_id_, 0, ID_LEN);
@@ -1341,6 +1383,8 @@ opaque* ClientKeyBase::get_clientKey() const
// input operator for Client Hello
input_buffer& operator>>(input_buffer& input, ClientHello& hello)
{
+ uint begin = input.get_current(); // could have extensions at end
+
// Protocol
hello.client_version_.major_ = input[AUTO];
hello.client_version_.minor_ = input[AUTO];
@@ -1361,8 +1405,19 @@ input_buffer& operator>>(input_buffer& input, ClientHello& hello)
// Compression
hello.comp_len_ = input[AUTO];
- while (hello.comp_len_--) // ignore for now
- hello.compression_methods_ = CompressionMethod(input[AUTO]);
+ hello.compression_methods_ = no_compression;
+ while (hello.comp_len_--) {
+ CompressionMethod cm = CompressionMethod(input[AUTO]);
+ if (cm == zlib)
+ hello.compression_methods_ = zlib;
+ }
+
+ uint read = input.get_current() - begin;
+ uint expected = hello.get_length();
+
+ // ignore client hello extensions for now
+ if (read < expected)
+ input.set_current(input.get_current() + expected - read);
return input;
}
@@ -1400,6 +1455,13 @@ output_buffer& operator<<(output_buffer& output, const ClientHello& hello)
// Client Hello processing handler
void ClientHello::Process(input_buffer&, SSL& ssl)
{
+ // store version for pre master secret
+ ssl.useSecurity().use_connection().chVersion_ = client_version_;
+
+ if (client_version_.major_ != 3) {
+ ssl.SetError(badVersion_error);
+ return;
+ }
if (ssl.GetMultiProtocol()) { // SSLv23 support
if (ssl.isTLS() && client_version_.minor_ < 1) {
// downgrade to SSLv3
@@ -1407,20 +1469,29 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
ProtocolVersion pv = ssl.getSecurity().get_connection().version_;
ssl.useSecurity().use_parms().SetSuites(pv); // reset w/ SSL suites
}
+ else if (ssl.isTLSv1_1() && client_version_.minor_ == 1)
+ // downgrade to TLSv1, but use same suites
+ ssl.useSecurity().use_connection().TurnOffTLS1_1();
+ }
+ else if (ssl.isTLSv1_1() && client_version_.minor_ < 2) {
+ ssl.SetError(badVersion_error);
+ return;
}
else if (ssl.isTLS() && client_version_.minor_ < 1) {
ssl.SetError(badVersion_error);
return;
}
- else if (!ssl.isTLS() && (client_version_.major_ == 3 &&
- client_version_.minor_ >= 1)) {
+ else if (!ssl.isTLS() && client_version_.minor_ >= 1) {
ssl.SetError(badVersion_error);
return;
}
+
ssl.set_random(random_, client_end);
while (id_len_) { // trying to resume
- SSL_SESSION* session = GetSessions().lookup(session_id_);
+ SSL_SESSION* session = 0;
+ if (!ssl.getSecurity().GetContext()->GetSessionCacheOff())
+ session = GetSessions().lookup(session_id_);
if (!session) {
ssl.useLog().Trace("session lookup failed");
break;
@@ -1444,6 +1515,9 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
ssl.matchSuite(cipher_suites_, suite_len_);
ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]);
+ if (compression_methods_ == zlib)
+ ssl.SetCompression();
+
ssl.useStates().useServer() = clientHelloComplete;
}
@@ -1478,8 +1552,9 @@ ClientHello::ClientHello()
}
-ClientHello::ClientHello(ProtocolVersion pv)
- : client_version_(pv)
+ClientHello::ClientHello(ProtocolVersion pv, bool useCompression)
+ : client_version_(pv),
+ compression_methods_(useCompression ? zlib : no_compression)
{
memset(random_, 0, RAN_LEN);
}
@@ -1943,8 +2018,13 @@ void Finished::Process(input_buffer& input, SSL& ssl)
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
input.read(mac, digestSz);
+ uint ivExtra = 0;
+ if (ssl.getSecurity().get_parms().cipher_type_ == block)
+ if (ssl.isTLSv1_1())
+ ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
+
opaque fill;
- int padSz = ssl.getSecurity().get_parms().encrypt_size_ -
+ int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
HANDSHAKE_HEADER - finishedSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
@@ -2018,7 +2098,9 @@ void clean(volatile opaque* p, uint sz, RandomPool& ran)
Connection::Connection(ProtocolVersion v, RandomPool& ran)
: pre_master_secret_(0), sequence_number_(0), peer_sequence_number_(0),
pre_secret_len_(0), send_server_key_(false), master_clean_(false),
- TLS_(v.major_ >= 3 && v.minor_ >= 1), version_(v), random_(ran)
+ TLS_(v.major_ >= 3 && v.minor_ >= 1),
+ TLSv1_1_(v.major_ >= 3 && v.minor_ >= 2), compression_(false),
+ version_(v), random_(ran)
{
memset(sessionID_, 0, sizeof(sessionID_));
}
@@ -2043,6 +2125,13 @@ void Connection::TurnOffTLS()
}
+void Connection::TurnOffTLS1_1()
+{
+ TLSv1_1_ = false;
+ version_.minor_ = 1;
+}
+
+
// wipeout master secret
void Connection::CleanMaster()
{
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index 5288acb2bcd..1a407ca8ba5 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -38,6 +38,11 @@
#endif
+#ifdef HAVE_LIBZ
+ #include "zlib.h"
+#endif
+
+
#ifdef YASSL_PURE_C
void* operator new(size_t sz, yaSSL::new_t)
@@ -727,6 +732,32 @@ void SSL::set_preMaster(const opaque* pre, uint sz)
}
+// set yaSSL zlib type compression
+int SSL::SetCompression()
+{
+#ifdef HAVE_LIBZ
+ secure_.use_connection().compression_ = true;
+ return 0;
+#else
+ return -1; // not built in
+#endif
+}
+
+
+// unset yaSSL zlib type compression
+void SSL::UnSetCompression()
+{
+ secure_.use_connection().compression_ = false;
+}
+
+
+// is yaSSL zlib compression on
+bool SSL::CompressionOn() const
+{
+ return secure_.get_connection().compression_;
+}
+
+
// store master secret
void SSL::set_masterSecret(const opaque* sec)
{
@@ -1109,6 +1140,11 @@ void SSL::verifyState(const RecordLayerHeader& rlHeader)
{
if (GetError()) return;
+ if (rlHeader.version_.major_ != 3 || rlHeader.version_.minor_ > 2) {
+ SetError(badVersion_error);
+ return;
+ }
+
if (states_.getRecord() == recordNotReady ||
(rlHeader.type_ == application_data && // data and handshake
states_.getHandShake() != handShakeReady) ) // isn't complete yet
@@ -1247,6 +1283,9 @@ void SSL::matchSuite(const opaque* peer, uint length)
void SSL::set_session(SSL_SESSION* s)
{
+ if (getSecurity().GetContext()->GetSessionCacheOff())
+ return;
+
if (s && GetSessions().lookup(s->GetID(), &secure_.use_resume())) {
secure_.set_resuming(true);
crypto_.use_certManager().setPeerX509(s->GetPeerX509());
@@ -1344,6 +1383,12 @@ bool SSL::isTLS() const
}
+bool SSL::isTLSv1_1() const
+{
+ return secure_.get_connection().TLSv1_1_;
+}
+
+
void SSL::addData(input_buffer* data)
{
buffers_.useData().push_back(data);
@@ -1703,7 +1748,7 @@ bool SSL_METHOD::multipleProtocol() const
SSL_CTX::SSL_CTX(SSL_METHOD* meth)
: method_(meth), certificate_(0), privateKey_(0), passwordCb_(0),
- userData_(0)
+ userData_(0), sessionCacheOff_(false)
{}
@@ -1784,12 +1829,24 @@ void* SSL_CTX::GetUserData() const
}
+bool SSL_CTX::GetSessionCacheOff() const
+{
+ return sessionCacheOff_;
+}
+
+
void SSL_CTX::SetUserData(void* data)
{
userData_ = data;
}
+void SSL_CTX::SetSessionCacheOff()
+{
+ sessionCacheOff_ = true;
+}
+
+
void SSL_CTX::setVerifyPeer()
{
method_->setVerifyPeer();
@@ -2312,9 +2369,110 @@ ASN1_STRING* StringHolder::GetString()
}
+#ifdef HAVE_LIBZ
+
+ void* myAlloc(void* /* opaque */, unsigned int item, unsigned int size)
+ {
+ return NEW_YS unsigned char[item * size];
+ }
+
+
+ void myFree(void* /* opaque */, void* memory)
+ {
+ unsigned char* ptr = static_cast<unsigned char*>(memory);
+ yaSSL::ysArrayDelete(ptr);
+ }
+
+
+ // put size in front of compressed data
+ int Compress(const byte* in, int sz, input_buffer& buffer)
+ {
+ byte tmp[LENGTH_SZ];
+ z_stream c_stream; /* compression stream */
+
+ buffer.allocate(sz + sizeof(uint16) + COMPRESS_EXTRA);
+
+ c_stream.zalloc = myAlloc;
+ c_stream.zfree = myFree;
+ c_stream.opaque = (voidpf)0;
+
+ c_stream.next_in = const_cast<byte*>(in);
+ c_stream.avail_in = sz;
+ c_stream.next_out = buffer.get_buffer() + sizeof(tmp);
+ c_stream.avail_out = buffer.get_capacity() - sizeof(tmp);
+
+ if (deflateInit(&c_stream, 8) != Z_OK) return -1;
+ int err = deflate(&c_stream, Z_FINISH);
+ deflateEnd(&c_stream);
+ if (err != Z_OK && err != Z_STREAM_END) return -1;
+
+ c16toa(sz, tmp);
+ memcpy(buffer.get_buffer(), tmp, sizeof(tmp));
+ buffer.add_size(c_stream.total_out + sizeof(tmp));
+
+ return 0;
+ }
+
+
+ // get uncompressed size in front
+ int DeCompress(input_buffer& in, int sz, input_buffer& out)
+ {
+ byte tmp[LENGTH_SZ];
+
+ in.read(tmp, sizeof(tmp));
+
+ uint16 len;
+ ato16(tmp, len);
+
+ out.allocate(len);
+
+ z_stream d_stream; /* decompression stream */
+
+ d_stream.zalloc = myAlloc;
+ d_stream.zfree = myFree;
+ d_stream.opaque = (voidpf)0;
+
+ d_stream.next_in = in.get_buffer() + in.get_current();
+ d_stream.avail_in = sz - sizeof(tmp);
+ d_stream.next_out = out.get_buffer();
+ d_stream.avail_out = out.get_capacity();
+
+ if (inflateInit(&d_stream) != Z_OK) return -1;
+ int err = inflate(&d_stream, Z_FINISH);
+ inflateEnd(&d_stream);
+ if (err != Z_OK && err != Z_STREAM_END) return -1;
+
+ out.add_size(d_stream.total_out);
+ in.set_current(in.get_current() + sz - sizeof(tmp));
+
+ return 0;
+ }
+
+
+#else // LIBZ
+
+ // these versions should never get called
+ int Compress(const byte* in, int sz, input_buffer& buffer)
+ {
+ assert(0);
+ return -1;
+ }
+
+
+ int DeCompress(input_buffer& in, int sz, input_buffer& out)
+ {
+ assert(0);
+ return -1;
+ }
+
+
+#endif // LIBZ
+
+
} // namespace
+
extern "C" void yaSSL_CleanUp()
{
TaoCrypt::CleanUp();
diff --git a/extra/yassl/taocrypt/benchmark/make.bat b/extra/yassl/taocrypt/benchmark/make.bat
index 4ebe4b32417..bf1383f5e97 100644
--- a/extra/yassl/taocrypt/benchmark/make.bat
+++ b/extra/yassl/taocrypt/benchmark/make.bat
@@ -1,7 +1,7 @@
REM quick and dirty build file for testing different MSDEVs
setlocal
-set myFLAGS= /I../include /I../../mySTL /c /W3 /G6 /O2
+set myFLAGS= /I../include /I../mySTL /c /W3 /G6 /O2
cl %myFLAGS% benchmark.cpp
diff --git a/extra/yassl/taocrypt/include/aes.hpp b/extra/yassl/taocrypt/include/aes.hpp
index cb70f5c0e7e..5c53fc39411 100644
--- a/extra/yassl/taocrypt/include/aes.hpp
+++ b/extra/yassl/taocrypt/include/aes.hpp
@@ -34,6 +34,12 @@
#include "modes.hpp"
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_AES_ASM
+#endif
+
+
+
namespace TaoCrypt {
@@ -46,15 +52,14 @@ public:
enum { BLOCK_SIZE = AES_BLOCK_SIZE };
AES(CipherDir DIR, Mode MODE)
- : Mode_BASE(BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
+#ifdef DO_AES_ASM
void Process(byte*, const byte*, word32);
+#endif
void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION);
void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); }
private:
- CipherDir dir_;
- Mode mode_;
-
static const word32 rcon_[];
word32 rounds_;
diff --git a/extra/yassl/taocrypt/include/algebra.hpp b/extra/yassl/taocrypt/include/algebra.hpp
index 535ce2599c4..9cfbcf06ece 100644
--- a/extra/yassl/taocrypt/include/algebra.hpp
+++ b/extra/yassl/taocrypt/include/algebra.hpp
@@ -75,7 +75,8 @@ public:
typedef Integer Element;
AbstractRing() : AbstractGroup() {m_mg.m_pRing = this;}
- AbstractRing(const AbstractRing &source) :AbstractGroup() {m_mg.m_pRing = this;}
+ AbstractRing(const AbstractRing &source) : AbstractGroup()
+ {m_mg.m_pRing = this;}
AbstractRing& operator=(const AbstractRing &source) {return *this;}
virtual bool IsUnit(const Element &a) const =0;
diff --git a/extra/yassl/taocrypt/include/arc4.hpp b/extra/yassl/taocrypt/include/arc4.hpp
index 05b0921f5a1..ddd5082f557 100644
--- a/extra/yassl/taocrypt/include/arc4.hpp
+++ b/extra/yassl/taocrypt/include/arc4.hpp
@@ -46,7 +46,6 @@ public:
ARC4() {}
void Process(byte*, const byte*, word32);
- void AsmProcess(byte*, const byte*, word32);
void SetKey(const byte*, word32);
private:
byte x_;
@@ -55,6 +54,8 @@ private:
ARC4(const ARC4&); // hide copy
const ARC4 operator=(const ARC4&); // and assign
+
+ void AsmProcess(byte*, const byte*, word32);
};
} // namespace
diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp
index dbee54be6f1..1151f3c944e 100644
--- a/extra/yassl/taocrypt/include/asn.hpp
+++ b/extra/yassl/taocrypt/include/asn.hpp
@@ -34,7 +34,11 @@
#include "misc.hpp"
#include "block.hpp"
#include "error.hpp"
-#include STL_LIST_FILE
+#ifdef USE_SYS_STL
+ #include <list>
+#else
+ #include "list.hpp"
+#endif
namespace STL = STL_NAMESPACE;
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp
index a931158a83d..0cf27d0b6b5 100644
--- a/extra/yassl/taocrypt/include/block.hpp
+++ b/extra/yassl/taocrypt/include/block.hpp
@@ -34,7 +34,12 @@
#include "misc.hpp"
#include <string.h> // memcpy
#include <stddef.h> // ptrdiff_t
-#include STL_ALGORITHM_FILE
+
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp
index 40953624232..4d6ad1b034b 100644
--- a/extra/yassl/taocrypt/include/blowfish.hpp
+++ b/extra/yassl/taocrypt/include/blowfish.hpp
@@ -32,12 +32,21 @@
#include "misc.hpp"
#include "modes.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_BLOWFISH_ASM
+#endif
+
+
namespace TaoCrypt {
enum { BLOWFISH_BLOCK_SIZE = 8 };
@@ -49,15 +58,14 @@ public:
enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 };
Blowfish(CipherDir DIR, Mode MODE)
- : Mode_BASE(BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
+#ifdef DO_BLOWFISH_ASM
void Process(byte*, const byte*, word32);
+#endif
void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION);
void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); }
private:
- CipherDir dir_;
- Mode mode_;
-
static const word32 p_init_[ROUNDS + 2];
static const word32 s_init_[4 * 256];
diff --git a/extra/yassl/taocrypt/include/des.hpp b/extra/yassl/taocrypt/include/des.hpp
index 48bb1e9119d..19273821f98 100644
--- a/extra/yassl/taocrypt/include/des.hpp
+++ b/extra/yassl/taocrypt/include/des.hpp
@@ -34,6 +34,12 @@
#include "misc.hpp"
#include "modes.hpp"
+
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_DES_ASM
+#endif
+
+
namespace TaoCrypt {
@@ -53,13 +59,9 @@ protected:
class DES : public Mode_BASE, public BasicDES {
public:
DES(CipherDir DIR, Mode MODE)
- : Mode_BASE(DES_BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {}
- void Process(byte*, const byte*, word32);
private:
- CipherDir dir_;
- Mode mode_;
-
void ProcessAndXorBlock(const byte*, const byte*, byte*) const;
DES(const DES&); // hide copy
@@ -71,14 +73,10 @@ private:
class DES_EDE2 : public Mode_BASE {
public:
DES_EDE2(CipherDir DIR, Mode MODE)
- : Mode_BASE(DES_BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {}
void SetKey(const byte*, word32, CipherDir dir);
- void Process(byte*, const byte*, word32);
private:
- CipherDir dir_;
- Mode mode_;
-
BasicDES des1_;
BasicDES des2_;
@@ -94,15 +92,14 @@ private:
class DES_EDE3 : public Mode_BASE {
public:
DES_EDE3(CipherDir DIR, Mode MODE)
- : Mode_BASE(DES_BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {}
void SetKey(const byte*, word32, CipherDir dir);
void SetIV(const byte* iv) { memcpy(r_, iv, DES_BLOCK_SIZE); }
+#ifdef DO_DES_ASM
void Process(byte*, const byte*, word32);
+#endif
private:
- CipherDir dir_;
- Mode mode_;
-
BasicDES des1_;
BasicDES des2_;
BasicDES des3_;
diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp
index 70b4dc79e73..751c79102c4 100644
--- a/extra/yassl/taocrypt/include/integer.hpp
+++ b/extra/yassl/taocrypt/include/integer.hpp
@@ -45,7 +45,11 @@
#include "random.hpp"
#include "file.hpp"
#include <string.h>
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
#ifdef TAOCRYPT_X86ASM_AVAILABLE
@@ -67,7 +71,8 @@
#endif
// SSE2 intrinsics work in GCC 3.3 or later
-#if defined(__SSE2__) && (__GNUC_MAJOR__ > 3 || __GNUC_MINOR__ > 2)
+#if defined(__SSE2__) && (__GNUC__ == 4 || __GNUC_MAJOR__ > 3 || \
+ __GNUC_MINOR__ > 2)
#define SSE2_INTRINSICS_AVAILABLE
#endif
@@ -106,7 +111,6 @@ namespace TaoCrypt {
#endif
};
- template class TAOCRYPT_DLL AlignedAllocator<word>;
typedef Block<word, AlignedAllocator<word> > AlignedWordBlock;
#else
typedef WordBlock AlignedWordBlock;
diff --git a/extra/yassl/taocrypt/include/md5.hpp b/extra/yassl/taocrypt/include/md5.hpp
index 30d14d54fbf..f607a922155 100644
--- a/extra/yassl/taocrypt/include/md5.hpp
+++ b/extra/yassl/taocrypt/include/md5.hpp
@@ -31,6 +31,11 @@
#include "hash.hpp"
+
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_MD5_ASM
+#endif
+
namespace TaoCrypt {
@@ -49,7 +54,9 @@ public:
MD5(const MD5&);
MD5& operator= (const MD5&);
+#ifdef DO_MD5_ASM
void Update(const byte*, word32);
+#endif
void Init();
void Swap(MD5&);
diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp
index 3d2d4c62466..cc20b60d528 100644
--- a/extra/yassl/taocrypt/include/misc.hpp
+++ b/extra/yassl/taocrypt/include/misc.hpp
@@ -151,6 +151,17 @@ void CleanUp();
#endif
+#ifdef TAOCRYPT_X86ASM_AVAILABLE
+ bool HaveCpuId();
+ bool IsPentium();
+ void CpuId(word32 input, word32 *output);
+
+ extern bool isMMX;
+#endif
+
+
+
+
// Turn on ia32 ASM for Ciphers and Message Digests
// Seperate define since these are more complex, use member offsets
// and user may want to turn off while leaving Big Integer optos on
@@ -200,17 +211,9 @@ void CleanUp();
#ifdef USE_SYS_STL
// use system STL
- #define STL_VECTOR_FILE <vector>
- #define STL_LIST_FILE <list>
- #define STL_ALGORITHM_FILE <algorithm>
- #define STL_MEMORY_FILE <memory>
#define STL_NAMESPACE std
#else
// use mySTL
- #define STL_VECTOR_FILE "vector.hpp"
- #define STL_LIST_FILE "list.hpp"
- #define STL_ALGORITHM_FILE "algorithm.hpp"
- #define STL_MEMORY_FILE "memory.hpp"
#define STL_NAMESPACE mySTL
#endif
diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp
index 65b7318661e..d77f855385c 100644
--- a/extra/yassl/taocrypt/include/modes.hpp
+++ b/extra/yassl/taocrypt/include/modes.hpp
@@ -38,6 +38,7 @@ namespace TaoCrypt {
enum Mode { ECB, CBC };
+
// BlockCipher abstraction
template<CipherDir DIR, class T, Mode MODE>
class BlockCipher {
@@ -63,14 +64,16 @@ class Mode_BASE : public virtual_base {
public:
enum { MaxBlockSz = 16 };
- explicit Mode_BASE(int sz)
+ explicit Mode_BASE(int sz, CipherDir dir, Mode mode)
: blockSz_(sz), reg_(reinterpret_cast<byte*>(r_)),
- tmp_(reinterpret_cast<byte*>(t_))
+ tmp_(reinterpret_cast<byte*>(t_)), dir_(dir), mode_(mode)
{
assert(sz <= MaxBlockSz);
}
virtual ~Mode_BASE() {}
+ virtual void Process(byte*, const byte*, word32);
+
void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); }
protected:
int blockSz_;
@@ -80,6 +83,9 @@ protected:
word32 r_[MaxBlockSz / sizeof(word32)]; // align reg_ on word32
word32 t_[MaxBlockSz / sizeof(word32)]; // align tmp_ on word32
+ CipherDir dir_;
+ Mode mode_;
+
void ECB_Process(byte*, const byte*, word32);
void CBC_Encrypt(byte*, const byte*, word32);
void CBC_Decrypt(byte*, const byte*, word32);
@@ -92,6 +98,18 @@ private:
};
+inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz)
+{
+ if (mode_ == ECB)
+ ECB_Process(out, in, sz);
+ else if (mode_ == CBC)
+ if (dir_ == ENCRYPTION)
+ CBC_Encrypt(out, in, sz);
+ else
+ CBC_Decrypt(out, in, sz);
+}
+
+
// ECB Process blocks
inline void Mode_BASE::ECB_Process(byte* out, const byte* in, word32 sz)
{
diff --git a/extra/yassl/taocrypt/include/ripemd.hpp b/extra/yassl/taocrypt/include/ripemd.hpp
index 2e594b7604d..5d443769662 100644
--- a/extra/yassl/taocrypt/include/ripemd.hpp
+++ b/extra/yassl/taocrypt/include/ripemd.hpp
@@ -31,6 +31,11 @@
#include "hash.hpp"
+
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_RIPEMD_ASM
+#endif
+
namespace TaoCrypt {
@@ -49,7 +54,9 @@ public:
RIPEMD160(const RIPEMD160&);
RIPEMD160& operator= (const RIPEMD160&);
+#ifdef DO_RIPEMD_ASM
void Update(const byte*, word32);
+#endif
void Init();
void Swap(RIPEMD160&);
private:
diff --git a/extra/yassl/taocrypt/include/rsa.hpp b/extra/yassl/taocrypt/include/rsa.hpp
index 1b531b9d0c0..c33e21b76a3 100644
--- a/extra/yassl/taocrypt/include/rsa.hpp
+++ b/extra/yassl/taocrypt/include/rsa.hpp
@@ -239,7 +239,8 @@ bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig)
{
ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
- SSL_Decrypt(key_, sig, plain.get_buffer());
+ if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
+ return false; // not right justified or bad padding
if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
return true;
diff --git a/extra/yassl/taocrypt/include/sha.hpp b/extra/yassl/taocrypt/include/sha.hpp
index 2d65932dc17..510c516b1a4 100644
--- a/extra/yassl/taocrypt/include/sha.hpp
+++ b/extra/yassl/taocrypt/include/sha.hpp
@@ -31,6 +31,11 @@
#include "hash.hpp"
+
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_SHA_ASM
+#endif
+
namespace TaoCrypt {
@@ -46,7 +51,9 @@ public:
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
+#ifdef DO_SHA_ASM
void Update(const byte* data, word32 len);
+#endif
void Init();
SHA(const SHA&);
diff --git a/extra/yassl/taocrypt/include/twofish.hpp b/extra/yassl/taocrypt/include/twofish.hpp
index ba144d2defb..8cad4923262 100644
--- a/extra/yassl/taocrypt/include/twofish.hpp
+++ b/extra/yassl/taocrypt/include/twofish.hpp
@@ -32,12 +32,20 @@
#include "misc.hpp"
#include "modes.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
+#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
+ #define DO_TWOFISH_ASM
+#endif
+
namespace TaoCrypt {
enum { TWOFISH_BLOCK_SIZE = 16 };
@@ -49,15 +57,14 @@ public:
enum { BLOCK_SIZE = TWOFISH_BLOCK_SIZE };
Twofish(CipherDir DIR, Mode MODE)
- : Mode_BASE(BLOCK_SIZE), dir_(DIR), mode_(MODE) {}
+ : Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
+#ifdef DO_TWOFISH_ASM
void Process(byte*, const byte*, word32);
+#endif
void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION);
void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); }
private:
- CipherDir dir_;
- Mode mode_;
-
static const byte q_[2][256];
static const word32 mds_[4][256];
diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp
index 574a88a736c..2940f06c074 100644
--- a/extra/yassl/taocrypt/src/aes.cpp
+++ b/extra/yassl/taocrypt/src/aes.cpp
@@ -34,33 +34,19 @@
#include "aes.hpp"
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_AES_ASM
-#endif
-
-
namespace TaoCrypt {
-#if !defined(DO_AES_ASM)
-
-// Generic Version
-void AES::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
-#else
+#if defined(DO_AES_ASM)
// ia32 optimized version
void AES::Process(byte* out, const byte* in, word32 sz)
{
+ if (!isMMX) {
+ Mode_BASE::Process(out, in, sz);
+ return;
+ }
+
word32 blocks = sz / BLOCK_SIZE;
if (mode_ == ECB)
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index 375cd6cd524..76c4e99323d 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -29,7 +29,11 @@
#include "runtime.hpp"
#include "algebra.hpp"
-#include STL_VECTOR_FILE
+#ifdef USE_SYS_STL
+ #include <vector>
+#else
+ #include "vector.hpp"
+#endif
namespace STL = STL_NAMESPACE;
diff --git a/extra/yassl/taocrypt/src/arc4.cpp b/extra/yassl/taocrypt/src/arc4.cpp
index ea1e084014c..90b5170c59e 100644
--- a/extra/yassl/taocrypt/src/arc4.cpp
+++ b/extra/yassl/taocrypt/src/arc4.cpp
@@ -80,12 +80,18 @@ inline unsigned int MakeByte(word32& x, word32& y, byte* s)
} // namespace
-#ifndef DO_ARC4_ASM
void ARC4::Process(byte* out, const byte* in, word32 length)
{
if (length == 0) return;
+#ifdef DO_ARC4_ASM
+ if (isMMX) {
+ AsmProcess(out, in, length);
+ return;
+ }
+#endif
+
byte *const s = state_;
word32 x = x_;
word32 y = y_;
@@ -100,13 +106,16 @@ void ARC4::Process(byte* out, const byte* in, word32 length)
y_ = y;
}
-#else // DO_ARC4_ASM
+#ifdef DO_ARC4_ASM
+
#ifdef _MSC_VER
__declspec(naked)
+#else
+ __attribute__ ((noinline))
#endif
-void ARC4::Process(byte* out, const byte* in, word32 length)
+void ARC4::AsmProcess(byte* out, const byte* in, word32 length)
{
#ifdef __GNUC__
#define AS1(x) asm(#x);
diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp
index 40ae1a17e6c..d736292fb19 100644
--- a/extra/yassl/taocrypt/src/blowfish.cpp
+++ b/extra/yassl/taocrypt/src/blowfish.cpp
@@ -37,34 +37,21 @@
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_BLOWFISH_ASM
-#endif
-
namespace TaoCrypt {
-#if !defined(DO_BLOWFISH_ASM)
-
-// Generic Version
-void Blowfish::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
-#else
+#if defined(DO_BLOWFISH_ASM)
// ia32 optimized version
void Blowfish::Process(byte* out, const byte* in, word32 sz)
{
+ if (!isMMX) {
+ Mode_BASE::Process(out, in, sz);
+ return;
+ }
+
word32 blocks = sz / BLOCK_SIZE;
if (mode_ == ECB)
diff --git a/extra/yassl/taocrypt/src/des.cpp b/extra/yassl/taocrypt/src/des.cpp
index 2628e142bae..94428ac587e 100644
--- a/extra/yassl/taocrypt/src/des.cpp
+++ b/extra/yassl/taocrypt/src/des.cpp
@@ -34,16 +34,16 @@
#include "runtime.hpp"
#include "des.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_DES_ASM
-#endif
-
namespace TaoCrypt {
@@ -357,18 +357,6 @@ void BasicDES::RawProcessBlock(word32& lIn, word32& rIn) const
}
-void DES::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
-
typedef BlockGetAndPut<word32, BigEndian> Block;
@@ -386,17 +374,6 @@ void DES::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) const
}
-void DES_EDE2::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
void DES_EDE2::SetKey(const byte* key, word32 sz, CipherDir dir)
{
des1_.SetKey(key, sz, dir);
@@ -429,25 +406,16 @@ void DES_EDE3::SetKey(const byte* key, word32 sz, CipherDir dir)
-#if !defined(DO_DES_ASM)
-
-// Generic Version
-void DES_EDE3::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
-#else
+#if defined(DO_DES_ASM)
// ia32 optimized version
void DES_EDE3::Process(byte* out, const byte* in, word32 sz)
{
+ if (!isMMX) {
+ Mode_BASE::Process(out, in, sz);
+ return;
+ }
+
word32 blocks = sz / DES_BLOCK_SIZE;
if (mode_ == CBC)
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index 500160cfe37..1ed69ce34dc 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -55,12 +55,15 @@ extern "C" word myUMULH(word, word);
#pragma intrinsic (myUMULH)
#endif
+#ifdef __GNUC__
+ #include <signal.h>
+ #include <setjmp.h>
+#endif
+
#ifdef SSE2_INTRINSICS_AVAILABLE
#ifdef __GNUC__
#include <xmmintrin.h>
- #include <signal.h>
- #include <setjmp.h>
#ifdef TAOCRYPT_MEMALIGN_AVAILABLE
#include <malloc.h>
#else
@@ -1015,44 +1018,20 @@ void Portable::Multiply8Bottom(word *R, const word *A, const word *B)
// ************** x86 feature detection ***************
-static bool s_sse2Enabled = true;
-
-static void CpuId(word32 input, word32 *output)
-{
-#ifdef __GNUC__
- __asm__
- (
- // save ebx in case -fPIC is being used
- "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx"
- : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d"(output[3])
- : "a" (input)
- );
-#else
- __asm
- {
- mov eax, input
- cpuid
- mov edi, output
- mov [edi], eax
- mov [edi+4], ebx
- mov [edi+8], ecx
- mov [edi+12], edx
- }
-#endif
-}
#ifdef SSE2_INTRINSICS_AVAILABLE
+
#ifndef _MSC_VER
-static jmp_buf s_env;
-static void SigIllHandler(int)
-{
+ static jmp_buf s_env;
+ static void SigIllHandler(int)
+ {
longjmp(s_env, 1);
-}
+ }
#endif
static bool HasSSE2()
{
- if (!s_sse2Enabled)
+ if (!IsPentium())
return false;
word32 cpuid[4];
@@ -1081,23 +1060,22 @@ static bool HasSSE2()
if (setjmp(s_env))
result = false;
else
- __asm __volatile ("xorps %xmm0, %xmm0");
+ __asm __volatile ("xorpd %xmm0, %xmm0");
signal(SIGILL, oldHandler);
return result;
#endif
}
-#endif
+#endif // SSE2_INTRINSICS_AVAILABLE
+
static bool IsP4()
{
- word32 cpuid[4];
-
- CpuId(0, cpuid);
- STL::swap(cpuid[2], cpuid[3]);
- if (memcmp(cpuid+1, "GenuineIntel", 12) != 0)
+ if (!IsPentium())
return false;
+ word32 cpuid[4];
+
CpuId(1, cpuid);
return ((cpuid[0] >> 8) & 0xf) == 0xf;
}
@@ -1147,7 +1125,12 @@ static PMul s_pMul4, s_pMul8, s_pMul8B;
static void SetPentiumFunctionPointers()
{
- if (IsP4())
+ if (!IsPentium())
+ {
+ s_pAdd = &Portable::Add;
+ s_pSub = &Portable::Subtract;
+ }
+ else if (IsP4())
{
s_pAdd = &P4Optimized::Add;
s_pSub = &P4Optimized::Subtract;
@@ -1159,7 +1142,13 @@ static void SetPentiumFunctionPointers()
}
#ifdef SSE2_INTRINSICS_AVAILABLE
- if (HasSSE2())
+ if (!IsPentium())
+ {
+ s_pMul4 = &Portable::Multiply4;
+ s_pMul8 = &Portable::Multiply8;
+ s_pMul8B = &Portable::Multiply8Bottom;
+ }
+ else if (HasSSE2())
{
s_pMul4 = &P4Optimized::Multiply4;
s_pMul8 = &P4Optimized::Multiply8;
@@ -1177,11 +1166,6 @@ static void SetPentiumFunctionPointers()
static const char s_RunAtStartupSetPentiumFunctionPointers =
(SetPentiumFunctionPointers(), 0);
-void DisableSSE2()
-{
- s_sse2Enabled = false;
- SetPentiumFunctionPointers();
-}
class LowLevel : public PentiumOptimized
{
@@ -3984,6 +3968,9 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq,
template hword DivideThreeWordsByTwo<hword, Word>(hword*, hword, hword, Word*);
#endif
template word DivideThreeWordsByTwo<word, DWord>(word*, word, word, DWord*);
+#ifdef SSE2_INTRINSICS_AVAILABLE
+template class AlignedAllocator<word>;
+#endif
#endif
diff --git a/extra/yassl/taocrypt/src/make.bat b/extra/yassl/taocrypt/src/make.bat
index ecf7e8f8469..0aa1350f7d8 100644
--- a/extra/yassl/taocrypt/src/make.bat
+++ b/extra/yassl/taocrypt/src/make.bat
@@ -1,7 +1,7 @@
REM quick and dirty build file for testing different MSDEVs
setlocal
-set myFLAGS= /I../include /I../../mySTL /c /W3 /G6 /O2
+set myFLAGS= /I../include /I../mySTL /c /W3 /G6 /O2
cl %myFLAGS% aes.cpp
cl %myFLAGS% aestables.cpp
@@ -21,6 +21,7 @@ cl %myFLAGS% file.cpp
cl %myFLAGS% hash.cpp
cl %myFLAGS% integer.cpp
cl %myFLAGS% md2.cpp
+cl %myFLAGS% md4.cpp
cl %myFLAGS% md5.cpp
cl %myFLAGS% misc.cpp
@@ -33,5 +34,5 @@ cl %myFLAGS% template_instnt.cpp
cl %myFLAGS% tftables.cpp
cl %myFLAGS% twofish.cpp
-link.exe -lib /out:taocrypt.lib aes.obj aestables.obj algebra.obj arc4.obj asn.obj bftables.obj blowfish.obj coding.obj des.obj dh.obj dsa.obj file.obj hash.obj integer.obj md2.obj md5.obj misc.obj random.obj ripemd.obj rsa.obj sha.obj template_instnt.obj tftables.obj twofish.obj
+link.exe -lib /out:taocrypt.lib aes.obj aestables.obj algebra.obj arc4.obj asn.obj bftables.obj blowfish.obj coding.obj des.obj dh.obj dsa.obj file.obj hash.obj integer.obj md2.obj md4.obj md5.obj misc.obj random.obj ripemd.obj rsa.obj sha.obj template_instnt.obj tftables.obj twofish.obj
diff --git a/extra/yassl/taocrypt/src/md4.cpp b/extra/yassl/taocrypt/src/md4.cpp
index 0dee8bf40cb..1efda04fbb8 100644
--- a/extra/yassl/taocrypt/src/md4.cpp
+++ b/extra/yassl/taocrypt/src/md4.cpp
@@ -28,7 +28,11 @@
#include "runtime.hpp"
#include "md4.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
diff --git a/extra/yassl/taocrypt/src/md5.cpp b/extra/yassl/taocrypt/src/md5.cpp
index 2bddc7fe308..bf485d11b95 100644
--- a/extra/yassl/taocrypt/src/md5.cpp
+++ b/extra/yassl/taocrypt/src/md5.cpp
@@ -28,15 +28,16 @@
#include "runtime.hpp"
#include "md5.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_MD5_ASM
-#endif
namespace TaoCrypt {
@@ -84,10 +85,17 @@ void MD5::Swap(MD5& other)
}
-// Update digest with data of size len, do in blocks
+#ifdef DO_MD5_ASM
+
+// Update digest with data of size len
void MD5::Update(const byte* data, word32 len)
{
- byte* local = (byte*)buffer_;
+ if (!isMMX) {
+ HASHwithTransform::Update(data, len);
+ return;
+ }
+
+ byte* local = reinterpret_cast<byte*>(buffer_);
// remove buffered data if possible
if (buffLen_) {
@@ -99,27 +107,14 @@ void MD5::Update(const byte* data, word32 len)
len -= add;
if (buffLen_ == BLOCK_SIZE) {
- ByteReverseIf(local, local, BLOCK_SIZE, LittleEndianOrder);
Transform();
AddLength(BLOCK_SIZE);
buffLen_ = 0;
}
}
- // do block size transforms or all at once for asm
+ // at once for asm
if (buffLen_ == 0) {
- #ifndef DO_MD5_ASM
- while (len >= BLOCK_SIZE) {
- memcpy(&local[0], data, BLOCK_SIZE);
-
- data += BLOCK_SIZE;
- len -= BLOCK_SIZE;
-
- ByteReverseIf(local, local, BLOCK_SIZE, LittleEndianOrder);
- Transform();
- AddLength(BLOCK_SIZE);
- }
- #else
word32 times = len / BLOCK_SIZE;
if (times) {
AsmTransform(data, times);
@@ -128,7 +123,6 @@ void MD5::Update(const byte* data, word32 len)
len -= add;
data += add;
}
- #endif
}
// cache any data left
@@ -139,7 +133,6 @@ void MD5::Update(const byte* data, word32 len)
}
-#ifdef DO_MD5_ASM
/*
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp
index 084a263a4ae..7ab05582e95 100644
--- a/extra/yassl/taocrypt/src/misc.cpp
+++ b/extra/yassl/taocrypt/src/misc.cpp
@@ -30,6 +30,20 @@
#include "misc.hpp"
+#ifdef __GNUC__
+ #include <signal.h>
+ #include <setjmp.h>
+#endif
+
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
+
+namespace STL = STL_NAMESPACE;
+
+
#ifdef YASSL_PURE_C
void* operator new(size_t sz, TaoCrypt::new_t)
@@ -156,5 +170,129 @@ unsigned long Crop(unsigned long value, unsigned int size)
}
+
+#ifdef TAOCRYPT_X86ASM_AVAILABLE
+
+#ifndef _MSC_VER
+ static jmp_buf s_env;
+ static void SigIllHandler(int)
+ {
+ longjmp(s_env, 1);
+ }
+#endif
+
+
+bool HaveCpuId()
+{
+#ifdef _MSC_VER
+ __try
+ {
+ __asm
+ {
+ mov eax, 0
+ cpuid
+ }
+ }
+ __except (1)
+ {
+ return false;
+ }
+ return true;
+#else
+ typedef void (*SigHandler)(int);
+
+ SigHandler oldHandler = signal(SIGILL, SigIllHandler);
+ if (oldHandler == SIG_ERR)
+ return false;
+
+ bool result = true;
+ if (setjmp(s_env))
+ result = false;
+ else
+ __asm__ __volatile
+ (
+ // save ebx in case -fPIC is being used
+ "push %%ebx; mov $0, %%eax; cpuid; pop %%ebx"
+ :
+ :
+ : "%eax", "%ecx", "%edx"
+ );
+
+ signal(SIGILL, oldHandler);
+ return result;
+#endif
+}
+
+
+void CpuId(word32 input, word32 *output)
+{
+#ifdef __GNUC__
+ __asm__
+ (
+ // save ebx in case -fPIC is being used
+ "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx"
+ : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d"(output[3])
+ : "a" (input)
+ );
+#else
+ __asm
+ {
+ mov eax, input
+ cpuid
+ mov edi, output
+ mov [edi], eax
+ mov [edi+4], ebx
+ mov [edi+8], ecx
+ mov [edi+12], edx
+ }
+#endif
+}
+
+
+bool IsPentium()
+{
+ if (!HaveCpuId())
+ return false;
+
+ word32 cpuid[4];
+
+ CpuId(0, cpuid);
+ STL::swap(cpuid[2], cpuid[3]);
+ if (memcmp(cpuid+1, "GenuineIntel", 12) != 0)
+ return false;
+
+ CpuId(1, cpuid);
+ byte family = ((cpuid[0] >> 8) & 0xf);
+ if (family < 5)
+ return false;
+
+ return true;
+}
+
+
+
+static bool IsMmx()
+{
+ if (!IsPentium())
+ return false;
+
+ word32 cpuid[4];
+
+ CpuId(1, cpuid);
+ if ((cpuid[3] & (1 << 23)) == 0)
+ return false;
+
+ return true;
+}
+
+
+bool isMMX = IsMmx();
+
+
+#endif // TAOCRYPT_X86ASM_AVAILABLE
+
+
+
+
} // namespace
diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp
index c7bb6ae9549..3fab1ddba23 100644
--- a/extra/yassl/taocrypt/src/random.cpp
+++ b/extra/yassl/taocrypt/src/random.cpp
@@ -50,8 +50,11 @@ namespace TaoCrypt {
RandomNumberGenerator::RandomNumberGenerator()
{
byte key[32];
+ byte junk[256];
+
seed_.GenerateSeed(key, sizeof(key));
cipher_.SetKey(key, sizeof(key));
+ GenerateBlock(junk, sizeof(junk)); // rid initial state
}
diff --git a/extra/yassl/taocrypt/src/ripemd.cpp b/extra/yassl/taocrypt/src/ripemd.cpp
index 03c09edde84..98bfe4b2645 100644
--- a/extra/yassl/taocrypt/src/ripemd.cpp
+++ b/extra/yassl/taocrypt/src/ripemd.cpp
@@ -28,15 +28,16 @@
#include "runtime.hpp"
#include "ripemd.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_RIPEMD_ASM
-#endif
namespace TaoCrypt {
@@ -86,10 +87,17 @@ void RIPEMD160::Swap(RIPEMD160& other)
}
-// Update digest with data of size len, do in blocks
+#ifdef DO_RIPEMD_ASM
+
+// Update digest with data of size len
void RIPEMD160::Update(const byte* data, word32 len)
{
- byte* local = (byte*)buffer_;
+ if (!isMMX) {
+ HASHwithTransform::Update(data, len);
+ return;
+ }
+
+ byte* local = reinterpret_cast<byte*>(buffer_);
// remove buffered data if possible
if (buffLen_) {
@@ -101,27 +109,14 @@ void RIPEMD160::Update(const byte* data, word32 len)
len -= add;
if (buffLen_ == BLOCK_SIZE) {
- ByteReverseIf(local, local, BLOCK_SIZE, LittleEndianOrder);
Transform();
AddLength(BLOCK_SIZE);
buffLen_ = 0;
}
}
- // do block size transforms or all at once for asm
+ // all at once for asm
if (buffLen_ == 0) {
- #ifndef DO_RIPEMD_ASM
- while (len >= BLOCK_SIZE) {
- memcpy(&local[0], data, BLOCK_SIZE);
-
- data += BLOCK_SIZE;
- len -= BLOCK_SIZE;
-
- ByteReverseIf(local, local, BLOCK_SIZE, LittleEndianOrder);
- Transform();
- AddLength(BLOCK_SIZE);
- }
- #else
word32 times = len / BLOCK_SIZE;
if (times) {
AsmTransform(data, times);
@@ -130,7 +125,6 @@ void RIPEMD160::Update(const byte* data, word32 len)
len -= add;
data += add;
}
- #endif
}
// cache any data left
@@ -140,6 +134,8 @@ void RIPEMD160::Update(const byte* data, word32 len)
}
}
+#endif // DO_RIPEMD_ASM
+
// for all
#define F(x, y, z) (x ^ y ^ z)
diff --git a/extra/yassl/taocrypt/src/sha.cpp b/extra/yassl/taocrypt/src/sha.cpp
index 280d42fb3d4..b1273d9da8f 100644
--- a/extra/yassl/taocrypt/src/sha.cpp
+++ b/extra/yassl/taocrypt/src/sha.cpp
@@ -28,16 +28,16 @@
#include "runtime.hpp"
#include <string.h>
#include "sha.hpp"
-#include STL_ALGORITHM_FILE
+#ifdef USE_SYS_STL
+ #include <algorithm>
+#else
+ #include "algorithm.hpp"
+#endif
namespace STL = STL_NAMESPACE;
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_SHA_ASM
-#endif
-
namespace TaoCrypt {
@@ -108,10 +108,18 @@ void SHA::Swap(SHA& other)
}
-// Update digest with data of size len, do in blocks
+
+#ifdef DO_SHA_ASM
+
+// Update digest with data of size len
void SHA::Update(const byte* data, word32 len)
{
- byte* local = (byte*)buffer_;
+ if (!isMMX) {
+ HASHwithTransform::Update(data, len);
+ return;
+ }
+
+ byte* local = reinterpret_cast<byte*>(buffer_);
// remove buffered data if possible
if (buffLen_) {
@@ -123,27 +131,15 @@ void SHA::Update(const byte* data, word32 len)
len -= add;
if (buffLen_ == BLOCK_SIZE) {
- ByteReverseIf(local, local, BLOCK_SIZE, BigEndianOrder);
+ ByteReverse(local, local, BLOCK_SIZE);
Transform();
AddLength(BLOCK_SIZE);
buffLen_ = 0;
}
}
- // do block size transforms or all at once for asm
+ // all at once for asm
if (buffLen_ == 0) {
- #ifndef DO_SHA_ASM
- while (len >= BLOCK_SIZE) {
- memcpy(&local[0], data, BLOCK_SIZE);
-
- data += BLOCK_SIZE;
- len -= BLOCK_SIZE;
-
- ByteReverseIf(local, local, BLOCK_SIZE, BigEndianOrder);
- Transform();
- AddLength(BLOCK_SIZE);
- }
- #else
word32 times = len / BLOCK_SIZE;
if (times) {
AsmTransform(data, times);
@@ -152,7 +148,6 @@ void SHA::Update(const byte* data, word32 len)
len -= add;
data += add;
}
- #endif
}
// cache any data left
@@ -162,6 +157,8 @@ void SHA::Update(const byte* data, word32 len)
}
}
+#endif // DO_SHA_ASM
+
void SHA::Transform()
{
diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp
index a16a8f0d169..bb385331519 100644
--- a/extra/yassl/taocrypt/src/twofish.cpp
+++ b/extra/yassl/taocrypt/src/twofish.cpp
@@ -35,33 +35,20 @@
#include "twofish.hpp"
-#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
- #define DO_TWOFISH_ASM
-#endif
-
namespace TaoCrypt {
-#if !defined(DO_TWOFISH_ASM)
-
-// Generic Version
-void Twofish::Process(byte* out, const byte* in, word32 sz)
-{
- if (mode_ == ECB)
- ECB_Process(out, in, sz);
- else if (mode_ == CBC)
- if (dir_ == ENCRYPTION)
- CBC_Encrypt(out, in, sz);
- else
- CBC_Decrypt(out, in, sz);
-}
-
-#else
+#if defined(DO_TWOFISH_ASM)
// ia32 optimized version
void Twofish::Process(byte* out, const byte* in, word32 sz)
{
+ if (!isMMX) {
+ Mode_BASE::Process(out, in, sz);
+ return;
+ }
+
word32 blocks = sz / BLOCK_SIZE;
if (mode_ == ECB)
diff --git a/extra/yassl/taocrypt/test/make.bat b/extra/yassl/taocrypt/test/make.bat
index 5f01db68d0d..7b53e9abc90 100644
--- a/extra/yassl/taocrypt/test/make.bat
+++ b/extra/yassl/taocrypt/test/make.bat
@@ -1,7 +1,7 @@
REM quick and dirty build file for testing different MSDEVs
setlocal
-set myFLAGS= /I../include /I../../mySTL /c /W3 /G6 /O2
+set myFLAGS= /I../include /I../mySTL /c /W3 /G6 /O2
cl %myFLAGS% test.cpp
diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp
index 28ef73dfac8..9e3ef709a78 100644
--- a/extra/yassl/taocrypt/test/test.cpp
+++ b/extra/yassl/taocrypt/test/test.cpp
@@ -247,6 +247,8 @@ void taocrypt_test(void* args)
args.argv = argv;
taocrypt_test(&args);
+ TaoCrypt::CleanUp();
+
return args.return_code;
}
diff --git a/extra/yassl/testsuite/make.bat b/extra/yassl/testsuite/make.bat
index 1bc7ce0513d..ea2677db481 100644
--- a/extra/yassl/testsuite/make.bat
+++ b/extra/yassl/testsuite/make.bat
@@ -1,7 +1,7 @@
REM quick and dirty build file for testing different MSDEVs
setlocal
-set myFLAGS= /I../include /I../taocrypt/include /I../mySTL /c /W3 /G6 /O2 /MT /D"WIN32" /D"NO_MAIN_DRIVER"
+set myFLAGS= /I../include /I../taocrypt/include /I../taocrypt/mySTL /c /W3 /G6 /O2 /MT /D"WIN32" /D"NO_MAIN_DRIVER"
cl %myFLAGS% testsuite.cpp
cl %myFLAGS% ../examples/client/client.cpp
diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp
index b23b36f0ba2..b2fed37f4e5 100644
--- a/extra/yassl/testsuite/test.hpp
+++ b/extra/yassl/testsuite/test.hpp
@@ -9,6 +9,8 @@
#include <stdlib.h>
#include <assert.h>
+//#define NON_BLOCKING // test server and client example (not echos)
+
#ifdef _WIN32
#include <winsock2.h>
#include <process.h>
@@ -23,16 +25,17 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <pthread.h>
+#ifdef NON_BLOCKING
+ #include <fcntl.h>
+#endif
#define SOCKET_T int
#endif /* _WIN32 */
-#if !defined(_SOCKLEN_T) && defined(_WIN32)
+#if !defined(_SOCKLEN_T) && \
+ (defined(_WIN32) || defined(__NETWARE__) || defined(__APPLE__))
typedef int socklen_t;
#endif
-#if !defined(_SOCKLEN_T) && defined(__NETWARE__)
- typedef size_t socklen_t;
-#endif
// Check type of third arg to accept
@@ -262,6 +265,20 @@ inline void set_args(int& argc, char**& argv, func_args& args)
}
+inline void tcp_set_nonblocking(SOCKET_T& sockfd)
+{
+#ifdef NON_BLOCKING
+ #ifdef _WIN32
+ unsigned long blocking = 1;
+ int ret = ioctlsocket(sockfd, FIONBIO, &blocking);
+ #else
+ int flags = fcntl(sockfd, F_GETFL, 0);
+ int ret = fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
+ #endif
+#endif
+}
+
+
inline void tcp_socket(SOCKET_T& sockfd, sockaddr_in& addr)
{
sockfd = socket(AF_INET, SOCK_STREAM, 0);
@@ -289,8 +306,7 @@ inline void tcp_connect(SOCKET_T& sockfd)
sockaddr_in addr;
tcp_socket(sockfd, addr);
- if (connect(sockfd, (const sockaddr*)&addr, sizeof(addr)) != 0)
- {
+ if (connect(sockfd, (const sockaddr*)&addr, sizeof(addr)) != 0) {
tcp_close(sockfd);
err_sys("tcp connect failed");
}
@@ -302,19 +318,18 @@ inline void tcp_listen(SOCKET_T& sockfd)
sockaddr_in addr;
tcp_socket(sockfd, addr);
- if (bind(sockfd, (const sockaddr*)&addr, sizeof(addr)) != 0)
- {
+ if (bind(sockfd, (const sockaddr*)&addr, sizeof(addr)) != 0) {
tcp_close(sockfd);
err_sys("tcp bind failed");
}
- if (listen(sockfd, 3) != 0)
- {
+ if (listen(sockfd, 3) != 0) {
tcp_close(sockfd);
err_sys("tcp listen failed");
}
}
+
inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
{
tcp_listen(sockfd);
@@ -333,11 +348,14 @@ inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
clientfd = accept(sockfd, (sockaddr*)&client, (ACCEPT_THIRD_T)&client_len);
- if (clientfd == -1)
- {
+ if (clientfd == -1) {
tcp_close(sockfd);
err_sys("tcp accept failed");
}
+
+#ifdef NON_BLOCKING
+ tcp_set_nonblocking(clientfd);
+#endif
}
@@ -363,25 +381,30 @@ inline void showPeer(SSL* ssl)
inline DH* set_tmpDH(SSL_CTX* ctx)
{
- static unsigned char dh512_p[] =
+ static unsigned char dh1024_p[] =
{
- 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
- 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
- 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3,
- 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
- 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C,
- 0x47,0x74,0xE8,0x33,
+ 0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
+ 0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
+ 0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59,
+ 0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2,
+ 0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD,
+ 0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF,
+ 0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02,
+ 0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C,
+ 0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7,
+ 0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50,
+ 0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B,
};
- static unsigned char dh512_g[] =
+ static unsigned char dh1024_g[] =
{
0x02,
};
DH* dh;
if ( (dh = DH_new()) ) {
- dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), 0);
- dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), 0);
+ dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
+ dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
}
if (!dh->p || !dh->g) {
DH_free(dh);
diff --git a/include/Makefile.am b/include/Makefile.am
index 8a4799149d0..aa20cf892c1 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -67,6 +67,7 @@ abi_check: $(HEADERS_ABI) mysql_version.h mysql_h.ic
if [ @ICHECK@ != no ] ; then \
@ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
@ICHECK@ --compare mysql_h.ic $@.ic; \
+ $(RM) -f $@.ic; \
fi; \
touch abi_check;
diff --git a/include/abi_check.ic b/include/abi_check.ic
deleted file mode 100644
index 30ef44a1ccb..00000000000
--- a/include/abi_check.ic
+++ /dev/null
@@ -1,914 +0,0 @@
-struct rand_struct;
-struct st_list;
-struct st_mem_root;
-struct st_mysql;
-struct st_mysql_bind;
-struct st_mysql_data;
-struct st_mysql_field;
-struct st_mysql_manager;
-struct st_mysql_methods;
-struct st_mysql_options;
-struct st_mysql_parameters;
-struct st_mysql_res;
-struct st_mysql_rows;
-struct st_mysql_stmt;
-struct st_mysql_time;
-struct st_net;
-struct st_typelib;
-struct st_udf_args;
-struct st_udf_init;
-struct st_used_mem;
-enum Item_result;
-enum enum_field_types;
-enum enum_mysql_set_option;
-enum enum_mysql_stmt_state;
-enum enum_mysql_timestamp_type;
-enum enum_server_command;
-enum enum_stmt_attr_type;
-enum mysql_enum_shutdown_level;
-enum mysql_option;
-enum mysql_protocol_type;
-enum mysql_rpl_type;
-enum mysql_status;
-# 131 "mysql.h"
-typedef struct st_mysql_rows MYSQL_ROWS;
-# 24 "my_list.h"
-typedef struct st_list LIST;
-# 232 "mysql.h"
-typedef struct st_mysql MYSQL;
-# 571 "mysql.h"
-typedef struct st_mysql_bind MYSQL_BIND;
-# 93 "mysql.h"
-typedef struct st_mysql_field MYSQL_FIELD;
-# 117 "mysql.h"
-typedef unsigned int MYSQL_FIELD_OFFSET;
-# 323 "mysql.h"
-typedef struct st_mysql_manager MYSQL_MANAGER;
-# 337 "mysql.h"
-typedef struct st_mysql_parameters MYSQL_PARAMETERS;
-# 292 "mysql.h"
-typedef struct st_mysql_res MYSQL_RES;
-# 116 "mysql.h"
-typedef char * * MYSQL_ROW;
-# 137 "mysql.h"
-typedef MYSQL_ROWS * MYSQL_ROW_OFFSET;
-# 596 "mysql.h"
-typedef struct st_mysql_stmt MYSQL_STMT;
-# 151 "mysql_com.h"
-typedef struct st_net NET;
-# 21 "typelib.h"
-typedef struct st_typelib TYPELIB;
-# 141 "mysql_com.h"
-typedef struct st_vio Vio;
-# 57 "mysql.h"
-typedef char * gptr;
-# 29 "my_list.h"
-typedef int (* list_walk_action)(void *, void *);
-# 48 "mysql.h"
-typedef char my_bool;
-# 63 "mysql.h"
-typedef int my_socket;
-# 125 "mysql.h"
-typedef unsigned long long int my_ulonglong;
-# 35 "my_alloc.h"
-typedef struct st_mem_root MEM_ROOT;
-# 141 "mysql.h"
-typedef struct st_mysql_data MYSQL_DATA;
-# 648 "mysql.h"
-typedef struct st_mysql_methods MYSQL_METHODS;
-# 48 "mysql_time.h"
-typedef struct st_mysql_time MYSQL_TIME;
-# 315 "mysql_com.h"
-typedef struct st_udf_args UDF_ARGS;
-# 326 "mysql_com.h"
-typedef struct st_udf_init UDF_INIT;
-# 27 "my_alloc.h"
-typedef struct st_used_mem USED_MEM;
-# 302 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct
- {
- unsigned long int seed1;
- unsigned long int seed2;
- unsigned long int max_value;
- double max_value_dbl;
- };
-# 24 "my_list.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_list
- {
- struct st_list * prev;
- struct st_list * next;
- void * data;
- };
-# 35 "my_alloc.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_mem_root
- {
- USED_MEM * free;
- USED_MEM * used;
- USED_MEM * pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
- unsigned int block_num;
- unsigned int first_block_usage;
- void (* error_handler)(void);
- };
-# 232 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql
- {
- NET net;
- gptr connector_fd;
- char * host;
- char * user;
- char * passwd;
- char * unix_socket;
- char * server_version;
- char * host_info;
- char * info;
- char * db;
- struct charset_info_st * charset;
- MYSQL_FIELD * fields;
- MEM_ROOT field_alloc;
- my_ulonglong affected_rows;
- my_ulonglong insert_id;
- my_ulonglong extra_info;
- unsigned long int thread_id;
- unsigned long int packet_length;
- unsigned int port;
- unsigned long int client_flag;
- unsigned long int server_capabilities;
- unsigned int protocol_version;
- unsigned int field_count;
- unsigned int server_status;
- unsigned int server_language;
- unsigned int warning_count;
- struct st_mysql_options options;
- enum mysql_status status;
- my_bool free_me;
- my_bool reconnect;
- char scramble[(20 + 1)];
- my_bool rpl_pivot;
- struct st_mysql * master;
- struct st_mysql * next_slave;
- struct st_mysql * last_used_slave;
- struct st_mysql * last_used_con;
- LIST * stmts;
- struct st_mysql_methods const * methods;
- void * thd;
- my_bool * unbuffered_fetch_owner;
- struct st_mysql_stmt * current_stmt;
- };
-# 571 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_bind
- {
- unsigned long int * length;
- my_bool * is_null;
- void * buffer;
- enum enum_field_types buffer_type;
- unsigned long int buffer_length;
- unsigned char * inter_buffer;
- unsigned long int offset;
- unsigned long int internal_length;
- unsigned int param_number;
- unsigned int pack_length;
- my_bool is_unsigned;
- my_bool long_data_used;
- my_bool internal_is_null;
- void (* store_param_func)(NET * net, struct st_mysql_bind * param);
- void (* fetch_result)(struct st_mysql_bind *, unsigned char * * row);
- void (* skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char * * row);
- };
-# 141 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_data
- {
- my_ulonglong rows;
- unsigned int fields;
- MYSQL_ROWS * data;
- MEM_ROOT alloc;
- MYSQL_ROWS * * prev_ptr;
- };
-# 93 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_field
- {
- char * name;
- char * org_name;
- char * table;
- char * org_table;
- char * db;
- char * catalog;
- char * def;
- unsigned long int length;
- unsigned long int max_length;
- unsigned int name_length;
- unsigned int org_name_length;
- unsigned int table_length;
- unsigned int org_table_length;
- unsigned int db_length;
- unsigned int catalog_length;
- unsigned int def_length;
- unsigned int flags;
- unsigned int decimals;
- unsigned int charsetnr;
- enum enum_field_types type;
- };
-# 323 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_manager
- {
- NET net;
- char * host;
- char * user;
- char * passwd;
- unsigned int port;
- my_bool free_me;
- my_bool eof;
- int cmd_status;
- int last_errno;
- char * net_buf;
- char * net_buf_pos;
- char * net_data_end;
- int net_buf_size;
- char last_error[256];
- };
-# 648 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_mysql_methods
- {
- my_bool (* read_query_result)(MYSQL * mysql);
- my_bool (* advanced_command)(MYSQL * mysql, enum enum_server_command, char const * header, unsigned long int, char const * arg, unsigned long int, my_bool, MYSQL_STMT * stmt);
- MYSQL_DATA * (* read_rows)(MYSQL * mysql, MYSQL_FIELD * mysql_fields, unsigned int);
- MYSQL_RES * (* use_result)(MYSQL * mysql);
- void (* fetch_lengths)(unsigned long int * to, MYSQL_ROW, unsigned int);
- void (* flush_use_result)(MYSQL * mysql);
- MYSQL_FIELD * (* list_fields)(MYSQL * mysql);
- my_bool (* read_prepare_result)(MYSQL * mysql, MYSQL_STMT * stmt);
- int (* stmt_execute)(MYSQL_STMT * stmt);
- int (* read_binary_rows)(MYSQL_STMT * stmt);
- int (* unbuffered_fetch)(MYSQL * mysql, char * * row);
- void (* free_embedded_thd)(MYSQL * mysql);
- char const * (* read_statistics)(MYSQL * mysql);
- my_bool (* next_result)(MYSQL * mysql);
- int (* read_change_user_result)(MYSQL * mysql, char * buff, char const * passwd);
- };
-# 162 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_mysql_options
- {
- unsigned int connect_timeout;
- unsigned int read_timeout;
- unsigned int write_timeout;
- unsigned int port;
- unsigned int protocol;
- unsigned long int client_flag;
- char * host;
- char * user;
- char * password;
- char * unix_socket;
- char * db;
- struct st_dynamic_array * init_commands;
- char * my_cnf_file;
- char * my_cnf_group;
- char * charset_dir;
- char * charset_name;
- char * ssl_key;
- char * ssl_cert;
- char * ssl_ca;
- char * ssl_capath;
- char * ssl_cipher;
- char * shared_memory_base_name;
- unsigned long int max_allowed_packet;
- my_bool use_ssl;
- my_bool compress;
- my_bool named_pipe;
- my_bool rpl_probe;
- my_bool rpl_parse;
- my_bool no_master_reads;
- my_bool separate_thread;
- enum mysql_option methods_to_use;
- char * client_ip;
- my_bool secure_auth;
- int (* local_infile_init)(void * *, char const *, void *);
- int (* local_infile_read)(void *, char *, unsigned int);
- void (* local_infile_end)(void);
- int (* local_infile_error)(void *, char *, unsigned int);
- void * local_infile_userdata;
- };
-# 337 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_mysql_parameters
- {
- unsigned long int * p_max_allowed_packet;
- unsigned long int * p_net_buffer_length;
- };
-# 292 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_res
- {
- my_ulonglong row_count;
- MYSQL_FIELD * fields;
- MYSQL_DATA * data;
- MYSQL_ROWS * data_cursor;
- unsigned long int * lengths;
- MYSQL * handle;
- MEM_ROOT field_alloc;
- unsigned int field_count;
- unsigned int current_field;
- MYSQL_ROW row;
- MYSQL_ROW current_row;
- my_bool eof;
- my_bool unbuffered_fetch_cancelled;
- struct st_mysql_methods const * methods;
- };
-# 131 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_rows
- {
- struct st_mysql_rows * next;
- MYSQL_ROW data;
- unsigned long int length;
- };
-# 596 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql_stmt
- {
- MEM_ROOT mem_root;
- LIST list;
- MYSQL * mysql;
- MYSQL_BIND * params;
- MYSQL_BIND * bind;
- MYSQL_FIELD * fields;
- MYSQL_DATA result;
- MYSQL_ROWS * data_cursor;
- my_ulonglong affected_rows;
- my_ulonglong insert_id;
- int (* read_row_func)(struct st_mysql_stmt * stmt, unsigned char * * row);
- unsigned long int stmt_id;
- unsigned int last_errno;
- unsigned int param_count;
- unsigned int field_count;
- enum enum_mysql_stmt_state state;
- char last_error[512];
- char sqlstate[(5 + 1)];
- my_bool send_types_to_server;
- my_bool bind_param_done;
- my_bool bind_result_done;
- my_bool unbuffered_fetch_cancelled;
- my_bool update_max_length;
- };
-# 48 "mysql_time.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time
- {
- unsigned int year;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int second;
- unsigned long int second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
- };
-# 151 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_net
- {
- Vio * vio;
- unsigned char * buff;
- unsigned char * buff_end;
- unsigned char * write_pos;
- unsigned char * read_pos;
- my_socket fd;
- unsigned long int max_packet;
- unsigned long int max_packet_size;
- unsigned int pkt_nr;
- unsigned int compress_pkt_nr;
- unsigned int write_timeout;
- unsigned int read_timeout;
- unsigned int retry_count;
- int fcntl;
- my_bool compress;
- unsigned long int remain_in_buf;
- unsigned long int length;
- unsigned long int buf_length;
- unsigned long int where_b;
- unsigned int * return_status;
- unsigned char reading_or_writing;
- char save_char;
- my_bool no_send_ok;
- char last_error[512];
- char sqlstate[(5 + 1)];
- unsigned int last_errno;
- unsigned char error;
- gptr query_cache_query;
- my_bool report_error;
- my_bool return_errno;
- };
-# 21 "typelib.h"
-struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib
- {
- unsigned int count;
- char const * name;
- char const * * type_names;
- unsigned int * type_lengths;
- };
-# 315 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args
- {
- unsigned int arg_count;
- enum Item_result * arg_type;
- char * * args;
- unsigned long int * lengths;
- char * maybe_null;
- };
-# 326 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init
- {
- my_bool maybe_null;
- unsigned int decimals;
- unsigned long int max_length;
- char * ptr;
- my_bool const_item;
- };
-# 27 "my_alloc.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_used_mem
- {
- struct st_used_mem * next;
- unsigned int left;
- unsigned int size;
- };
-# 313 "mysql_com.h"
-enum Item_result
- {
- STRING_RESULT = 0,
- REAL_RESULT = 1,
- INT_RESULT = 2,
- ROW_RESULT = 3,
- };
-# 186 "mysql_com.h"
-enum enum_field_types
- {
- MYSQL_TYPE_DECIMAL = 0,
- MYSQL_TYPE_TINY = 1,
- MYSQL_TYPE_SHORT = 2,
- MYSQL_TYPE_LONG = 3,
- MYSQL_TYPE_FLOAT = 4,
- MYSQL_TYPE_DOUBLE = 5,
- MYSQL_TYPE_NULL = 6,
- MYSQL_TYPE_TIMESTAMP = 7,
- MYSQL_TYPE_LONGLONG = 8,
- MYSQL_TYPE_INT24 = 9,
- MYSQL_TYPE_DATE = 10,
- MYSQL_TYPE_TIME = 11,
- MYSQL_TYPE_DATETIME = 12,
- MYSQL_TYPE_YEAR = 13,
- MYSQL_TYPE_NEWDATE = 14,
- MYSQL_TYPE_ENUM = 247,
- MYSQL_TYPE_SET = 248,
- MYSQL_TYPE_TINY_BLOB = 249,
- MYSQL_TYPE_MEDIUM_BLOB = 250,
- MYSQL_TYPE_LONG_BLOB = 251,
- MYSQL_TYPE_BLOB = 252,
- MYSQL_TYPE_VAR_STRING = 253,
- MYSQL_TYPE_STRING = 254,
- MYSQL_TYPE_GEOMETRY = 255,
- };
-# 269 "mysql_com.h"
-enum enum_mysql_set_option
- {
- MYSQL_OPTION_MULTI_STATEMENTS_ON = 0,
- MYSQL_OPTION_MULTI_STATEMENTS_OFF = 1,
- };
-# 563 "mysql.h"
-enum enum_mysql_stmt_state
- {
- MYSQL_STMT_INIT_DONE = 1,
- MYSQL_STMT_PREPARE_DONE = 2,
- MYSQL_STMT_EXECUTE_DONE = 3,
- MYSQL_STMT_FETCH_DONE = 4,
- };
-# 29 "mysql_time.h"
-enum enum_mysql_timestamp_type
- {
- MYSQL_TIMESTAMP_NONE = -(2),
- MYSQL_TIMESTAMP_ERROR = -(1),
- MYSQL_TIMESTAMP_DATE = 0,
- MYSQL_TIMESTAMP_DATETIME = 1,
- MYSQL_TIMESTAMP_TIME = 2,
- };
-# 39 "mysql_com.h"
-enum enum_server_command
- {
- COM_SLEEP = 0,
- COM_QUIT = 1,
- COM_INIT_DB = 2,
- COM_QUERY = 3,
- COM_FIELD_LIST = 4,
- COM_CREATE_DB = 5,
- COM_DROP_DB = 6,
- COM_REFRESH = 7,
- COM_SHUTDOWN = 8,
- COM_STATISTICS = 9,
- COM_PROCESS_INFO = 10,
- COM_CONNECT = 11,
- COM_PROCESS_KILL = 12,
- COM_DEBUG = 13,
- COM_PING = 14,
- COM_TIME = 15,
- COM_DELAYED_INSERT = 16,
- COM_CHANGE_USER = 17,
- COM_BINLOG_DUMP = 18,
- COM_TABLE_DUMP = 19,
- COM_CONNECT_OUT = 20,
- COM_REGISTER_SLAVE = 21,
- COM_PREPARE = 22,
- COM_EXECUTE = 23,
- COM_LONG_DATA = 24,
- COM_CLOSE_STMT = 25,
- COM_RESET_STMT = 26,
- COM_SET_OPTION = 27,
- COM_END = 28,
- };
-# 635 "mysql.h"
-enum enum_stmt_attr_type
- {
- STMT_ATTR_UPDATE_MAX_LENGTH = 0,
- };
-# 244 "mysql_com.h"
-enum mysql_enum_shutdown_level
- {
- SHUTDOWN_DEFAULT = 0,
- SHUTDOWN_WAIT_CONNECTIONS = (unsigned char)((1 << 0)),
- SHUTDOWN_WAIT_TRANSACTIONS = (unsigned char)((1 << 1)),
- SHUTDOWN_WAIT_UPDATES = (unsigned char)((1 << 3)),
- SHUTDOWN_WAIT_ALL_BUFFERS = ((unsigned char)((1 << 3)) << 1),
- SHUTDOWN_WAIT_CRITICAL_BUFFERS = (((unsigned char)((1 << 3)) << 1) + 1),
- KILL_CONNECTION = 255,
- };
-# 151 "mysql.h"
-enum mysql_option
- {
- MYSQL_OPT_CONNECT_TIMEOUT = 0,
- MYSQL_OPT_COMPRESS = 1,
- MYSQL_OPT_NAMED_PIPE = 2,
- MYSQL_INIT_COMMAND = 3,
- MYSQL_READ_DEFAULT_FILE = 4,
- MYSQL_READ_DEFAULT_GROUP = 5,
- MYSQL_SET_CHARSET_DIR = 6,
- MYSQL_SET_CHARSET_NAME = 7,
- MYSQL_OPT_LOCAL_INFILE = 8,
- MYSQL_OPT_PROTOCOL = 9,
- MYSQL_SHARED_MEMORY_BASE_NAME = 10,
- MYSQL_OPT_READ_TIMEOUT = 11,
- MYSQL_OPT_WRITE_TIMEOUT = 12,
- MYSQL_OPT_USE_RESULT = 13,
- MYSQL_OPT_USE_REMOTE_CONNECTION = 14,
- MYSQL_OPT_USE_EMBEDDED_CONNECTION = 15,
- MYSQL_OPT_GUESS_CONNECTION = 16,
- MYSQL_SET_CLIENT_IP = 17,
- MYSQL_SECURE_AUTH = 18,
- };
-# 214 "mysql.h"
-enum mysql_protocol_type
- {
- MYSQL_PROTOCOL_DEFAULT = 0,
- MYSQL_PROTOCOL_TCP = 1,
- MYSQL_PROTOCOL_SOCKET = 2,
- MYSQL_PROTOCOL_PIPE = 3,
- MYSQL_PROTOCOL_MEMORY = 4,
- };
-# 224 "mysql.h"
-enum mysql_rpl_type
- {
- MYSQL_RPL_MASTER = 0,
- MYSQL_RPL_SLAVE = 1,
- MYSQL_RPL_ADMIN = 2,
- };
-# 209 "mysql.h"
-enum mysql_status
- {
- MYSQL_STATUS_READY = 0,
- MYSQL_STATUS_GET_RESULT = 1,
- MYSQL_STATUS_USE_RESULT = 2,
- };
-# 365 "mysql_com.h"
-extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2);
-# 358 "mysql_com.h"
-extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt);
-# 353 "mysql_com.h"
-extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
-# 28 "typelib.h"
-extern int find_type(char * x, TYPELIB * typelib, unsigned int);
-# 367 "mysql_com.h"
-extern void get_salt_from_password(unsigned char * res, char const * password);
-# 360 "mysql_com.h"
-extern void get_salt_from_password_323(unsigned long int * res, char const * password);
-# 372 "mysql_com.h"
-extern char * get_tty_password(char * opt_message);
-# 30 "typelib.h"
-extern char const * get_type(TYPELIB * typelib, unsigned int);
-# 355 "mysql_com.h"
-extern void hash_password(unsigned long int * to, char const * password, unsigned int);
-# 31 "my_list.h"
-extern LIST * list_add(LIST * root, LIST * element);
-# 33 "my_list.h"
-extern LIST * list_cons(void * data, LIST * root);
-# 32 "my_list.h"
-extern LIST * list_delete(LIST * root, LIST * element);
-# 35 "my_list.h"
-extern void list_free(LIST * root, unsigned int);
-# 36 "my_list.h"
-extern unsigned int list_length(LIST *);
-# 34 "my_list.h"
-extern LIST * list_reverse(LIST * root);
-# 37 "my_list.h"
-extern int list_walk(LIST *, list_walk_action, gptr);
-# 378 "mysql_com.h"
-extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv);
-# 368 "mysql_com.h"
-extern void make_password_from_salt(char * to, unsigned char const * hash_stage2);
-# 361 "mysql_com.h"
-extern void make_password_from_salt_323(char * to, unsigned long int const * salt);
-# 363 "mysql_com.h"
-extern void make_scrambled_password(char * to, char const * password);
-# 356 "mysql_com.h"
-extern void make_scrambled_password_323(char * to, char const * password);
-# 29 "typelib.h"
-extern void make_type(char * to, unsigned int, TYPELIB * typelib);
-# 299 "mysql_com.h"
-extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int);
-# 377 "mysql_com.h"
-extern my_bool my_init(void);
-# 281 "mysql_com.h"
-extern my_bool my_net_init(NET * net, Vio * vio);
-# 282 "mysql_com.h"
-extern void my_net_local_init(NET * net);
-# 292 "mysql_com.h"
-extern unsigned long int my_net_read(NET * net);
-# 287 "mysql_com.h"
-extern my_bool my_net_write(NET * net, char const * packet, unsigned long int);
-# 352 "mysql_com.h"
-extern double my_rnd(struct rand_struct *);
-# 381 "mysql_com.h"
-extern void my_thread_end(void);
-# 380 "mysql_com.h"
-extern my_bool my_thread_init(void);
-# 539 "mysql.h"
-extern void myodbc_remove_escape(MYSQL * mysql, char * name);
-# 481 "mysql.h"
-extern int mysql_add_slave(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
-# 393 "mysql.h"
-extern my_ulonglong mysql_affected_rows(MYSQL * mysql);
-# 720 "mysql.h"
-extern my_bool mysql_autocommit(MYSQL * mysql, my_bool);
-# 408 "mysql.h"
-extern my_bool mysql_change_user(MYSQL * mysql, char const * user, char const * passwd, char const * db);
-# 401 "mysql.h"
-extern char const * mysql_character_set_name(MYSQL * mysql);
-# 723 "mysql.h"
-extern void mysql_close(MYSQL * sock);
-# 718 "mysql.h"
-extern my_bool mysql_commit(MYSQL * mysql);
-# 510 "mysql.h"
-extern void mysql_data_seek(MYSQL_RES * result, my_ulonglong);
-# 528 "mysql.h"
-extern void mysql_debug(char const * debug);
-# 467 "mysql.h"
-extern void mysql_disable_reads_from_master(MYSQL * mysql);
-# 461 "mysql.h"
-extern void mysql_disable_rpl_parse(MYSQL * mysql);
-# 489 "mysql.h"
-extern int mysql_dump_debug_info(MYSQL * mysql);
-# 541 "mysql.h"
-extern my_bool mysql_embedded(void);
-# 466 "mysql.h"
-extern void mysql_enable_reads_from_master(MYSQL * mysql);
-# 460 "mysql.h"
-extern void mysql_enable_rpl_parse(MYSQL * mysql);
-# 385 "mysql.h"
-extern my_bool mysql_eof(MYSQL_RES * res);
-# 395 "mysql.h"
-extern unsigned int mysql_errno(MYSQL * mysql);
-# 373 "mysql_com.h"
-extern char const * mysql_errno_to_sqlstate(unsigned int);
-# 396 "mysql.h"
-extern char const * mysql_error(MYSQL * mysql);
-# 521 "mysql.h"
-extern unsigned long int mysql_escape_string(char * to, char const * from, unsigned long int);
-# 518 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_field(MYSQL_RES * result);
-# 386 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES * res, unsigned int);
-# 388 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES * res);
-# 517 "mysql.h"
-extern unsigned long int * mysql_fetch_lengths(MYSQL_RES * result);
-# 516 "mysql.h"
-extern MYSQL_ROW mysql_fetch_row(MYSQL_RES * result);
-# 392 "mysql.h"
-extern unsigned int mysql_field_count(MYSQL * mysql);
-# 514 "mysql.h"
-extern MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES * result, MYSQL_FIELD_OFFSET);
-# 390 "mysql.h"
-extern MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES * res);
-# 509 "mysql.h"
-extern void mysql_free_result(MYSQL_RES * result);
-# 499 "mysql.h"
-extern char const * mysql_get_client_info(void);
-# 500 "mysql.h"
-extern unsigned long int mysql_get_client_version(void);
-# 501 "mysql.h"
-extern char const * mysql_get_host_info(MYSQL * mysql);
-# 367 "mysql.h"
-extern MYSQL_PARAMETERS * mysql_get_parameters(void);
-# 503 "mysql.h"
-extern unsigned int mysql_get_proto_info(MYSQL * mysql);
-# 498 "mysql.h"
-extern char const * mysql_get_server_info(MYSQL * mysql);
-# 502 "mysql.h"
-extern unsigned long int mysql_get_server_version(MYSQL * mysql);
-# 523 "mysql.h"
-extern unsigned long int mysql_hex_string(char * to, char const * from, unsigned long int);
-# 399 "mysql.h"
-extern char const * mysql_info(MYSQL * mysql);
-# 404 "mysql.h"
-extern MYSQL * mysql_init(MYSQL * mysql);
-# 394 "mysql.h"
-extern my_ulonglong mysql_insert_id(MYSQL * mysql);
-# 492 "mysql.h"
-extern int mysql_kill(MYSQL * mysql, unsigned long int);
-# 504 "mysql.h"
-extern MYSQL_RES * mysql_list_dbs(MYSQL * mysql, char const * wild);
-# 519 "mysql.h"
-extern MYSQL_RES * mysql_list_fields(MYSQL * mysql, char const * table, char const * wild);
-# 506 "mysql.h"
-extern MYSQL_RES * mysql_list_processes(MYSQL * mysql);
-# 505 "mysql.h"
-extern MYSQL_RES * mysql_list_tables(MYSQL * mysql, char const * wild);
-# 548 "mysql.h"
-extern void mysql_manager_close(MYSQL_MANAGER * con);
-# 549 "mysql.h"
-extern int mysql_manager_command(MYSQL_MANAGER * con, char const * cmd, int);
-# 543 "mysql.h"
-extern MYSQL_MANAGER * mysql_manager_connect(MYSQL_MANAGER * con, char const * host, char const * user, char const * passwd, unsigned int);
-# 551 "mysql.h"
-extern int mysql_manager_fetch_line(MYSQL_MANAGER * con, char * res_buf, int);
-# 542 "mysql.h"
-extern MYSQL_MANAGER * mysql_manager_init(MYSQL_MANAGER * con);
-# 427 "mysql.h"
-extern my_bool mysql_master_query(MYSQL * mysql, char const * q, unsigned long int);
-# 429 "mysql.h"
-extern my_bool mysql_master_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 721 "mysql.h"
-extern my_bool mysql_more_results(MYSQL * mysql);
-# 722 "mysql.h"
-extern int mysql_next_result(MYSQL * mysql);
-# 384 "mysql.h"
-extern unsigned int mysql_num_fields(MYSQL_RES * res);
-# 383 "mysql.h"
-extern my_ulonglong mysql_num_rows(MYSQL_RES * res);
-# 529 "mysql.h"
-extern char * mysql_odbc_escape_string(MYSQL * mysql, char * to, unsigned long int, char const * from, unsigned long int, void * param, char * (* extend_buffer)(void *, char * to, unsigned long int * length));
-# 507 "mysql.h"
-extern int mysql_options(MYSQL * mysql, enum mysql_option, char const * arg);
-# 496 "mysql.h"
-extern int mysql_ping(MYSQL * mysql);
-# 75 "mysql.h"
-extern unsigned int mysql_port;
-# 418 "mysql.h"
-extern int mysql_query(MYSQL * mysql, char const * q);
-# 554 "mysql.h"
-extern my_bool mysql_read_query_result(MYSQL * mysql);
-# 469 "mysql.h"
-extern my_bool mysql_reads_from_master_enabled(MYSQL * mysql);
-# 410 "mysql.h"
-extern MYSQL * mysql_real_connect(MYSQL * mysql, char const * host, char const * user, char const * passwd, char const * db, unsigned int, char const * unix_socket, unsigned long int);
-# 525 "mysql.h"
-extern unsigned long int mysql_real_escape_string(MYSQL * mysql, char * to, char const * from, unsigned long int);
-# 421 "mysql.h"
-extern int mysql_real_query(MYSQL * mysql, char const * q, unsigned long int);
-# 490 "mysql.h"
-extern int mysql_refresh(MYSQL * mysql, unsigned int);
-# 719 "mysql.h"
-extern my_bool mysql_rollback(MYSQL * mysql);
-# 512 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES * result, MYSQL_ROW_OFFSET);
-# 389 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES * res);
-# 463 "mysql.h"
-extern int mysql_rpl_parse_enabled(MYSQL * mysql);
-# 474 "mysql.h"
-extern my_bool mysql_rpl_probe(MYSQL * mysql);
-# 471 "mysql.h"
-extern enum mysql_rpl_type mysql_rpl_query_type(char const * q, int);
-# 417 "mysql.h"
-extern int mysql_select_db(MYSQL * mysql, char const * db);
-# 419 "mysql.h"
-extern int mysql_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 354 "mysql.h"
-extern void mysql_server_end(void);
-# 353 "mysql.h"
-extern int mysql_server_init(int, char * * argv, char * * groups);
-# 402 "mysql.h"
-extern int mysql_set_character_set(MYSQL * mysql, char const * csname);
-# 452 "mysql.h"
-extern void mysql_set_local_infile_default(MYSQL * mysql);
-# 441 "mysql.h"
-extern void mysql_set_local_infile_handler(MYSQL * mysql, int (* local_infile_init)(void * *, char const *, void *), int (* local_infile_read)(void *, char *, unsigned int), void (* local_infile_end)(void), int (* local_infile_error)(void *, char *, unsigned int), void *);
-# 477 "mysql.h"
-extern int mysql_set_master(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
-# 493 "mysql.h"
-extern int mysql_set_server_option(MYSQL * mysql, enum enum_mysql_set_option);
-# 486 "mysql.h"
-extern int mysql_shutdown(MYSQL * mysql, enum mysql_enum_shutdown_level);
-# 432 "mysql.h"
-extern my_bool mysql_slave_query(MYSQL * mysql, char const * q, unsigned long int);
-# 434 "mysql.h"
-extern my_bool mysql_slave_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 397 "mysql.h"
-extern char const * mysql_sqlstate(MYSQL * mysql);
-# 405 "mysql.h"
-extern my_bool mysql_ssl_set(MYSQL * mysql, char const * key, char const * cert, char const * ca, char const * capath, char const * cipher);
-# 497 "mysql.h"
-extern char const * mysql_stat(MYSQL * mysql);
-# 714 "mysql.h"
-extern my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt);
-# 692 "mysql.h"
-extern my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void * attr);
-# 689 "mysql.h"
-extern my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void const * attr);
-# 695 "mysql.h"
-extern my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
-# 696 "mysql.h"
-extern my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
-# 697 "mysql.h"
-extern my_bool mysql_stmt_close(MYSQL_STMT * stmt);
-# 712 "mysql.h"
-extern void mysql_stmt_data_seek(MYSQL_STMT * stmt, my_ulonglong);
-# 706 "mysql.h"
-extern unsigned int mysql_stmt_errno(MYSQL_STMT * stmt);
-# 707 "mysql.h"
-extern char const * mysql_stmt_error(MYSQL_STMT * stmt);
-# 682 "mysql.h"
-extern int mysql_stmt_execute(MYSQL_STMT * stmt);
-# 683 "mysql.h"
-extern int mysql_stmt_fetch(MYSQL_STMT * stmt);
-# 684 "mysql.h"
-extern int mysql_stmt_fetch_column(MYSQL_STMT * stmt, MYSQL_BIND * bind, unsigned int, unsigned long int);
-# 716 "mysql.h"
-extern unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt);
-# 699 "mysql.h"
-extern my_bool mysql_stmt_free_result(MYSQL_STMT * stmt);
-# 679 "mysql.h"
-extern MYSQL_STMT * mysql_stmt_init(MYSQL * mysql);
-# 715 "mysql.h"
-extern my_ulonglong mysql_stmt_insert_id(MYSQL_STMT * stmt);
-# 713 "mysql.h"
-extern my_ulonglong mysql_stmt_num_rows(MYSQL_STMT * stmt);
-# 688 "mysql.h"
-extern unsigned long int mysql_stmt_param_count(MYSQL_STMT * stmt);
-# 705 "mysql.h"
-extern MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT * stmt);
-# 680 "mysql.h"
-extern int mysql_stmt_prepare(MYSQL_STMT * stmt, char const * query, unsigned long int);
-# 698 "mysql.h"
-extern my_bool mysql_stmt_reset(MYSQL_STMT * stmt);
-# 704 "mysql.h"
-extern MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT * stmt);
-# 709 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT * stmt, MYSQL_ROW_OFFSET);
-# 711 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT * stmt);
-# 700 "mysql.h"
-extern my_bool mysql_stmt_send_long_data(MYSQL_STMT * stmt, unsigned int, char const * data, unsigned long int);
-# 708 "mysql.h"
-extern char const * mysql_stmt_sqlstate(MYSQL_STMT * stmt);
-# 687 "mysql.h"
-extern int mysql_stmt_store_result(MYSQL_STMT * stmt);
-# 423 "mysql.h"
-extern MYSQL_RES * mysql_store_result(MYSQL * mysql);
-# 376 "mysql.h"
-extern void mysql_thread_end(void);
-# 400 "mysql.h"
-extern unsigned long int mysql_thread_id(MYSQL * mysql);
-# 375 "mysql.h"
-extern my_bool mysql_thread_init(void);
-# 540 "mysql.h"
-extern unsigned int mysql_thread_safe(void);
-# 76 "mysql.h"
-extern char * mysql_unix_port;
-# 424 "mysql.h"
-extern MYSQL_RES * mysql_use_result(MYSQL * mysql);
-# 398 "mysql.h"
-extern unsigned int mysql_warning_count(MYSQL * mysql);
-# 284 "mysql_com.h"
-extern void net_clear(NET * net);
-# 283 "mysql_com.h"
-extern void net_end(NET * net);
-# 286 "mysql_com.h"
-extern my_bool net_flush(NET * net);
-# 291 "mysql_com.h"
-extern int net_real_write(NET * net, char const * packet, unsigned long int);
-# 285 "mysql_com.h"
-extern my_bool net_realloc(NET * net, unsigned long int);
-# 751 "mysql.h"
-extern unsigned long int net_safe_read(MYSQL * mysql);
-# 288 "mysql_com.h"
-extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int);
-# 350 "mysql_com.h"
-extern void randominit(struct rand_struct *, unsigned long int, unsigned long int);
-# 364 "mysql_com.h"
-extern void scramble(char * to, char const * message, char const * password);
-# 357 "mysql_com.h"
-extern void scramble_323(char * to, char const * message, char const * password);
-# 32 "typelib.h"
-extern TYPELIB sql_protocol_typelib;
diff --git a/include/my_sys.h b/include/my_sys.h
index 65bfb0b7e6a..d19091a85e8 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -842,12 +842,6 @@ my_bool my_gethwaddr(uchar *to);
#endif
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
-#ifdef HAVE_GETPAGESIZE
-#define my_getpagesize() getpagesize()
-#else
-/* qnx ? */
-#define my_getpagesize() 8192
-#endif
#define my_munmap(a,b) munmap((a),(b))
#else
@@ -863,16 +857,17 @@ my_bool my_gethwaddr(uchar *to);
#define HAVE_MMAP
#endif
-#ifndef __NETWARE__
-int my_getpagesize(void);
-#else
-#define my_getpagesize() 8192
-#endif
-
void *my_mmap(void *, size_t, int, int, int, my_off_t);
int my_munmap(void *, size_t);
#endif
+/* my_getpagesize */
+#ifdef HAVE_GETPAGESIZE
+#define my_getpagesize() getpagesize()
+#else
+int my_getpagesize(void);
+#endif
+
int my_msync(int, void *, size_t, int);
/* character sets */
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index bf20eb3f270..ab004ef8b5f 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -1264,13 +1264,30 @@ int mi_enable_indexes(MI_INFO *info)
RETURN
0 indexes are not disabled
1 all indexes are disabled
- [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+ 2 non-unique indexes are disabled
*/
int mi_indexes_are_disabled(MI_INFO *info)
{
MYISAM_SHARE *share= info->s;
- return (! mi_is_any_key_active(share->state.key_map) && share->base.keys);
+ /*
+ No keys or all are enabled. keys is the number of keys. Left shifted
+ gives us only one bit set. When decreased by one, gives us all all bits
+ up to this one set and it gets unset.
+ */
+ if (!share->base.keys ||
+ (mi_is_all_keys_active(share->state.key_map, share->base.keys)))
+ return 0;
+
+ /* All are disabled */
+ if (mi_is_any_key_active(share->state.key_map))
+ return 1;
+
+ /*
+ We have keys. Some enabled, some disabled.
+ Don't check for any non-unique disabled but return directly 2
+ */
+ return 2;
}
diff --git a/myisam/myisampack.c b/myisam/myisampack.c
index 912ed22d278..c71fcce1d50 100644
--- a/myisam/myisampack.c
+++ b/myisam/myisampack.c
@@ -2923,6 +2923,8 @@ static void flush_bits(void)
bits-= 8;
*file_buffer.pos++= (uchar) (bit_buffer >> bits);
}
+ if (file_buffer.pos >= file_buffer.end)
+ VOID(flush_buffer(~ (ulong) 0));
file_buffer.bits= BITS_SAVED;
file_buffer.bitbucket= 0;
}
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 74f8f478a33..72998d786b9 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -32,20 +32,21 @@ endif
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
-EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
-EXTRA_DIST = $(EXTRA_SCRIPTS)
-GENSCRIPTS = mysql-test-run install_test_db mtr
+EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
+EXTRA_DIST = $(EXTRA_SCRIPTS)
+GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
- std_data/server-cert.pem std_data/server-key.pem
+test_DATA = std_data/client-key.pem \
+ std_data/client-cert.pem \
+ std_data/cacert.pem \
+ std_data/server-cert.pem \
+ std_data/server-key.pem
CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
-EXTRA_PROGRAMS = mysql_test_run_new
-noinst_HEADERS = my_manage.h
-mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c
+noinst_HEADERS = my_manage.h
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
@@ -65,6 +66,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
@@ -96,6 +98,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
@@ -119,6 +122,11 @@ mtr:
$(RM) -f mtr
$(LN_S) mysql-test-run.pl mtr
+# mysql-test-run - a shortcut for executing mysql-test-run.pl
+mysql-test-run:
+ $(RM) -f mysql-test-run
+ $(LN_S) mysql-test-run.pl mysql-test-run
+
SUFFIXES = .sh
.sh:
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index d270d72d526..9e943fec9ef 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -593,6 +593,10 @@ sub mtr_options_from_test_file($$) {
while ( my $line= <$F> )
{
+
+ # Skip line if it start's with #
+ next if ( $line =~ /^#/ );
+
# Match this line against tag in "tags" array
foreach my $tag (@tags)
{
diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl
index 5be1d2ffddb..842dc09413d 100644
--- a/mysql-test/lib/mtr_io.pl
+++ b/mysql-test/lib/mtr_io.pl
@@ -13,6 +13,8 @@ sub mtr_tofile ($@);
sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
+sub mtr_grab_file($);
+
##############################################################################
#
@@ -129,6 +131,7 @@ sub unspace {
return "$quote$string$quote";
}
+# Read a whole file, stripping leading and trailing whitespace.
sub mtr_fromfile ($) {
my $file= shift;
@@ -182,5 +185,16 @@ sub mtr_appendfile_to_file ($$) {
close TOFILE;
}
+# Read a whole file verbatim.
+sub mtr_grab_file($) {
+ my $file= shift;
+ open(FILE, '<', $file)
+ or return undef;
+ local $/= undef;
+ my $data= scalar(<FILE>);
+ close FILE;
+ return $data;
+}
+
1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 846ca25b725..f28e25e5966 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -134,6 +134,7 @@ sub mtr_exe_maybe_exists (@) {
my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32;
+ map {$_.= ".nlm"} @path if $::glob_netware;
foreach my $path ( @path )
{
if($::glob_win32)
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 8a8b8d0858a..330dfddf1d3 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -708,7 +708,7 @@ sub mtr_wait_blocking($) {
}
}
-# Start "mysqladmin shutdown" for a specific mysqld
+# Start "mysqladmin <command>" for a specific mysqld
sub mtr_mysqladmin_start($$$) {
my $srv= shift;
my $command= shift;
@@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) {
# Shutdown time must be high as slave may be in reconnect
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "$command");
- my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
my $pid= mtr_spawn($::exe_mysqladmin, $args,
- "", $path_mysqladmin_log, $path_mysqladmin_log, "",
+ "", "", "", "",
{ append_log_file => 1 });
mtr_verbose("mtr_mysqladmin_start, pid: $pid");
return $pid;
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index d0e836c1a90..a2c16e1941a 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -34,7 +34,12 @@ sub mtr_verbose (@);
# We can't use diff -u or diff -a as these are not portable
sub mtr_show_failed_diff ($) {
- my $tname= shift;
+ my $result_file_name= shift;
+
+ # The reject and log files have been dumped to
+ # to filenames based on the result_file's name
+ my $tname= basename($result_file_name);
+ $tname=~ s/\..*$//;
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run-shell.sh
index a81a3b8b607..a81a3b8b607 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run-shell.sh
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6aacbfdf1ad..c2d8f8ae2f8 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -103,7 +103,6 @@ our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
our $glob_scriptname= undef;
our $glob_timers= undef;
-our $glob_use_running_server= 0;
our $glob_use_running_ndbcluster= 0;
our $glob_use_running_ndbcluster_slave= 0;
our $glob_use_embedded_server= 0;
@@ -141,6 +140,7 @@ our $opt_verbose= 0; # Verbose output, enable with --verbose
our $exe_master_mysqld;
our $exe_mysql;
our $exe_mysqladmin;
+our $exe_mysql_upgrade;
our $exe_mysqlbinlog;
our $exe_mysql_client_test;
our $exe_mysqld;
@@ -150,6 +150,7 @@ our $exe_mysqlslap;
our $exe_mysqlimport;
our $exe_mysqlshow;
our $exe_mysql_fix_system_tables;
+our $file_mysql_fix_privilege_tables;
our $exe_mysqltest;
our $exe_ndbd;
our $exe_ndb_mgmd;
@@ -162,7 +163,7 @@ our $exe_libtool;
our $opt_bench= 0;
our $opt_small_bench= 0;
-our $opt_big_test= 0; # Send --big-test to mysqltest
+our $opt_big_test= 0;
our @opt_extra_mysqld_opt;
@@ -179,7 +180,10 @@ our $opt_debug;
our $opt_do_test;
our @opt_cases; # The test cases names in argv
our $opt_embedded_server;
-our $opt_extern;
+
+our $opt_extern= 0;
+our $opt_socket;
+
our $opt_fast;
our $opt_force;
our $opt_reorder= 0;
@@ -224,8 +228,8 @@ our $opt_ndbcluster_port_slave;
our $opt_ndbconnectstring_slave;
our $opt_record;
+my $opt_report_features;
our $opt_check_testcases;
-my $opt_report_features;
our $opt_skip;
our $opt_skip_rpl;
@@ -236,17 +240,11 @@ our $opt_skip_im;
our $opt_sleep;
-our $opt_sleep_time_after_restart= 1;
-our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout;
our $opt_suite_timeout;
my $default_testcase_timeout= 15; # 15 min max
my $default_suite_timeout= 180; # 3 hours max
-our $opt_socket;
-
-our $opt_source_dist;
-
our $opt_start_and_exit;
our $opt_start_dirty;
our $opt_start_from;
@@ -256,7 +254,6 @@ our $opt_strace_client;
our $opt_timer= 1;
our $opt_user;
-our $opt_user_test;
our $opt_valgrind= 0;
our $opt_valgrind_mysqld= 0;
@@ -278,7 +275,6 @@ our $opt_stress_test_file= "";
our $opt_wait_for_master;
our $opt_wait_for_slave;
-our $opt_wait_timeout= 10;
our $opt_warnings;
@@ -308,6 +304,8 @@ our $glob_tot_real_time= 0;
our %mysqld_variables;
+my $source_dist= 0;
+
######################################################################
#
@@ -319,11 +317,12 @@ sub main ();
sub initial_setup ();
sub command_line_setup ();
sub set_mtr_build_thread_ports($);
-sub datadir_setup ();
+sub datadir_list_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_running_servers ();
-sub cleanup_stale_files ();
+sub remove_stale_vardir ();
+sub setup_vardir ();
sub check_ssl_support ($);
sub check_running_as_root();
sub check_ndbcluster_support ($);
@@ -467,6 +466,15 @@ sub command_line_setup () {
$im_port= 9312;
$im_mysqld1_port= 9313;
$im_mysqld2_port= 9314;
+
+ # If so requested, we try to avail ourselves of a unique build thread number.
+ if ( $ENV{'MTR_BUILD_THREAD'} ) {
+ if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
+ print "Requesting build thread... ";
+ $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
+ print "got ".$ENV{'MTR_BUILD_THREAD'}."\n";
+ }
+ }
if ( $ENV{'MTR_BUILD_THREAD'} )
{
@@ -574,7 +582,7 @@ sub command_line_setup () {
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
'benchdir=s' => \$glob_mysql_bench_dir,
- 'mem:s' => \$opt_mem,
+ 'mem' => \$opt_mem,
# Misc
'report-features' => \$opt_report_features,
@@ -591,9 +599,7 @@ sub command_line_setup () {
'start-and-exit' => \$opt_start_and_exit,
'timer!' => \$opt_timer,
'unified-diff|udiff' => \$opt_udiff,
- 'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user,
- 'wait-timeout=i' => \$opt_wait_timeout,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
'warnings|log-warnings' => \$opt_warnings,
@@ -625,7 +631,7 @@ sub command_line_setup () {
if ( -d "../sql" )
{
- $opt_source_dist= 1;
+ $source_dist= 1;
}
$glob_hostname= mtr_short_hostname();
@@ -649,7 +655,7 @@ sub command_line_setup () {
# directory. And we install "/usr/share/mysql-test". Moving up one
# more directory relative to "mysql-test" gives us a usable base
# directory for RPM installs.
- if ( ! $opt_source_dist and ! -d "$glob_basedir/bin" )
+ if ( ! $source_dist and ! -d "$glob_basedir/bin" )
{
$glob_basedir= dirname($glob_basedir);
}
@@ -661,7 +667,7 @@ sub command_line_setup () {
unless -d $glob_mysql_bench_dir;
$path_my_basedir=
- $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
+ $source_dist ? $glob_mysql_test_dir : $glob_basedir;
$glob_timers= mtr_init_timers();
@@ -670,10 +676,10 @@ sub command_line_setup () {
# number as early as possible
#
- # Look for the client binaries
- $path_client_bindir= mtr_path_exists(vs_config_dirs('client', ''),
- "$glob_basedir/client_release",
+ # Look for the client binaries directory
+ $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/client_debug",
+ vs_config_dirs('client', ''),
"$glob_basedir/client",
"$glob_basedir/bin");
@@ -804,13 +810,6 @@ sub command_line_setup () {
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
}
- # Ensure a proper error message
- mkpath("$opt_vardir");
- unless ( -d $opt_vardir and -w $opt_vardir )
- {
- mtr_error("Writable 'var' directory is needed, use the '--vardir' option");
- }
-
# --------------------------------------------------------------------------
# Set tmpdir
# --------------------------------------------------------------------------
@@ -818,14 +817,6 @@ sub command_line_setup () {
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# --------------------------------------------------------------------------
- # Set socket
- # --------------------------------------------------------------------------
- if (!$opt_socket)
- {
- $opt_socket= $mysqld_variables{'socket'};
- }
-
- # --------------------------------------------------------------------------
# Check im suport
# --------------------------------------------------------------------------
if ( $mysql_version_id < 50000 )
@@ -922,17 +913,17 @@ sub command_line_setup () {
}
# --------------------------------------------------------------------------
- # Sleep flag
+ # Big test flags
# --------------------------------------------------------------------------
- if ( $opt_sleep )
- {
- $opt_sleep_time_after_restart= $opt_sleep;
- }
+ if ( $opt_big_test )
+ {
+ $ENV{'BIG_TEST'}= 1;
+ }
# --------------------------------------------------------------------------
# Gcov flag
# --------------------------------------------------------------------------
- if ( $opt_gcov and ! $opt_source_dist )
+ if ( $opt_gcov and ! $source_dist )
{
mtr_error("Coverage test needs the source - please use source dist");
}
@@ -946,8 +937,6 @@ sub command_line_setup () {
{
# Indicate that we are using debugger
$glob_debugger= 1;
- # Increase timeouts
- $opt_wait_timeout= 300;
if ( $opt_extern )
{
mtr_error("Can't use --extern when using debugger");
@@ -1013,16 +1002,9 @@ sub command_line_setup () {
$opt_suite_timeout*= 6 if $opt_valgrind;
}
- # Increase times to wait for executables to start if using valgrind
- if ( $opt_valgrind )
- {
- $opt_sleep_time_after_restart= 10;
- $opt_sleep_time_for_delete= 60;
- }
-
if ( ! $opt_user )
{
- if ( $glob_use_running_server )
+ if ( $opt_extern )
{
$opt_user= "test";
}
@@ -1204,9 +1186,17 @@ sub command_line_setup () {
if ( $opt_extern )
{
- $glob_use_running_server= 1;
- $opt_skip_rpl= 1; # We don't run rpl test cases
- $master->[0]->{'path_sock'}= $opt_socket;
+ # Turn off features not supported when running with extern server
+ $opt_skip_rpl= 1;
+
+ # Setup master->[0] with the settings for the extern server
+ $master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
+ mtr_report("Using extern server at '$master->[0]->{path_sock}'");
+ }
+ else
+ {
+ mtr_error("--socket can only be used in combination with --extern")
+ if $opt_socket;
}
$path_timefile= "$opt_vardir/log/mysqltest-time";
@@ -1260,7 +1250,7 @@ sub set_mtr_build_thread_ports($) {
}
-sub datadir_setup () {
+sub datadir_list_setup () {
# Make a list of all data_dirs
@data_dir_lst = (
@@ -1290,26 +1280,15 @@ sub datadir_setup () {
sub collect_mysqld_features () {
- #
- # Execute "mysqld --no-defaults --help --verbose", that will
- # print out version and a list of all features and settings
- #
my $found_variable_list_start= 0;
- my $spec_file= "$glob_mysql_test_dir/mysqld.spec.$$";
- if ( mtr_run($exe_mysqld,
- ["--no-defaults",
- "--verbose",
- "--help"],
- "", "$spec_file", "$spec_file", "") != 0 )
- {
- mtr_error("Failed to get version and list of features from %s",
- $exe_mysqld);
- }
- my $F= IO::File->new($spec_file) or
- mtr_error("can't open file \"$spec_file\": $!");
+ #
+ # Execute "mysqld --no-defaults --help --verbose" to get a
+ # of all features and settings
+ #
+ my $list= `$exe_mysqld --no-defaults --verbose --help`;
- while ( my $line= <$F> )
+ foreach my $line (split('\n', $list))
{
# First look for version
if ( !$mysql_version_id )
@@ -1362,7 +1341,7 @@ sub collect_mysqld_features () {
}
}
}
- unlink($spec_file);
+
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
mtr_error("Could not find variabes list") unless $found_variable_list_start;
@@ -1465,7 +1444,15 @@ sub executable_setup () {
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
if ( $mysql_version_id >= 50100 )
{
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
+ $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
+ }
+ if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
+ {
+ $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
+ }
+ else
+ {
+ $exe_mysql_upgrade= "";
}
if ( ! $glob_win32 )
@@ -1476,6 +1463,10 @@ sub executable_setup () {
"$path_client_bindir/mysql_fix_privilege_tables");
}
+ # Look for mysql_fix_privilege_tables.sql script
+ $file_mysql_fix_privilege_tables=
+ mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
+ "$glob_basedir/share/mysql_fix_privilege_tables.sql");
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
{
@@ -1506,13 +1497,13 @@ sub executable_setup () {
if ( $glob_use_embedded_server )
{
$exe_mysqltest=
- mtr_exe_exists(vs_config_dirs('libmysqld/examples', 'mysqltest_embedded'),
- "$glob_basedir/libmysqld/examples/mysqltest_embedded",
+ mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
+ "$glob_basedir/libmysqld/examples/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
{
- $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
+ $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
# Look for mysql_client_test executable which may _not_ exist in
@@ -1591,6 +1582,33 @@ sub mysql_client_test_arguments()
return join(" ", $exe, @$args);
}
+sub mysql_upgrade_arguments()
+{
+ my $exe= $exe_mysql_upgrade;
+
+ my $args;
+ mtr_init_args(\$args);
+# if ( $opt_valgrind_mysql_ugrade )
+# {
+# valgrind_arguments($args, \$exe);
+# }
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=root");
+ mtr_add_arg($args, "--port=$master->[0]->{'port'}");
+ mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
+ mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}");
+ mtr_add_arg($args, "--basedir=$glob_basedir");
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args,
+ "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace");
+ }
+
+ return join(" ", $exe, @$args);
+}
+
# Note that some env is setup in spawn/run, in "mtr_process.pl"
sub environment_setup () {
@@ -1603,7 +1621,7 @@ sub environment_setup () {
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
# are used in favor of the system installed ones
# --------------------------------------------------------------------------
- if ( $opt_source_dist )
+ if ( $source_dist )
{
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
"$glob_basedir/libmysql_r/.libs/",
@@ -1635,9 +1653,17 @@ sub environment_setup () {
# impossible to add correct supressions, that means if "/usr/lib/debug"
# is available, it should be added to
# LD_LIBRARY_PATH
+ #
+ # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian
+ # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035),
+ # so don't change LD_LIBRARY_PATH on that platform.
# --------------------------------------------------------------------------
my $debug_libraries_path= "/usr/lib/debug";
- if ( $opt_valgrind and -d $debug_libraries_path )
+ my $deb_version;
+ if ( $opt_valgrind and -d $debug_libraries_path and
+ (! -e '/etc/debian_version' or
+ ($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or
+ $deb_version > 3.1 ) )
{
push(@ld_library_paths, $debug_libraries_path);
}
@@ -1661,7 +1687,7 @@ sub environment_setup () {
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
$ENV{'LC_COLLATE'}= "C";
- $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
+ $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
@@ -1674,6 +1700,7 @@ sub environment_setup () {
$ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
$ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
$ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
+ $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'};
$ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
$ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
@@ -1852,6 +1879,14 @@ sub environment_setup () {
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
# ----------------------------------------------------
+ # Setup env so childs can execute mysql_upgrade
+ # ----------------------------------------------------
+ if ( $mysql_version_id >= 50000 )
+ {
+ $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
+ }
+
+ # ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
if ( ! $glob_win32 )
@@ -1864,12 +1899,17 @@ sub environment_setup () {
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
}
+ $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
# ----------------------------------------------------
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqladmin
+ # ----------------------------------------------------
+ $ENV{'MYSQLADMIN'}= $exe_mysqladmin;
# ----------------------------------------------------
# Setup env so childs can execute perror
@@ -1964,29 +2004,23 @@ sub kill_running_servers () {
# This is different from terminating processes we have
# started from this run of the script, this is terminating
# leftovers from previous runs.
-
- if ( ! -d $opt_vardir )
- {
- if ( -l $opt_vardir and ! -d readlink($opt_vardir) )
- {
- mtr_report("Removing $opt_vardir symlink without destination");
- unlink($opt_vardir);
- }
- # The "var" dir does not exist already
- # the processes that mtr_kill_leftovers start will write
- # their log files to var/log so it should be created
- mkpath("$opt_vardir/log");
- }
mtr_kill_leftovers();
}
}
-sub cleanup_stale_files () {
-
- my $created_by_mem_file= "$glob_mysql_test_dir/var/created_by_mem";
+#
+# Remove var and any directories in var/ created by previous
+# tests
+#
+sub remove_stale_vardir () {
mtr_report("Removing Stale Files");
+ # Safety!
+ mtr_error("No, don't remove the vardir when running with --extern")
+ if $opt_extern;
+
+ mtr_verbose("opt_vardir: $opt_vardir");
if ( $opt_vardir eq $default_vardir )
{
#
@@ -1995,29 +2029,47 @@ sub cleanup_stale_files () {
if ( -l $opt_vardir)
{
# var is a symlink
- if (-f $created_by_mem_file)
+
+ if ( $opt_mem and readlink($opt_vardir) eq $opt_mem )
{
# Remove the directory which the link points at
+ mtr_verbose("Removing " . readlink($opt_vardir));
rmtree(readlink($opt_vardir));
- # Remove the entire "var" dir
- rmtree("$opt_vardir/");
+
# Remove the "var" symlink
+ mtr_verbose("unlink($opt_vardir)");
+ unlink($opt_vardir);
+ }
+ elsif ( $opt_mem )
+ {
+ # Just remove the "var" symlink
+ mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
+
+ mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir);
}
else
{
# Some users creates a soft link in mysql-test/var to another area
- # - allow it
+ # - allow it, but remove all files in it
+
mtr_report("WARNING: Using the 'mysql-test/var' symlink");
- rmtree("$opt_vardir/log");
- rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
- rmtree("$opt_vardir/run");
- rmtree("$opt_vardir/tmp");
+
+ # Make sure the directory where it points exist
+ mtr_error("The destination for symlink $opt_vardir does not exist")
+ if ! -d readlink($opt_vardir);
+
+ foreach my $bin ( glob("$opt_vardir/*") )
+ {
+ mtr_verbose("Removing bin $bin");
+ rmtree($bin);
+ }
}
}
else
{
# Remove the entire "var" dir
+ mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
}
}
@@ -2029,21 +2081,56 @@ sub cleanup_stale_files () {
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
+ mtr_verbose("Removing $default_vardir");
rmtree($default_vardir);
# Remove the "var" dir
+ mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
}
+}
+
+#
+# Create var and the directories needed in var
+#
+sub setup_vardir() {
+ mtr_report("Creating Directories");
+
+ if ( $opt_vardir eq $default_vardir )
+ {
+ #
+ # Running with "var" in mysql-test dir
+ #
+ if ( -l $opt_vardir )
+ {
+ # it's a symlink
+
+ # Make sure the directory where it points exist
+ mtr_error("The destination for symlink $opt_vardir does not exist")
+ if ! -d readlink($opt_vardir);
+ }
+ elsif ( $opt_mem )
+ {
+ # Runinng with "var" as a link to some "memory" location, normally tmpfs
+ mtr_verbose("Creating $opt_mem");
+ mkpath($opt_mem);
+
+ mtr_report("Symlinking 'var' to '$opt_mem'");
+ symlink($opt_mem, $opt_vardir);
+ }
+ }
- if ( $opt_mem )
+ if ( ! -d $opt_vardir )
{
- # Runinng with var as a link to some "memory" location, normally tmpfs
- rmtree($opt_mem);
- mkpath($opt_mem);
- mtr_report("Creating symlink from $opt_vardir to $opt_mem");
- symlink($opt_mem, $opt_vardir);
- # Put a small file to recognize this dir was created by --mem
- mtr_tofile($created_by_mem_file, $opt_mem);
+ mtr_verbose("Creating $opt_vardir");
+ mkpath($opt_vardir);
+ }
+
+ # Ensure a proper error message if vardir couldn't be created
+ unless ( -d $opt_vardir and -w $opt_vardir )
+ {
+ mtr_error("Writable 'var' directory is needed, use the " .
+ "'--vardir=<path>' option");
}
mkpath("$opt_vardir/log");
@@ -2051,10 +2138,9 @@ sub cleanup_stale_files () {
mkpath("$opt_vardir/tmp");
mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
- # Remove old and create new data dirs
+ # Create new data dirs
foreach my $data_dir (@data_dir_lst)
{
- rmtree("$data_dir");
mkpath("$data_dir/mysql");
mkpath("$data_dir/test");
}
@@ -2568,7 +2654,7 @@ sub run_suite () {
mtr_print_line();
if ( ! $glob_debugger and
- ! $glob_use_running_server and
+ ! $opt_extern and
! $glob_use_embedded_server )
{
stop_all_servers();
@@ -2597,23 +2683,41 @@ sub run_suite () {
sub initialize_servers () {
- datadir_setup();
+ datadir_list_setup();
- if ( ! $glob_use_running_server )
+ if ( $opt_extern )
+ {
+ # Running against an already started server, if the specified
+ # vardir does not already exist it should be created
+ if ( ! -d $opt_vardir )
+ {
+ mtr_report("Creating '$opt_vardir'");
+ setup_vardir();
+ }
+ else
+ {
+ mtr_report("No need to create '$opt_vardir' it already exists");
+ }
+ }
+ else
{
kill_running_servers();
if ( ! $opt_start_dirty )
{
- cleanup_stale_files();
+ remove_stale_vardir();
+ setup_vardir();
+
mysql_install_db();
if ( $opt_force )
{
+ # Save a snapshot of the freshly installed db
+ # to make it possible to restore to a known point in time
save_installed_db();
}
}
- check_running_as_root();
}
+ check_running_as_root();
}
sub mysql_install_db () {
@@ -2980,26 +3084,15 @@ sub do_before_run_mysqltest($)
unlink("$result_dir/$tname.log");
unlink("$result_dir/$tname.warnings");
- mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
-
- # output current test to ndbcluster log file to enable diagnostics
- mtr_tofile($path_ndb_testrun_log,"CURRENT TEST $tname\n");
-
- mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
- if ( $master->[1]->{'pid'} )
- {
- mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
- }
-
if ( $mysql_version_id < 50000 )
{
- # Set envirnoment variable NDB_STATUS_OK to 1
+ # Set environment variable NDB_STATUS_OK to 1
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "1";
}
elsif ( $mysql_version_id < 50100 )
{
- # Set envirnoment variable NDB_STATUS_OK to YES
+ # Set environment variable NDB_STATUS_OK to YES
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "YES";
}
@@ -3010,9 +3103,9 @@ sub do_after_run_mysqltest($)
my $tinfo= shift;
my $tname= $tinfo->{'name'};
- mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
-
# Save info from this testcase run to mysqltest.log
+ mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
+ if -f $path_current_test_log;
mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
if -f $path_timefile;
@@ -3022,6 +3115,26 @@ sub do_after_run_mysqltest($)
}
+sub run_testcase_mark_logs($)
+{
+ my ($log_msg)= @_;
+
+ # Write a marker to all log files
+
+ # The file indicating current test name
+ mtr_tonewfile($path_current_test_log, $log_msg);
+
+ # each mysqld's .err file
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ mtr_tofile($mysqld->{path_myerr}, $log_msg);
+ }
+
+ # ndbcluster log file
+ mtr_tofile($path_ndb_testrun_log, $log_msg);
+
+}
+
sub find_testcase_skipped_reason($)
{
my ($tinfo)= @_;
@@ -3123,7 +3236,7 @@ sub run_testcase ($) {
# -------------------------------------------------------
$ENV{'TZ'}= $tinfo->{'timezone'};
- mtr_verbose("Starting server with timezone: $tinfo->{'timezone'}");
+ mtr_verbose("Setting timezone: $tinfo->{'timezone'}");
my $master_restart= run_testcase_need_master_restart($tinfo);
my $slave_restart= run_testcase_need_slave_restart($tinfo);
@@ -3131,7 +3244,7 @@ sub run_testcase ($) {
if ($master_restart or $slave_restart)
{
# Can't restart a running server that may be in use
- if ( $glob_use_running_server )
+ if ( $opt_extern )
{
mtr_report_test_name($tinfo);
$tinfo->{comment}= "Can't restart a running server";
@@ -3141,6 +3254,10 @@ sub run_testcase ($) {
run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
}
+
+ # Write to all log files to indicate start of testcase
+ run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n");
+
my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart)
{
@@ -3293,7 +3410,7 @@ sub report_failure_and_restart ($) {
my $tinfo= shift;
mtr_report_test_failed($tinfo);
- mtr_show_failed_diff($tinfo->{'name'});
+ mtr_show_failed_diff($tinfo->{'result_file'});
print "\n";
if ( $opt_force )
{
@@ -3310,7 +3427,7 @@ sub report_failure_and_restart ($) {
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
print "To continue, re-run with '--force'.\n";
if ( ! $glob_debugger and
- ! $glob_use_running_server and
+ ! $opt_extern and
! $glob_use_embedded_server )
{
stop_all_servers();
@@ -3482,6 +3599,17 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
+
+ if ( $mysql_version_id <= 50106 )
+ {
+ # Force mysqld to use log files up until 5.1.6
+ mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
+ }
+ else
+ {
+ # Turn on logging, will be sent to tables
+ mtr_add_arg($args, "%s--log=", $prefix);
+ }
}
if ( $type eq 'slave' )
@@ -3499,8 +3627,6 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--log-slave-updates", $prefix);
}
- mtr_add_arg($args, "%s--log=%s", $prefix,
- $slave->[$idx]->{'path_mylog'});
mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
mtr_add_arg($args, "%s--pid-file=%s", $prefix,
$slave->[$idx]->{'path_pid'});
@@ -3561,6 +3687,18 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
+
+ if ( $mysql_version_id <= 50106 )
+ {
+ # Force mysqld to use log files up until 5.1.6
+ mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
+ }
+ else
+ {
+ # Turn on logging, will be sent to tables
+ mtr_add_arg($args, "%s--log=", $prefix);
+ }
+
} # end slave
if ( $opt_debug )
@@ -3637,7 +3775,6 @@ sub mysqld_arguments ($$$$$) {
elsif ( $type eq 'master' )
{
mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
- mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
}
return $args;
@@ -3886,10 +4023,17 @@ sub run_testcase_need_master_restart($)
}
elsif( ! $master->[0]->{'pid'} )
{
- $do_restart= 1;
- mtr_verbose("Restart master: master is not started");
+ if ( $opt_extern )
+ {
+ $do_restart= 0;
+ mtr_verbose("No restart: using extern master");
+ }
+ else
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: master is not started");
+ }
}
-
return $do_restart;
}
@@ -4135,8 +4279,6 @@ sub run_testcase_start_servers($) {
return 1;
}
}
- mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
-
mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
}
@@ -4164,8 +4306,6 @@ sub run_testcase_start_servers($) {
# ----------------------------------------------------------------------
if ( $tinfo->{'slave_num'} )
{
- mtr_tofile($slave->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
-
restore_slave_databases($tinfo->{'slave_num'});
do_before_start_slave($tinfo);
@@ -4380,11 +4520,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
}
- if ( $opt_big_test )
- {
- mtr_add_arg($args, "--big-test");
- }
-
if ( $opt_compress )
{
mtr_add_arg($args, "--compress");
@@ -4755,9 +4890,9 @@ Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored (default: ./var). Specifying a ramdisk or
tmpfs will speed up tests.
- mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
- Attempts to use DIR first if specified else
- uses as builtin list of standard locations
+ mem Run testsuite in "memory" using tmpfs or ramdisk
+ Attempts to find a suitable location
+ using a builtin list of standard locations
for tmpfs (/dev/shm)
The option can also be set using environment
variable MTR_MEM=[DIR]
@@ -4775,9 +4910,8 @@ Options to control what test suites or cases to run
skip-rpl Skip the replication test cases.
skip-im Don't start IM, and skip the IM test cases
skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
- big-test Pass "--big-test" to mysqltest which will set the
- environment variable BIG_TEST, which can be checked
- from test cases.
+ big-test Set the environment variable BIG_TEST, which can be
+ checked from test cases.
Options that specify ports
@@ -4799,10 +4933,11 @@ Options that pass on options
Options to run test on running server
- extern Use running server for tests FIXME DANGEROUS
+ extern Use running server for tests
ndb-connectstring=STR Use running cluster, and connect using STR
ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
- user=USER User for connect to server
+ user=USER User for connection to extern server
+ socket=PATH Socket for connection to extern server
Options for debugging the product
@@ -4851,23 +4986,15 @@ Misc options
unified-diff | udiff When presenting differences, use unified diff
testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
- suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
+ suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
+ warnings | log-warnings Pass --log-warnings to mysqld
+ sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
Deprecated options
with-openssl Deprecated option for ssl
-Options not yet described, or that I want to look into more
- local
- netware
- sleep=SECONDS
- socket=PATH
- user-test=s
- wait-timeout=SECONDS
- warnings
- log-warnings
-
HERE
mtr_exit(1);
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 5c50b3cd79d..d376b277c8a 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -541,6 +541,127 @@ create table t1 ( a timestamp );
alter table t1 add unique ( a(1) );
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
drop table t1;
+drop table if exists t1;
+create table t1 (a int, key(a));
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+"this used not to disable the index"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+alter table t1 enable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+alter table t1 enable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 add b char(10), disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+alter table t1 add c decimal(10,2), enable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+"this however did"
+alter table t1 disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+desc t1;
+Field Type Null Key Default Extra
+a bigint(20) YES MUL NULL
+b char(10) YES NULL
+c decimal(10,2) YES NULL
+alter table t1 add d decimal(15,5);
+"The key should still be disabled"
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+drop table t1;
+"Now will test with one unique index"
+create table t1(a int, b char(10), unique(a));
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 enable keys;
+"If no copy on noop change, this won't touch the data file"
+"Unique index, no change"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+"Change the type implying data copy"
+"Unique index, no change"
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 modify a bigint;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 modify a int;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+drop table t1;
+"Now will test with one unique and one non-unique index"
+create table t1(a int, b char(10), unique(a), key(b));
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE
+alter table t1 disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE disabled
+alter table t1 enable keys;
+"If no copy on noop change, this won't touch the data file"
+"The non-unique index will be disabled"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE disabled
+alter table t1 enable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE
+"Change the type implying data copy"
+"The non-unique index will be disabled"
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE disabled
+"Change again the type, but leave the indexes as_is"
+alter table t1 modify a int;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE disabled
+"Try the same. When data is no copied on similar tables, this is noop"
+alter table t1 modify a int;
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 1 b 1 b A NULL NULL NULL YES BTREE disabled
+drop table t1;
create database mysqltest;
create table t1 (c1 int);
alter table t1 rename mysqltest.t1;
@@ -556,6 +677,17 @@ ERROR 3D000: No database selected
alter table test.t1 rename test.t1;
use test;
drop table t1;
+DROP TABLE IF EXISTS bug24219;
+DROP TABLE IF EXISTS bug24219_2;
+CREATE TABLE bug24219 (a INT, INDEX(a));
+SHOW INDEX FROM bug24219;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+bug24219 1 a 1 a A NULL NULL NULL YES BTREE
+ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
+SHOW INDEX FROM bug24219_2;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+bug24219_2 1 a 1 a A NULL NULL NULL YES BTREE disabled
+DROP TABLE bug24219_2;
create table t1 (mycol int(10) not null);
alter table t1 alter column mycol set default 0;
desc t1;
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index edc18319603..541a15561e2 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -341,3 +341,14 @@ select * from t1 where bigint_col='17666000000000000000';
bigint_col
17666000000000000000
drop table t1;
+
+bug 19955 -- mod is signed with bigint
+select cast(10000002383263201056 as unsigned) mod 50 as result;
+result
+6
+create table t1 (c1 bigint unsigned);
+insert into t1 values (10000002383263201056);
+select c1 mod 50 as result from t1;
+result
+6
+drop table t1;
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index bbe3aee1fb0..8c3631c2707 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -186,12 +186,12 @@ date format datetime
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
-10:20:10 %H:%i:%s 0000-00-00 10:20:10
-10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
-10:20:10 %T 0000-00-00 10:20:10
-10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
-10:20:10AM %r 0000-00-00 10:20:10
-10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
+10:20:10 %H:%i:%s 0000-00-00 00:00:00
+10:20:10 %h:%i:%s.%f 0000-00-00 00:00:00
+10:20:10 %T 0000-00-00 00:00:00
+10:20:10AM %h:%i:%s%p 0000-00-00 00:00:00
+10:20:10AM %r 0000-00-00 00:00:00
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 00:00:00
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
@@ -208,6 +208,13 @@ Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 10:20:10.440000'
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
date format date2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
@@ -248,12 +255,12 @@ date format time
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s 10:20:10
-10:20:10 %h:%i:%s.%f 10:20:10
-10:20:10 %T 10:20:10
-10:20:10AM %h:%i:%s%p 10:20:10
-10:20:10AM %r 10:20:10
-10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
+10:20:10 %H:%i:%s NULL
+10:20:10 %h:%i:%s.%f NULL
+10:20:10 %T NULL
+10:20:10AM %h:%i:%s%p NULL
+10:20:10AM %r NULL
+10:20:10.44AM %h:%i:%s.%f%p NULL
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -270,6 +277,13 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
date format time2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
@@ -279,12 +293,12 @@ date format time2
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s 10:20:10
-10:20:10 %h:%i:%s.%f 10:20:10
-10:20:10 %T 10:20:10
-10:20:10AM %h:%i:%s%p 10:20:10
-10:20:10AM %r 10:20:10
-10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
+10:20:10 %H:%i:%s NULL
+10:20:10 %h:%i:%s.%f NULL
+10:20:10 %T NULL
+10:20:10AM %h:%i:%s%p NULL
+10:20:10AM %r NULL
+10:20:10.44AM %h:%i:%s.%f%p NULL
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -301,6 +315,13 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
+Warnings:
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
+Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
2003-01-02 08:11:02.123456
@@ -571,4 +592,13 @@ DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s'
+select str_to_date('04 /30/2004', '%m /%d/%Y');
+str_to_date('04 /30/2004', '%m /%d/%Y')
+2004-04-30
+select str_to_date('04/30 /2004', '%m /%d /%Y');
+str_to_date('04/30 /2004', '%m /%d /%Y')
+2004-04-30
+select str_to_date('04/30/2004 ', '%m/%d/%Y ');
+str_to_date('04/30/2004 ', '%m/%d/%Y ')
+2004-04-30
"End of 4.1 tests"
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index aef49af6c62..e2aa3b4a3cc 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -104,3 +104,95 @@ a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table t1;
drop table t2;
+create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
+insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+insert into bug20691 (i) values (2);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+desc bug20691;
+Field Type Null Key Default Extra
+i int(11) YES NULL
+d datetime NO
+dn datetime NO 0000-00-00 00:00:00
+insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+insert into bug20691 (i) values (4);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+SET sql_mode = 'ALLOW_INVALID_DATES';
+insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
+Warnings:
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+SET sql_mode = 'STRICT_ALL_TABLES';
+insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
+ERROR HY000: Field 'd' doesn't have a default value
+select * from bug20691 order by i asc;
+i d dn
+1 0000-00-00 00:00:00 0000-00-00 00:00:00
+1 1975-07-10 07:10:03 1978-01-13 14:08:51
+1 0000-00-00 00:00:00 0000-00-00 00:00:00
+2 0000-00-00 00:00:00 0000-00-00 00:00:00
+3 0000-00-00 00:00:00 0000-00-00 00:00:00
+3 1975-07-10 07:10:03 1978-01-13 14:08:51
+3 0000-00-00 00:00:00 0000-00-00 00:00:00
+4 0000-00-00 00:00:00 0000-00-00 00:00:00
+5 0000-00-00 00:00:00 0000-00-00 00:00:00
+5 1975-07-10 07:10:03 1978-01-13 14:08:51
+5 0000-00-00 00:00:00 0000-00-00 00:00:00
+6 0000-00-00 00:00:00 0000-00-00 00:00:00
+6 1975-07-10 07:10:03 1978-01-13 14:08:51
+6 0000-00-00 00:00:00 0000-00-00 00:00:00
+drop table bug20691;
+SET sql_mode = '';
+create table bug20691 (
+a set('one', 'two', 'three') not null,
+b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
+c time not null,
+d date not null,
+e int not null,
+f long not null,
+g blob not null,
+h datetime not null,
+i decimal not null,
+x int);
+insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
+insert into bug20691 (x) values (2);
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+Warning 1364 Field 'c' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'e' doesn't have a default value
+Warning 1364 Field 'f' doesn't have a default value
+Warning 1364 Field 'g' doesn't have a default value
+Warning 1364 Field 'h' doesn't have a default value
+Warning 1364 Field 'i' doesn't have a default value
+insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
+insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+Warning 1364 Field 'b' doesn't have a default value
+Warning 1364 Field 'c' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'e' doesn't have a default value
+Warning 1364 Field 'f' doesn't have a default value
+Warning 1364 Field 'g' doesn't have a default value
+Warning 1364 Field 'h' doesn't have a default value
+Warning 1364 Field 'i' doesn't have a default value
+select * from bug20691 order by x asc;
+a b c d e f g h i x
+two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
+ small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
+two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
+ small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
+drop table bug20691;
+End of 5.0 tests.
diff --git a/mysql-test/r/fix_priv_tables.result b/mysql-test/r/fix_priv_tables.result
new file mode 100644
index 00000000000..e54330a5520
--- /dev/null
+++ b/mysql-test/r/fix_priv_tables.result
@@ -0,0 +1,36 @@
+drop table if exists t1,t1aa,t2aa;
+DROP DATABASE IF EXISTS testdb;
+CREATE DATABASE testdb;
+CREATE TABLE testdb.t1 (
+c1 INT,
+c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+CREATE VIEW testdb.v1 AS
+SELECT * FROM testdb.t1;
+GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
+SHOW GRANTS FOR 'show_view_tbl'@'localhost';
+Grants for show_view_tbl@localhost
+GRANT USAGE ON *.* TO 'show_view_tbl'@'localhost'
+GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO 'show_view_tbl'@'localhost'
+
+GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
+SHOW GRANTS FOR 'select_only_c1'@'localhost';
+Grants for select_only_c1@localhost
+GRANT USAGE ON *.* TO 'select_only_c1'@'localhost'
+GRANT SELECT (c1) ON `testdb`.`v1` TO 'select_only_c1'@'localhost'
+
+"after fix privs"
+SHOW GRANTS FOR 'show_view_tbl'@'localhost';
+Grants for show_view_tbl@localhost
+GRANT USAGE ON *.* TO 'show_view_tbl'@'localhost'
+GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO 'show_view_tbl'@'localhost'
+
+SHOW GRANTS FOR 'select_only_c1'@'localhost';
+Grants for select_only_c1@localhost
+GRANT USAGE ON *.* TO 'select_only_c1'@'localhost'
+GRANT SELECT (c1) ON `testdb`.`v1` TO 'select_only_c1'@'localhost'
+
+DROP USER 'show_view_tbl'@'localhost';
+DROP USER 'select_only_c1'@'localhost';
+DROP VIEW testdb.v1;
+DROP TABLE testdb.t1;
+DROP DATABASE testdb;
diff --git a/mysql-test/r/fix_priv_tabs.result b/mysql-test/r/fix_priv_tabs.result
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/r/fix_priv_tabs.result
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index c1ac3e191d3..5c6162b7c28 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -134,4 +134,11 @@ timediff(b, a) >= '00:00:03'
drop table t2;
drop table t1;
set global query_cache_size=default;
+create table t1 select INET_ATON('255.255.0.1') as `a`;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(21) unsigned default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index e8fd7a4e4c9..45c05f0b5b5 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1047,6 +1047,9 @@ union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
H
5
+select last_day('0000-00-00');
+last_day('0000-00-00')
+NULL
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
@@ -1201,3 +1204,6 @@ fmtddate field2
Sep-4 12:00AM abcd
DROP TABLE testBug8868;
SET NAMES DEFAULT;
+select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
+str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
+NULL
diff --git a/mysql-test/r/have_mysql_upgrade.result b/mysql-test/r/have_mysql_upgrade.result
new file mode 100644
index 00000000000..952bea420f9
--- /dev/null
+++ b/mysql-test/r/have_mysql_upgrade.result
@@ -0,0 +1,2 @@
+have_mysql_upgrade
+1
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 43eedc19f12..21d7bfb1b21 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1027,7 +1027,7 @@ CREATE PROCEDURE p1 ()
BEGIN
SELECT 'foo' FROM DUAL;
END |
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+ERROR 42000: Unknown database 'information_schema'
select ROUTINE_NAME from routines;
ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost';
diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result
index f90ee5913a1..f5ec0bdc932 100644
--- a/mysql-test/r/init_connect.result
+++ b/mysql-test/r/init_connect.result
@@ -132,7 +132,7 @@ x
17
19
drop trigger trg1;
-set global init_connect=default;
+set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1, t2;
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index 406a92b9a08..a1bf3d0e128 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -284,12 +284,15 @@ insert t1 values ('aaabbb');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+set @my_key_cache_block_size= @@global.key_cache_block_size;
set GLOBAL key_cache_block_size=2048;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+set global key_cache_block_size= @my_key_cache_block_size;
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET @my_key_cache_block_size= @@global.key_cache_block_size;
SET GLOBAL key_cache_block_size=1536;
INSERT INTO t1 VALUES (1);
SELECT @@key_cache_block_size;
@@ -331,6 +334,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
+set global key_cache_block_size= @my_key_cache_block_size;
set @@global.key_buffer_size=0;
Warnings:
Warning 1438 Cannot drop default keycache
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index be2776ef533..ac96ac8ff17 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -90,3 +90,4 @@ id select_type table type possible_keys key key_len ref rows Extra
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
28
+drop table t1;
diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result
index f610b959a47..ecb21261987 100644
--- a/mysql-test/r/lowercase_fs_off.result
+++ b/mysql-test/r/lowercase_fs_off.result
@@ -8,4 +8,5 @@ create database d2;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
+drop user 'sample'@'localhost';
drop database if exists d1;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 14267afc27e..3bba1944c52 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -36,6 +36,8 @@ Tables_in_test
t1
t2
t3
+Tables_in_test
+t1
_
Test delimiter : from command line
a
@@ -178,4 +180,8 @@ Too long dbname
ERROR 1049 (42000) at line 1: Unknown database 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
Too long hostname
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
+1
+1
+ERROR at line 1: DELIMITER cannot contain a backslash character
+ERROR at line 1: DELIMITER cannot contain a backslash character
End of 5.0 tests
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
new file mode 100644
index 00000000000..1f93d727561
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade.result
@@ -0,0 +1,127 @@
+Run mysql_upgrade once
+mysql.columns_priv OK
+mysql.db OK
+mysql.func OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+@hadGrantPriv:=1
+1
+1
+1
+1
+1
+@hadShowDbPriv:=1
+1
+1
+1
+1
+1
+@hadCreateViewPriv:=1
+1
+1
+1
+1
+1
+@hadCreateRoutinePriv:=1
+1
+1
+1
+1
+1
+@hadCreateUserPriv:=1
+1
+1
+1
+1
+1
+Run it again - should say already completed
+@hadGrantPriv:=1
+1
+1
+1
+1
+1
+@hadShowDbPriv:=1
+1
+1
+1
+1
+1
+@hadCreateViewPriv:=1
+1
+1
+1
+1
+1
+@hadCreateRoutinePriv:=1
+1
+1
+1
+1
+1
+@hadCreateUserPriv:=1
+1
+1
+1
+1
+1
+Force should run it regardless of wheter it's been run before
+mysql.columns_priv OK
+mysql.db OK
+mysql.func OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+@hadGrantPriv:=1
+1
+1
+1
+1
+1
+@hadShowDbPriv:=1
+1
+1
+1
+1
+1
+@hadCreateViewPriv:=1
+1
+1
+1
+1
+1
+@hadCreateRoutinePriv:=1
+1
+1
+1
+1
+1
+@hadCreateUserPriv:=1
+1
+1
+1
+1
+1
diff --git a/mysql-test/r/mysqladmin.result b/mysql-test/r/mysqladmin.result
new file mode 100644
index 00000000000..57927f8aa67
--- /dev/null
+++ b/mysql-test/r/mysqladmin.result
@@ -0,0 +1,4 @@
+mysqld is alive
+mysqladmin: unknown variable 'database=db1'
+Warning: mysqladmin: unknown variable 'loose-database=db2'
+mysqld is alive
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 54583febbc8..35a79d6a805 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -3089,7 +3089,7 @@ drop user mysqltest_1@localhost;
#
create database mysqldump_myDB;
use mysqldump_myDB;
-create user myDB_User;
+create user myDB_User@localhost;
grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
@@ -3102,7 +3102,7 @@ drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User;
+drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;
# Bug #21424 continues from here.
@@ -3120,7 +3120,7 @@ drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User;
+drop user myDB_User@localhost;
drop database mysqldump_myDB;
use test;
#
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 1cfc482416e..12a35fcf48b 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -512,6 +512,12 @@ mysqltest: At line 1: End of line junk detected: "write_file filename ";
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
+mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
+mysqltest: At line 1: You must write a 4 digit octal number for mode
+mysqltest: At line 1: You must write a 4 digit octal number for mode
+mysqltest: At line 1: Missing required argument 'file' to command 'chmod'
+mysqltest: At line 1: You must write a 4 digit octal number for mode
+mysqltest: At line 1: You must write a 4 digit octal number for mode
hello
hello
hello
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index 1a1991a6255..69d25fbef6f 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -39,6 +39,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
insert into t1 values(1);
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+drop temporary table ttt;
+ERROR 42S02: Unknown table 'ttt'
+drop temporary table if exists ttt;
+Warnings:
+Note 1051 Unknown table 'ttt'
drop table t1,t2;
drop user test@localhost;
set global read_only=0;
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index e33201ced93..080ef436a2e 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -8,7 +8,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
change master to master_host='127.0.0.1';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 test MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
+# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock.result
index bea7fd81616..116c34a4d96 100644
--- a/mysql-test/r/rpl_deadlock.result
+++ b/mysql-test/r/rpl_deadlock.result
@@ -130,6 +130,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
stop slave;
delete from t3;
@@ -186,3 +187,4 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
drop table t1,t2,t3,t4;
+set global max_relay_log_size= @my_max_relay_log_size;
diff --git a/mysql-test/r/rpl_drop_db.result b/mysql-test/r/rpl_drop_db.result
index ce9d39e87f6..97a24d980b6 100644
--- a/mysql-test/r/rpl_drop_db.result
+++ b/mysql-test/r/rpl_drop_db.result
@@ -33,3 +33,5 @@ n
1234
drop table t1;
stop slave;
+drop database mysqltest1;
+drop database mysqltest1;
diff --git a/mysql-test/r/rpl_ignore_revoke.result b/mysql-test/r/rpl_ignore_revoke.result
index 42625119f28..b1ccd2f0442 100644
--- a/mysql-test/r/rpl_ignore_revoke.result
+++ b/mysql-test/r/rpl_ignore_revoke.result
@@ -27,3 +27,4 @@ select_priv
Y
revoke select on *.* FROM 'user_foo';
delete from mysql.user where user="user_foo";
+delete from mysql.user where user="user_foo";
diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result
index 83d0a3289a2..f92fb9b4c1d 100644
--- a/mysql-test/r/rpl_init_slave.result
+++ b/mysql-test/r/rpl_init_slave.result
@@ -17,8 +17,11 @@ init_slave
show variables like 'max_connections';
Variable_name Value
max_connections 100
+set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
stop slave;
+set global init_connect= @my_global_init_connect;
+set global max_connections= default;
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result
index 1fa49db6013..95c9ae79d05 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_max_relay_size.result
@@ -14,6 +14,7 @@ reset slave;
#
# Test 1
#
+set @my_max_binlog_size= @@global.max_binlog_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
select @@global.max_relay_log_size;
@@ -266,6 +267,7 @@ File master-bin.000002
Position 98
Binlog_Do_DB
Binlog_Ignore_DB
+set global max_binlog_size= @my_max_binlog_size;
#
# End of 4.1 tests
#
diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result
index 7b096b27733..a0464e97e28 100644
--- a/mysql-test/r/rpl_sp.result
+++ b/mysql-test/r/rpl_sp.result
@@ -465,3 +465,27 @@ RETURN 0
DROP PROCEDURE p1;
DROP FUNCTION f1;
drop table t1;
+set global log_bin_trust_function_creators=0;
+set global log_bin_trust_function_creators=0;
+reset master;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+create database mysqltest;
+create database mysqltest2;
+use mysqltest2;
+create table t ( t integer );
+create procedure mysqltest.test() begin end;
+insert into t values ( 1 );
+show binlog events in 'master-bin.000001' from 98;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 98 Query 1 199 drop database if exists mysqltest
+master-bin.000001 199 Query 1 302 drop database if exists mysqltest2
+master-bin.000001 302 Query 1 395 create database mysqltest
+master-bin.000001 395 Query 1 490 create database mysqltest2
+master-bin.000001 490 Query 1 587 use `mysqltest2`; create table t ( t integer )
+master-bin.000001 587 Query 1 726 use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
+master-bin.000001 726 Query 1 821 use `mysqltest2`; insert into t values ( 1 )
+create procedure `\\`.test() begin end;
+ERROR 42000: Incorrect database name '\\'
+drop database mysqltest;
+drop database mysqltest2;
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
index 96a892f00fc..fde8709843e 100644
--- a/mysql-test/r/rpl_timezone.result
+++ b/mysql-test/r/rpl_timezone.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+set @my_time_zone= @@global.time_zone;
set timestamp=100000000;
create table t1 (t timestamp);
create table t2 (t char(32));
@@ -126,3 +127,4 @@ t
2003-12-31 23:00:00
2005-01-01 08:00:00
drop table t1, t2;
+set global time_zone= @my_time_zone;
diff --git a/mysql-test/r/rpl_variables.result b/mysql-test/r/rpl_variables.result
index 25b5ca13f77..6c532e33983 100644
--- a/mysql-test/r/rpl_variables.result
+++ b/mysql-test/r/rpl_variables.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+set @my_slave_net_timeout =@@global.slave_net_timeout;
set global slave_net_timeout=100;
set global sql_slave_skip_counter=100;
show variables like 'slave_compressed_protocol';
@@ -15,3 +16,4 @@ slave_load_tmpdir SLAVE_LOAD_TMPDIR
show variables like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
+set global slave_net_timeout =@my_slave_net_timeout;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 1bb4b3a405b..9db4325aea2 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -2705,11 +2705,11 @@ row_count()
call bug4905()|
select row_count()|
row_count()
-0
+-1
call bug4905()|
select row_count()|
row_count()
-0
+-1
select * from t3|
s1
1
@@ -5627,4 +5627,85 @@ Called B
drop procedure proc_21462_a|
drop procedure proc_21462_b|
End of 5.0 tests
+DROP TABLE IF EXISTS bug23760|
+DROP TABLE IF EXISTS bug23760_log|
+DROP PROCEDURE IF EXISTS bug23760_update_log|
+DROP PROCEDURE IF EXISTS bug23760_test_row_count|
+DROP FUNCTION IF EXISTS bug23760_rc_test|
+CREATE TABLE bug23760 (
+id INT NOT NULL AUTO_INCREMENT ,
+num INT NOT NULL ,
+PRIMARY KEY ( id )
+)|
+CREATE TABLE bug23760_log (
+id INT NOT NULL AUTO_INCREMENT ,
+reason VARCHAR(50)NULL ,
+ammount INT NOT NULL ,
+PRIMARY KEY ( id )
+)|
+CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
+BEGIN
+INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
+END|
+CREATE PROCEDURE bug23760_test_row_count()
+BEGIN
+UPDATE bug23760 SET num = num + 1;
+CALL bug23760_update_log('Test is working', ROW_COUNT());
+UPDATE bug23760 SET num = num - 1;
+END|
+CREATE PROCEDURE bug23760_test_row_count2(level INT)
+BEGIN
+IF level THEN
+UPDATE bug23760 SET num = num + 1;
+CALL bug23760_update_log('Test2 is working', ROW_COUNT());
+CALL bug23760_test_row_count2(level - 1);
+END IF;
+END|
+CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
+INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
+SELECT ROW_COUNT()|
+ROW_COUNT()
+7
+CALL bug23760_test_row_count()|
+SELECT * FROM bug23760_log ORDER BY id|
+id reason ammount
+1 Test is working 7
+SET @save_max_sp_recursion= @@max_sp_recursion_depth|
+SELECT @save_max_sp_recursion|
+@save_max_sp_recursion
+0
+SET max_sp_recursion_depth= 5|
+SELECT @@max_sp_recursion_depth|
+@@max_sp_recursion_depth
+5
+CALL bug23760_test_row_count2(2)|
+SELECT ROW_COUNT()|
+ROW_COUNT()
+1
+SELECT * FROM bug23760_log ORDER BY id|
+id reason ammount
+1 Test is working 7
+2 Test2 is working 7
+3 Test2 is working 7
+SELECT * FROM bug23760 ORDER by ID|
+id num
+1 2
+2 3
+3 3
+4 4
+5 5
+6 7
+7 10
+SET max_sp_recursion_depth= @save_max_sp_recursion|
+SELECT bug23760_rc_test(123)|
+bug23760_rc_test(123)
+123
+INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
+SELECT bug23760_rc_test(ROW_COUNT())|
+bug23760_rc_test(ROW_COUNT())
+4
+DROP TABLE bug23760, bug23760_log|
+DROP PROCEDURE bug23760_update_log|
+DROP PROCEDURE bug23760_test_row_count|
+DROP FUNCTION bug23760_rc_test|
drop table t1,t2;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 6790ae2c67d..2c794fe8f58 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -264,7 +264,7 @@ a decimal(21,2) NO 0.00
drop table t1,t2,t3;
select 1e-308, 1.00000001e-300, 100000000e-300;
1e-308 1.00000001e-300 100000000e-300
-0 1.00000001e-300 1e-292
+1e-308 1.00000001e-300 1e-292
select 10e307;
10e307
1e+308
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 396f1efa1b7..eb5d771bcfe 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -194,3 +194,38 @@ DROP FUNCTION sequence;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
+CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+select
+is_const(3) as const,
+is_const(3.14) as const,
+is_const('fnord') as const,
+is_const(2+3) as const,
+is_const(rand()) as 'nc rand()',
+is_const(sin(3.14)) as const,
+is_const(upper('test')) as const;
+const const const const nc rand() const const
+const const const const not const const const
+create table bug18761 (n int);
+insert into bug18761 values (null),(2);
+select
+is_const(3) as const,
+is_const(3.14) as const,
+is_const('fnord') as const,
+is_const(2+3) as const,
+is_const(2+n) as 'nc 2+n ',
+is_const(sin(n)) as 'nc sin(n)',
+is_const(sin(3.14)) as const,
+is_const(upper('test')) as const,
+is_const(rand()) as 'nc rand()',
+is_const(n) as 'nc n ',
+is_const(is_const(n)) as 'nc ic?(n)',
+is_const(is_const('c')) as const
+from
+bug18761;
+const const const const nc 2+n nc sin(n) const const nc rand() nc n nc ic?(n) const
+const const const const not const not const const const not const not const not const const
+const const const const not const not const const const not const not const not const const
+drop table bug18761;
+select is_const((1,2,3));
+ERROR 21000: Operand should contain 1 column(s)
+drop function if exists is_const;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index e62051df5cd..2b8a9c625a5 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -26,3 +26,55 @@ select x,xx from t1;
x xx
1 2
drop table t1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varbinary(255) default NULL,
+ `b` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select length(a), length(b) from t1;
+length(a) length(b)
+255 3
+255 3
+CHECK TABLE t1 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it!
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varbinary(255) default NULL,
+ `b` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select length(a), length(b) from t1;
+length(a) length(b)
+3 3
+3 3
+insert into t1 values("ccc", "ddd");
+select length(a), length(b) from t1;
+length(a) length(b)
+3 3
+3 3
+3 3
+select hex(a), hex(b) from t1;
+hex(a) hex(b)
+616161 636363
+626262 646464
+636363 646464
+select concat("'", a, "'"), concat("'", b, "'") from t1;
+concat("'", a, "'") concat("'", b, "'")
+'aaa' 'ccc'
+'bbb' 'ddd'
+'ccc' 'ddd'
+drop table t1;
+create table t1(a varbinary(255));
+insert into t1 values("aaa ");
+select length(a) from t1;
+length(a)
+6
+alter table t1 modify a varchar(255);
+select length(a) from t1;
+length(a)
+6
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 1e8aa1d05db..a802d83e9a2 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -544,13 +544,13 @@ CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
-GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly;
-GRANT SELECT ON mysqltest1.v_ts TO readonly;
-GRANT INSERT ON mysqltest1.v_ti TO readonly;
-GRANT UPDATE ON mysqltest1.v_tu TO readonly;
-GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly;
-GRANT DELETE ON mysqltest1.v_td TO readonly;
-GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost;
+GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost;
+GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost;
+GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost;
+GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
+GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
+GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
SELECT * FROM mysqltest1.v_t1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
INSERT INTO mysqltest1.v_t1 VALUES(4);
diff --git a/mysql-test/std_data/bug19371.MYD b/mysql-test/std_data/bug19371.MYD
new file mode 100644
index 00000000000..1b58a70832f
--- /dev/null
+++ b/mysql-test/std_data/bug19371.MYD
Binary files differ
diff --git a/mysql-test/std_data/bug19371.MYI b/mysql-test/std_data/bug19371.MYI
new file mode 100644
index 00000000000..06ee5b2d766
--- /dev/null
+++ b/mysql-test/std_data/bug19371.MYI
Binary files differ
diff --git a/mysql-test/std_data/bug19371.frm b/mysql-test/std_data/bug19371.frm
new file mode 100644
index 00000000000..7be45d6f8da
--- /dev/null
+++ b/mysql-test/std_data/bug19371.frm
Binary files differ
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index cfa6182543b..233726ce923 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -372,6 +372,103 @@ alter table t1 add unique ( a(1) );
drop table t1;
#
+# Bug #24395: ALTER TABLE DISABLE KEYS doesn't work when modifying the table
+#
+# This problem happens if the data change is compatible.
+# Changing to the same type is compatible for example.
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int, key(a));
+show indexes from t1;
+--echo "this used not to disable the index"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+
+alter table t1 enable keys;
+show indexes from t1;
+
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+
+alter table t1 enable keys;
+show indexes from t1;
+
+alter table t1 add b char(10), disable keys;
+show indexes from t1;
+
+alter table t1 add c decimal(10,2), enable keys;
+show indexes from t1;
+
+--echo "this however did"
+alter table t1 disable keys;
+show indexes from t1;
+
+desc t1;
+
+alter table t1 add d decimal(15,5);
+--echo "The key should still be disabled"
+show indexes from t1;
+
+drop table t1;
+
+--echo "Now will test with one unique index"
+create table t1(a int, b char(10), unique(a));
+show indexes from t1;
+alter table t1 disable keys;
+show indexes from t1;
+alter table t1 enable keys;
+
+--echo "If no copy on noop change, this won't touch the data file"
+--echo "Unique index, no change"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+
+--echo "Change the type implying data copy"
+--echo "Unique index, no change"
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+
+alter table t1 modify a bigint;
+show indexes from t1;
+
+alter table t1 modify a int;
+show indexes from t1;
+
+drop table t1;
+
+--echo "Now will test with one unique and one non-unique index"
+create table t1(a int, b char(10), unique(a), key(b));
+show indexes from t1;
+alter table t1 disable keys;
+show indexes from t1;
+alter table t1 enable keys;
+
+
+--echo "If no copy on noop change, this won't touch the data file"
+--echo "The non-unique index will be disabled"
+alter table t1 modify a int, disable keys;
+show indexes from t1;
+alter table t1 enable keys;
+show indexes from t1;
+
+--echo "Change the type implying data copy"
+--echo "The non-unique index will be disabled"
+alter table t1 modify a bigint, disable keys;
+show indexes from t1;
+
+--echo "Change again the type, but leave the indexes as_is"
+alter table t1 modify a int;
+show indexes from t1;
+--echo "Try the same. When data is no copied on similar tables, this is noop"
+alter table t1 modify a int;
+show indexes from t1;
+
+drop table t1;
+
+
+#
# Bug#11493 - Alter table rename to default database does not work without
# db name qualifying
#
@@ -402,6 +499,24 @@ alter table test.t1 rename test.t1;
use test;
drop table t1;
+#
+# Bug#24219 - ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash
+#
+--disable_warnings
+DROP TABLE IF EXISTS bug24219;
+DROP TABLE IF EXISTS bug24219_2;
+--enable_warnings
+
+CREATE TABLE bug24219 (a INT, INDEX(a));
+
+SHOW INDEX FROM bug24219;
+
+ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
+
+SHOW INDEX FROM bug24219_2;
+
+DROP TABLE bug24219_2;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 35cda11646a..6c1229db83f 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -278,4 +278,13 @@ select * from t1 where bigint_col=17666000000000000000;
select * from t1 where bigint_col='17666000000000000000';
drop table t1;
+--echo
+--echo bug 19955 -- mod is signed with bigint
+
+select cast(10000002383263201056 as unsigned) mod 50 as result;
+
+create table t1 (c1 bigint unsigned);
+insert into t1 values (10000002383263201056);
+select c1 mod 50 as result from t1;
+drop table t1;
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index a81487d273d..3054ec53faa 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -326,4 +326,12 @@ SELECT TIME_FORMAT("25:00:00", '%l %p');
#
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
+#
+# Bug #22029: str_to_date returning NULL
+#
+
+select str_to_date('04 /30/2004', '%m /%d/%Y');
+select str_to_date('04/30 /2004', '%m /%d /%Y');
+select str_to_date('04/30/2004 ', '%m/%d/%Y ');
+
--echo "End of 4.1 tests"
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index b5522394d2d..225ddbc3ee2 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -82,3 +82,61 @@ SELECT * from t2;
drop table t1;
drop table t2;
+
+#
+# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
+#
+# From the docs:
+# If the column can take NULL as a value, the column is defined with an
+# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
+#
+# If the column cannot take NULL as the value, MySQL defines the column with
+# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
+# statement includes no value for the column, MySQL handles the column
+# according to the SQL mode in effect at the time:
+#
+# * If strict SQL mode is not enabled, MySQL sets the column to the
+# implicit default value for the column data type.
+#
+# * If strict mode is enabled, an error occurs for transactional tables and
+# the statement is rolled back. For non-transactional tables, an error
+# occurs, but if this happens for the second or subsequent row of a
+# multiple-row statement, the preceding rows will have been inserted.
+#
+create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
+insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
+insert into bug20691 (i) values (2);
+desc bug20691;
+insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
+insert into bug20691 (i) values (4);
+insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
+SET sql_mode = 'ALLOW_INVALID_DATES';
+insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
+SET sql_mode = 'STRICT_ALL_TABLES';
+--error 1364
+insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
+select * from bug20691 order by i asc;
+drop table bug20691;
+
+SET sql_mode = '';
+create table bug20691 (
+ a set('one', 'two', 'three') not null,
+ b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
+ c time not null,
+ d date not null,
+ e int not null,
+ f long not null,
+ g blob not null,
+ h datetime not null,
+ i decimal not null,
+ x int);
+insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
+insert into bug20691 (x) values (2);
+insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
+insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
+select * from bug20691 order by x asc;
+drop table bug20691;
+
+###
+--echo End of 5.0 tests.
+
diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test
new file mode 100644
index 00000000000..3a91f41dfcc
--- /dev/null
+++ b/mysql-test/t/fix_priv_tables.test
@@ -0,0 +1,66 @@
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+
+#
+# This is the test for mysql_fix_privilege_tables
+# It checks that a system tables from mysql 4.1.23
+# can be upgraded to current system table format
+#
+# Note: If this test fails, don't be confused about the errors reported
+# by mysql-test-run This shows warnings generated by
+# mysql_fix_system_tables which should be ignored.
+# Instead, concentrate on the errors in r/system_mysql_db.reject
+
+--disable_warnings
+drop table if exists t1,t1aa,t2aa;
+--enable_warnings
+
+#
+# Bug #20589 Missing some table level privileges after upgrade
+#
+# Add some grants that should survive the "upgrade"
+
+--disable_warnings
+DROP DATABASE IF EXISTS testdb;
+--enable_warnings
+CREATE DATABASE testdb;
+CREATE TABLE testdb.t1 (
+ c1 INT,
+ c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+
+CREATE VIEW testdb.v1 AS
+ SELECT * FROM testdb.t1;
+
+GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
+SHOW GRANTS FOR 'show_view_tbl'@'localhost';
+echo;
+
+# Some extra GRANTS for more complete test
+GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
+SHOW GRANTS FOR 'select_only_c1'@'localhost';
+echo;
+
+-- disable_result_log
+-- disable_query_log
+
+# Run the mysql_fix_privilege_tables.sql using "mysql --force"
+--exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/fix_priv_tables.log 2>&1
+
+-- enable_query_log
+-- enable_result_log
+
+echo "after fix privs";
+
+SHOW GRANTS FOR 'show_view_tbl'@'localhost';
+echo;
+SHOW GRANTS FOR 'select_only_c1'@'localhost';
+echo;
+
+DROP USER 'show_view_tbl'@'localhost';
+DROP USER 'select_only_c1'@'localhost';
+
+DROP VIEW testdb.v1;
+DROP TABLE testdb.t1;
+DROP DATABASE testdb;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 52a5512d070..5cac6c45f65 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -125,4 +125,11 @@ drop table t2;
drop table t1;
set global query_cache_size=default;
+#
+# Bug #21466: INET_ATON() returns signed, not unsigned
+#
+
+create table t1 select INET_ATON('255.255.0.1') as `a`;
+show create table t1;
+drop table t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index a3985998b13..a69cbb67c5b 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -564,6 +564,12 @@ union
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+#
+# Bug #23653: crash if last_day('0000-00-00')
+#
+
+select last_day('0000-00-00');
+
--echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
@@ -701,3 +707,9 @@ SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
DROP TABLE testBug8868;
SET NAMES DEFAULT;
+
+#
+# Bug #22229: bug in DATE_ADD()
+#
+
+select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index dd203add344..623ccee49e4 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -715,7 +715,7 @@ create temporary table schemata(f1 char(10));
# Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
#
delimiter |;
---error 1044
+--error ER_BAD_DB_ERROR
CREATE PROCEDURE p1 ()
BEGIN
SELECT 'foo' FROM DUAL;
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
index 31a98df33df..cf98f608982 100644
--- a/mysql-test/t/init_connect.test
+++ b/mysql-test/t/init_connect.test
@@ -232,7 +232,9 @@ connection con0;
disconnect con1;
drop trigger trg1;
-set global init_connect=default;
+# Set init connect back to the value provided in init_connect-master.opt
+# doesn't matter as server will be restarted
+set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
index 4001e0df4af..3044964ebc3 100644
--- a/mysql-test/t/key_cache.test
+++ b/mysql-test/t/key_cache.test
@@ -164,16 +164,19 @@ create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
check table t1;
+set @my_key_cache_block_size= @@global.key_cache_block_size;
set GLOBAL key_cache_block_size=2048;
check table t1;
-
drop table t1;
+# Restore the changed variable value
+set global key_cache_block_size= @my_key_cache_block_size;
#
# Bug #19079: corrupted index when key_cache_block_size is not multiple of
# myisam_block_size
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET @my_key_cache_block_size= @@global.key_cache_block_size;
SET GLOBAL key_cache_block_size=1536;
INSERT INTO t1 VALUES (1);
SELECT @@key_cache_block_size;
@@ -206,6 +209,8 @@ SELECT COUNT(*) FROM t1;
SELECT @@key_cache_block_size;
CHECK TABLE t1;
DROP TABLE t1,t2;
+# Restore changed variables
+set global key_cache_block_size= @my_key_cache_block_size;
#
# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 2eb4e6cbbb2..bc599b20d36 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -69,5 +69,5 @@ explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
-
+drop table t1;
# End of 4.1 tests
diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test
index 883315994fe..414027cb485 100644
--- a/mysql-test/t/lowercase_fs_off.test
+++ b/mysql-test/t/lowercase_fs_off.test
@@ -21,6 +21,7 @@ create database D1;
disconnect sample;
connection master;
+drop user 'sample'@'localhost';
drop database if exists d1;
disconnect master;
connection default;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index cb4a5593de7..3d022eb27e4 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -241,4 +241,22 @@ drop table t17583;
--error 1
--exec $MYSQL test -e "\r test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
+#
+# Bug #21412: mysql cmdline client allows backslash(es)
+# as delimiter but can't recognize them
+#
+
+# This should work just fine...
+--exec echo "DELIMITER /" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
+--exec echo "SELECT 1/" >> $MYSQLTEST_VARDIR/tmp/bug21412.sql
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+
+# This should give an error...
+--exec echo "DELIMITER \\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+
+# As should this...
+--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql
index fa80c980b29..db679c3b06b 100644
--- a/mysql-test/t/mysql_delimiter.sql
+++ b/mysql-test/t/mysql_delimiter.sql
@@ -49,3 +49,13 @@ delimiter ; # Reset delimiter
# Bug #11523: \d works differently than delimiter
#
source t/mysql_delimiter_source.sql
+delimiter ; # Reset delimiter
+
+#
+# Bug #19799: delimiter command not working correctly when sourcing a sql file
+# with Windows style line endings.
+#
+source t/mysql_delimiter_19799.sql
+use test//
+show tables//
+delimiter ; # Reset delimiter
diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql
new file mode 100755
index 00000000000..2a3d4378492
--- /dev/null
+++ b/mysql-test/t/mysql_delimiter_19799.sql
@@ -0,0 +1 @@
+delimiter //
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
new file mode 100644
index 00000000000..4200ba844f7
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade.test
@@ -0,0 +1,20 @@
+# Only run test if "mysql_upgrade" is found
+--require r/have_mysql_upgrade.result
+--disable_query_log
+select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
+--enable_query_log
+
+#
+# Basic test thta we can run mysql_upgrde and that it finds the
+# expected binaries it uses.
+#
+--echo Run mysql_upgrade once
+--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
+
+--echo Run it again - should say already completed
+--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
+
+--echo Force should run it regardless of wheter it's been run before
+--exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
+
+
diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test
new file mode 100644
index 00000000000..7c016fd7416
--- /dev/null
+++ b/mysql-test/t/mysqladmin.test
@@ -0,0 +1,32 @@
+#
+# Test "mysqladmin ping"
+#
+
+--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
+
+
+#
+# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
+#
+
+# When mysqladmin finds database in .cnf file it shall fail
+--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
+[client]
+database=db1
+EOF
+
+--replace_regex /\/.*mysqladmin/mysqladmin/
+--error 7
+--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
+
+
+# When mysqladmin finds "loose-database" in .cnf file it shall print
+# a warning and continue
+--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
+[client]
+loose-database=db2
+EOF
+
+--replace_regex /Warning: .*mysqladmin/Warning: mysqladmin/
+--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
+
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 72aad395ec0..5e604061744 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1341,7 +1341,7 @@ connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
create database mysqldump_myDB;
use mysqldump_myDB;
-create user myDB_User;
+create user myDB_User@localhost;
grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
@@ -1364,7 +1364,7 @@ drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User;
+drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;
@@ -1389,7 +1389,7 @@ drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User;
+drop user myDB_User@localhost;
drop database mysqldump_myDB;
use test;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 3c20b38722f..c06d51d9d49 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1522,6 +1522,46 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
--exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
+# test for chmod
+# ----------------------------------------------------------------------------
+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+file1
+EOF
+
+chmod 0000 $MYSQLTEST_VARDIR/tmp/file1.tmp;
+# The below write fails, but --error is not implemented
+# for write_file
+#--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+#test should fail
+#EOF
+
+chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp;
+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+test2
+EOF
+
+remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
+
+--error 1
+--exec echo "chmod ;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "chmod 0 from_file;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "chmod 08 from_file;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "chmod from_file;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "chmod ABZD from_file;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "chmod 06789 from_file;" | $MYSQL_TEST 2>&1
+
+
+# ----------------------------------------------------------------------------
# test for perl
# ----------------------------------------------------------------------------
--perl
diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test
index 175a5bba6fa..8e14b310f4c 100644
--- a/mysql-test/t/read_only.test
+++ b/mysql-test/t/read_only.test
@@ -101,6 +101,18 @@ drop table t1;
--error 1290
insert into t1 values(1);
+#
+# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
+#
+# check if DROP TEMPORARY on a non-existing temporary table returns the right
+# error
+
+--error ER_BAD_TABLE_ERROR
+drop temporary table ttt;
+
+# check if DROP TEMPORARY TABLE IF EXISTS produces a warning with read_only set
+drop temporary table if exists ttt;
+
connection default;
drop table t1,t2;
drop user test@localhost;
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index df4bf6f977b..d61b7120fa1 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
---replace_result $MYSQL_TCP_PORT MASTER_PORT
+--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test
index 6c5f942cec9..db2a7ec3a8d 100644
--- a/mysql-test/t/rpl_deadlock.test
+++ b/mysql-test/t/rpl_deadlock.test
@@ -94,7 +94,7 @@ show slave status;
# Now we repeat 2), but with BEGIN in the same relay log as
# COMMIT (to see if seeking into hot log is ok).
-
+set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
@@ -119,5 +119,6 @@ show slave status;
connection master;
drop table t1,t2,t3,t4;
sync_slave_with_master;
+set global max_relay_log_size= @my_max_relay_log_size;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test
index 3ac0d593fee..f14c9bc0164 100644
--- a/mysql-test/t/rpl_drop_db.test
+++ b/mysql-test/t/rpl_drop_db.test
@@ -53,5 +53,10 @@ sync_slave_with_master;
#cleanup
connection slave;
stop slave;
-system rm -rf $MYSQLTEST_VARDIR/master-data/mysqltest1;
+drop database mysqltest1;
+
+connection master;
+# Remove the "extra" file created above
+--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
+drop database mysqltest1;
diff --git a/mysql-test/t/rpl_ignore_revoke.test b/mysql-test/t/rpl_ignore_revoke.test
index cdeb40df069..00171605a92 100644
--- a/mysql-test/t/rpl_ignore_revoke.test
+++ b/mysql-test/t/rpl_ignore_revoke.test
@@ -45,3 +45,7 @@ revoke select on *.* FROM 'user_foo';
connection master;
delete from mysql.user where user="user_foo";
sync_slave_with_master;
+
+# Since changes to mysql.* are ignored, the revoke need to
+# be done on slave as well
+delete from mysql.user where user="user_foo";
diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test
index cefb04a7b75..139b4902e12 100644
--- a/mysql-test/t/rpl_init_slave.test
+++ b/mysql-test/t/rpl_init_slave.test
@@ -17,6 +17,8 @@ show variables like 'max_connections';
save_master_pos;
connection slave;
sync_with_master;
+# Save variable value
+set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
connection master;
@@ -25,4 +27,8 @@ connection slave;
sync_with_master;
stop slave;
+# Restore changed global variable
+set global init_connect= @my_global_init_connect;
+set global max_connections= default;
+
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/t/rpl_max_relay_size.test
index be1fbf172fc..e5278ff5727 100644
--- a/mysql-test/t/rpl_max_relay_size.test
+++ b/mysql-test/t/rpl_max_relay_size.test
@@ -32,6 +32,7 @@ reset slave;
--echo # Test 1
--echo #
+set @my_max_binlog_size= @@global.max_binlog_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
@@ -127,6 +128,10 @@ connection master;
flush logs;
show master status;
+# Restore max_binlog_size
+connection slave;
+set global max_binlog_size= @my_max_binlog_size;
+
--echo #
--echo # End of 4.1 tests
--echo #
diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test
index 7479794eded..373b895a7c1 100644
--- a/mysql-test/t/rpl_sp.test
+++ b/mysql-test/t/rpl_sp.test
@@ -519,3 +519,31 @@ DROP FUNCTION f1;
connection master;
drop table t1;
sync_slave_with_master;
+
+# Restore log_bin_trust_function_creators to original value
+set global log_bin_trust_function_creators=0;
+connection master;
+set global log_bin_trust_function_creators=0;
+#
+# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS"
+#
+connection master;
+reset master;
+--disable_warnings
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+--enable_warnings
+create database mysqltest;
+create database mysqltest2;
+use mysqltest2;
+create table t ( t integer );
+create procedure mysqltest.test() begin end;
+insert into t values ( 1 );
+show binlog events in 'master-bin.000001' from 98;
+--error ER_WRONG_DB_NAME
+create procedure `\\`.test() begin end;
+# Clean up
+drop database mysqltest;
+drop database mysqltest2;
+
+
diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test
index 0f35c9dc0b6..6ed5b21ace0 100644
--- a/mysql-test/t/rpl_timezone.test
+++ b/mysql-test/t/rpl_timezone.test
@@ -12,6 +12,9 @@
source include/master-slave.inc;
+# Save original timezone
+set @my_time_zone= @@global.time_zone;
+
# Some preparations
let $VERSION=`select version()`;
set timestamp=100000000; # for fixed output of mysqlbinlog
@@ -124,3 +127,7 @@ drop table t1, t2;
sync_slave_with_master;
# End of 4.1 tests
+
+# Restore original timezone
+connection master;
+set global time_zone= @my_time_zone;
diff --git a/mysql-test/t/rpl_variables.test b/mysql-test/t/rpl_variables.test
index 57ae2b9c3c4..d0801e524e4 100644
--- a/mysql-test/t/rpl_variables.test
+++ b/mysql-test/t/rpl_variables.test
@@ -1,5 +1,8 @@
source include/master-slave.inc;
+# Init for rstore of variable values
+set @my_slave_net_timeout =@@global.slave_net_timeout;
+
set global slave_net_timeout=100;
set global sql_slave_skip_counter=100;
@@ -12,3 +15,6 @@ show variables like 'slave_load_tmpdir';
# We just set some arbitrary values in variables-master.opt so we can test
# that a list of values works correctly
show variables like 'slave_skip_errors';
+
+# Restore touched values
+set global slave_net_timeout =@my_slave_net_timeout;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index fc6e8714a65..524ee9cf66c 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6591,6 +6591,83 @@ drop procedure proc_21462_b|
#
+# BUG#23760: ROW_COUNT() and store procedure not owrking together
+#
+--disable_warnings
+DROP TABLE IF EXISTS bug23760|
+DROP TABLE IF EXISTS bug23760_log|
+DROP PROCEDURE IF EXISTS bug23760_update_log|
+DROP PROCEDURE IF EXISTS bug23760_test_row_count|
+DROP FUNCTION IF EXISTS bug23760_rc_test|
+--enable_warnings
+CREATE TABLE bug23760 (
+ id INT NOT NULL AUTO_INCREMENT ,
+ num INT NOT NULL ,
+ PRIMARY KEY ( id )
+)|
+
+CREATE TABLE bug23760_log (
+ id INT NOT NULL AUTO_INCREMENT ,
+ reason VARCHAR(50)NULL ,
+ ammount INT NOT NULL ,
+ PRIMARY KEY ( id )
+)|
+
+CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
+BEGIN
+ INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
+END|
+
+CREATE PROCEDURE bug23760_test_row_count()
+BEGIN
+ UPDATE bug23760 SET num = num + 1;
+ CALL bug23760_update_log('Test is working', ROW_COUNT());
+ UPDATE bug23760 SET num = num - 1;
+END|
+
+
+CREATE PROCEDURE bug23760_test_row_count2(level INT)
+BEGIN
+ IF level THEN
+ UPDATE bug23760 SET num = num + 1;
+ CALL bug23760_update_log('Test2 is working', ROW_COUNT());
+ CALL bug23760_test_row_count2(level - 1);
+ END IF;
+END|
+
+CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
+
+INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
+SELECT ROW_COUNT()|
+
+CALL bug23760_test_row_count()|
+SELECT * FROM bug23760_log ORDER BY id|
+
+SET @save_max_sp_recursion= @@max_sp_recursion_depth|
+SELECT @save_max_sp_recursion|
+SET max_sp_recursion_depth= 5|
+SELECT @@max_sp_recursion_depth|
+CALL bug23760_test_row_count2(2)|
+SELECT ROW_COUNT()|
+SELECT * FROM bug23760_log ORDER BY id|
+SELECT * FROM bug23760 ORDER by ID|
+SET max_sp_recursion_depth= @save_max_sp_recursion|
+
+SELECT bug23760_rc_test(123)|
+INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
+SELECT bug23760_rc_test(ROW_COUNT())|
+
+DROP TABLE bug23760, bug23760_log|
+DROP PROCEDURE bug23760_update_log|
+DROP PROCEDURE bug23760_test_row_count|
+DROP FUNCTION bug23760_rc_test|
+
+#
+# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
+# at the end of the file!
+#
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/mysql-test/t/system_mysql_db_fix-master.opt b/mysql-test/t/system_mysql_db_fix30020-master.opt
index 7e4fa9a3ee8..7e4fa9a3ee8 100644
--- a/mysql-test/t/system_mysql_db_fix-master.opt
+++ b/mysql-test/t/system_mysql_db_fix30020-master.opt
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix30020.test
index c50b641b7e2..b71ae6c2204 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix30020.test
@@ -6,9 +6,11 @@
#
# This is the test for mysql_fix_privilege_tables
+# It checks that a system tables from mysql 3.20
+# can be upgraded to current system table format
#
# Note: If this test fails, don't be confused about the errors reported
-# by mysql-test-run; This shows warnings from generated by
+# by mysql-test-run This shows warnings generated by
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
@@ -81,7 +83,7 @@ INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
--- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null
+-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1
-- enable_query_log
-- enable_result_log
diff --git a/mysql-test/t/system_mysql_db_fix40123-master.opt b/mysql-test/t/system_mysql_db_fix40123-master.opt
new file mode 100644
index 00000000000..7e4fa9a3ee8
--- /dev/null
+++ b/mysql-test/t/system_mysql_db_fix40123-master.opt
@@ -0,0 +1 @@
+--result-file=system_mysql_db
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
new file mode 100644
index 00000000000..471598625d4
--- /dev/null
+++ b/mysql-test/t/system_mysql_db_fix40123.test
@@ -0,0 +1,79 @@
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+
+#
+# This is the test for mysql_fix_privilege_tables
+# It checks that a system tables from mysql 4.1.23
+# can be upgraded to current system table format
+#
+# Note: If this test fails, don't be confused about the errors reported
+# by mysql-test-run This shows warnings generated by
+# mysql_fix_system_tables which should be ignored.
+# Instead, concentrate on the errors in r/system_mysql_db.reject
+
+--disable_warnings
+drop table if exists t1,t1aa,t2aa;
+--enable_warnings
+
+-- disable_result_log
+-- disable_query_log
+
+use test;
+
+# create system tables as in mysql-4.1.23
+# created by executing "./mysql_create_system_tables real ."
+
+set table_type=myisam;
+CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+
+CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+
+
+CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+ INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+
+CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
+
+
+CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+
+CREATE TABLE help_topic ( help_topic_id int unsigned not null, name varchar(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+CREATE TABLE help_category ( help_category_id smallint unsigned not null, name varchar(64) not null, parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
+CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name varchar(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
+
+CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+
+CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+
+CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+
+CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+
+CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+
+
+# Run the mysql_fix_privilege_tables.sql using "mysql --force"
+--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/system_mysql_db_fix40123.log 2>&1
+
+-- enable_query_log
+-- enable_result_log
+
+# Dump the tables that should be compared
+-- source include/system_db_struct.inc
+
+-- disable_query_log
+
+# Drop all tables created by this test
+DROP TABLE db, host, user, func, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
+
+-- enable_query_log
+
+# check that we dropped all system tables
+show tables;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 37358a292be..52ae424e423 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -187,4 +187,41 @@ DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
-
+#
+# Bug#18761: constant expression as UDF parameters not passed in as constant
+#
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
+select
+ is_const(3) as const,
+ is_const(3.14) as const,
+ is_const('fnord') as const,
+ is_const(2+3) as const,
+ is_const(rand()) as 'nc rand()',
+ is_const(sin(3.14)) as const,
+ is_const(upper('test')) as const;
+
+create table bug18761 (n int);
+insert into bug18761 values (null),(2);
+select
+ is_const(3) as const,
+ is_const(3.14) as const,
+ is_const('fnord') as const,
+ is_const(2+3) as const,
+ is_const(2+n) as 'nc 2+n ',
+ is_const(sin(n)) as 'nc sin(n)',
+ is_const(sin(3.14)) as const,
+ is_const(upper('test')) as const,
+ is_const(rand()) as 'nc rand()',
+ is_const(n) as 'nc n ',
+ is_const(is_const(n)) as 'nc ic?(n)',
+ is_const(is_const('c')) as const
+from
+ bug18761;
+drop table bug18761;
+
+--error 1241
+select is_const((1,2,3));
+
+drop function if exists is_const;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 5fbd116d7b8..0e45bfb5e1b 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -37,3 +37,46 @@ select x,xx from t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
+#
+
+# Test with a saved table from 4.1
+copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
+chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
+copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
+chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
+copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
+chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
+
+# Everything _looks_ fine
+show create table t1;
+
+# But the length of the varbinary columns are too long
+select length(a), length(b) from t1;
+
+# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
+CHECK TABLE t1 FOR UPGRADE;
+
+# Run REPAIR TABLE to alter the table and repair
+# the varbinary fields
+REPAIR TABLE t1;
+
+# Now check it's back to normal
+show create table t1;
+select length(a), length(b) from t1;
+insert into t1 values("ccc", "ddd");
+select length(a), length(b) from t1;
+select hex(a), hex(b) from t1;
+select concat("'", a, "'"), concat("'", b, "'") from t1;
+
+drop table t1;
+
+# Check that the fix does not affect table created with current version
+create table t1(a varbinary(255));
+insert into t1 values("aaa ");
+select length(a) from t1;
+alter table t1 modify a varchar(255);
+select length(a) from t1;
+
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index 6bb34a9fcef..67e0ab6bcbd 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -727,13 +727,13 @@ CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
-GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly;
-GRANT SELECT ON mysqltest1.v_ts TO readonly;
-GRANT INSERT ON mysqltest1.v_ti TO readonly;
-GRANT UPDATE ON mysqltest1.v_tu TO readonly;
-GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly;
-GRANT DELETE ON mysqltest1.v_td TO readonly;
-GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost;
+GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost;
+GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost;
+GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost;
+GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
+GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
+GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
CONNECT (n1,localhost,readonly,,);
CONNECTION n1;
@@ -791,7 +791,7 @@ DROP VIEW mysqltest1.v_ti;
DROP VIEW mysqltest1.v_ts;
DROP VIEW mysqltest1.v_t1;
DROP TABLE mysqltest1.t1;
-DROP USER readonly@localhost;
+DROP USER readonly@localhost;
DROP DATABASE mysqltest1;
#
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 7926cb916c1..b1a3e7441fb 100755
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -26,4 +26,5 @@ ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_m
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c
my_windac.c my_winsem.c my_winthread.c my_write.c ptr_cmp.c queues.c
rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
- thr_rwlock.c tree.c typelib.c base64.c my_memmem.c)
+ thr_rwlock.c tree.c typelib.c base64.c my_memmem.c
+ my_getpagesize.c)
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 041130fdf5c..47480e8f363 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -29,7 +29,7 @@ noinst_HEADERS = mysys_priv.h my_static.h \
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
- my_pread.c my_write.c \
+ my_pread.c my_write.c my_getpagesize.c \
mf_keycache.c mf_keycaches.c my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 95dc5afeae9..9b62482a404 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -59,11 +59,15 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1;
-static void default_reporter(enum loglevel level __attribute__((unused)),
+static void default_reporter(enum loglevel level,
const char *format, ...)
{
va_list args;
va_start(args, format);
+ if (level == WARNING_LEVEL)
+ fprintf(stderr, "%s", "Warning: ");
+ else if (level == INFORMATION_LEVEL)
+ fprintf(stderr, "%s", "Info: ");
vfprintf(stderr, format, args);
va_end(args);
}
diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c
new file mode 100644
index 00000000000..ac4bd775ba9
--- /dev/null
+++ b/mysys/my_getpagesize.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2000-2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "mysys_priv.h"
+
+#ifndef HAVE_GETPAGESIZE
+
+#if defined __WIN__
+
+int my_getpagesize(void)
+{
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ return si.dwPageSize;
+}
+
+#else
+
+/* Default implementation */
+int my_getpagesize(void)
+{
+ return (int)8192;
+}
+
+#endif
+
+#endif
+
diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c
index 21bfddae46c..eb74aaeaae4 100644
--- a/mysys/my_mmap.c
+++ b/mysys/my_mmap.c
@@ -33,13 +33,6 @@ int my_msync(int fd, void *addr, size_t len, int flags)
static SECURITY_ATTRIBUTES mmap_security_attributes=
{sizeof(SECURITY_ATTRIBUTES), 0, TRUE};
-int my_getpagesize(void)
-{
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- return si.dwPageSize;
-}
-
void *my_mmap(void *addr, size_t len, int prot,
int flags, int fd, my_off_t offset)
{
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index 073964d4bde..910992191f3 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -119,9 +119,6 @@ then
fi
cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
-if test ! -z "$password" ; then
- cmd="$cmd --password=$password"
-fi
if test ! -z "$port"; then
cmd="$cmd --port=$port"
fi
@@ -178,11 +175,22 @@ then
s_echo ""
fi
+run_cmd() {
+ # Password argument is added here to allow for spaces in password.
+
+ if test ! -z "$password"
+ then
+ cat $sql_file | $cmd --password="$password"
+ else
+ cat $sql_file | $cmd
+ fi
+}
+
if test $verbose = 0
then
- cat $sql_file | $cmd > /dev/null 2>&1
+ run_cmd > /dev/null 2>&1
else
- cat $sql_file | $cmd > /dev/null
+ run_cmd > /dev/null
fi
if test $? = 0
then
diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql
index 41d468fd3cf..5709fb96793 100644
--- a/scripts/mysql_fix_privilege_tables.sql
+++ b/scripts/mysql_fix_privilege_tables.sql
@@ -1,5 +1,5 @@
-- This script converts any old privilege tables to privilege tables suitable
--- for MySQL 4.0.
+-- for MySQL 4.1
-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
-- because these just mean that your tables are already up to date.
@@ -46,9 +46,8 @@ ADD x509_subject BLOB NOT NULL;
ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;
--
--- Create tables_priv and columns_priv if they don't exists
+-- tables_priv
--
-
CREATE TABLE IF NOT EXISTS tables_priv (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
@@ -56,22 +55,38 @@ CREATE TABLE IF NOT EXISTS tables_priv (
Table_name char(64) binary DEFAULT '' NOT NULL,
Grantor char(77) DEFAULT '' NOT NULL,
Timestamp timestamp(14),
- Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
- Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ Table_priv set('Select','Insert','Update','Delete','Create',
+ 'Drop','Grant','References','Index','Alter')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ Column_priv set('Select','Insert','Update','References')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name)
) CHARACTER SET utf8 COLLATE utf8_bin;
--- Fix collation of set fields
+
ALTER TABLE tables_priv
- modify Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
- modify Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
-ALTER TABLE procs_priv ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
-ALTER TABLE procs_priv
- modify Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
-ALTER TABLE procs_priv
- add Routine_type enum('FUNCTION','PROCEDURE') COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
-ALTER TABLE procs_priv
- modify Timestamp timestamp(14) AFTER Proc_priv;
+ ADD KEY Grantor (Grantor);
+ALTER TABLE tables_priv
+ MODIFY Host char(60) NOT NULL default '',
+ MODIFY Db char(64) NOT NULL default '',
+ MODIFY User char(16) NOT NULL default '',
+ MODIFY Table_name char(64) NOT NULL default '',
+ MODIFY Grantor char(77) NOT NULL default '',
+ ENGINE=MyISAM,
+ CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE tables_priv
+ MODIFY Column_priv set('Select','Insert','Update','References')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ MODIFY Table_priv set('Select','Insert','Update','Delete','Create',
+ 'Drop','Grant','References','Index','Alter',
+ 'Create View','Show view')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ COMMENT='Table privileges';
+
+--
+-- columns_priv
+--
CREATE TABLE IF NOT EXISTS columns_priv (
Host char(60) DEFAULT '' NOT NULL,
Db char(64) DEFAULT '' NOT NULL,
@@ -82,16 +97,25 @@ CREATE TABLE IF NOT EXISTS columns_priv (
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
) CHARACTER SET utf8 COLLATE utf8_bin;
--- Fix collation of set fields
-ALTER TABLE columns_priv
- MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
-
---
-- Name change of Type -> Column_priv from MySQL 3.22.12
---
+ALTER TABLE columns_priv
+ CHANGE Type Column_priv set('Select','Insert','Update','References')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+
+ALTER TABLE columns_priv
+ MODIFY Host char(60) NOT NULL default '',
+ MODIFY Db char(64) NOT NULL default '',
+ MODIFY User char(16) NOT NULL default '',
+ MODIFY Table_name char(64) NOT NULL default '',
+ MODIFY Column_name char(64) NOT NULL default '',
+ ENGINE=MyISAM,
+ CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin,
+ COMMENT='Column privileges';
-ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+ALTER TABLE columns_priv
+ MODIFY Column_priv set('Select','Insert','Update','References')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL;
--
-- Add the new 'type' column to the func table.
@@ -100,7 +124,7 @@ ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update',
ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
--
--- Change the user,db and host tables to MySQL 4.0 format
+-- Change the user,db and host tables to current format
--
# Detect whether we had Show_db_priv
@@ -142,14 +166,12 @@ ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
-alter table tables_priv add KEY Grantor (Grantor);
+
alter table db comment='Database privileges';
alter table host comment='Host privileges; Merged with database privileges';
alter table user comment='Users and global privileges';
alter table func comment='User defined functions';
-alter table tables_priv comment='Table privileges';
-alter table columns_priv comment='Column privileges';
-- Convert all tables to UTF-8 with binary collation
-- and reset all char columns to correct width
@@ -181,6 +203,7 @@ ALTER TABLE user
MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+
ALTER TABLE db
MODIFY Host char(60) NOT NULL default '',
MODIFY Db char(64) NOT NULL default '',
@@ -199,6 +222,7 @@ ALTER TABLE db
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+
ALTER TABLE host
MODIFY Host char(60) NOT NULL default '',
MODIFY Db char(64) NOT NULL default '',
@@ -216,29 +240,11 @@ ALTER TABLE host
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+
ALTER TABLE func
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE func
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
-ALTER TABLE columns_priv
- MODIFY Host char(60) NOT NULL default '',
- MODIFY Db char(64) NOT NULL default '',
- MODIFY User char(16) NOT NULL default '',
- MODIFY Table_name char(64) NOT NULL default '',
- MODIFY Column_name char(64) NOT NULL default '',
- ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
-ALTER TABLE columns_priv
- MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
-ALTER TABLE tables_priv
- MODIFY Host char(60) NOT NULL default '',
- MODIFY Db char(64) NOT NULL default '',
- MODIFY User char(16) NOT NULL default '',
- MODIFY Table_name char(64) NOT NULL default '',
- MODIFY Grantor char(77) NOT NULL default '',
- ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
-ALTER TABLE tables_priv
- MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
- MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
#
# Detect whether we had Create_view_priv
@@ -250,20 +256,25 @@ SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%';
# Create VIEWs privileges (v5.0)
#
ALTER TABLE db ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
+ALTER TABLE db MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
+
ALTER TABLE host ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
+ALTER TABLE host MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
+
ALTER TABLE user ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
+ALTER TABLE user MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
#
# Show VIEWs privileges (v5.0)
#
ALTER TABLE db ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
+ALTER TABLE db MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
+
ALTER TABLE host ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
-ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
+ALTER TABLE host MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
-#
-# Show/Create views table privileges (v5.0)
-#
-ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
+ALTER TABLE user MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
#
# Assign create/show view privileges to people who have create provileges
@@ -280,18 +291,31 @@ SELECT @hadCreateRoutinePriv:=1 FROM user WHERE Create_routine_priv LIKE '%';
# Create PROCEDUREs privileges (v5.0)
#
ALTER TABLE db ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
+ALTER TABLE db MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
+
ALTER TABLE host ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
+ALTER TABLE host MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
+
ALTER TABLE user ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
+ALTER TABLE user MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
#
# Alter PROCEDUREs privileges (v5.0)
#
ALTER TABLE db ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
+ALTER TABLE db MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
+
ALTER TABLE host ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
+ALTER TABLE host MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
+
ALTER TABLE user ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
+ALTER TABLE user MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE db ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
+ALTER TABLE db MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
+
ALTER TABLE host ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
+ALTER TABLE host MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
#
# Assign create/alter routine privileges to people who have create privileges
@@ -313,26 +337,46 @@ SET @hadCreateUserPriv:=0;
SELECT @hadCreateUserPriv:=1 FROM user WHERE Create_user_priv LIKE '%';
ALTER TABLE user ADD Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
+ALTER TABLE user MODIFY Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
UPDATE user LEFT JOIN db USING (Host,User) SET Create_user_priv='Y'
WHERE @hadCreateUserPriv = 0 AND
(user.Grant_priv = 'Y' OR db.Grant_priv = 'Y');
-#
-# Create some possible missing tables
-#
+--
+-- procs_priv
+--
CREATE TABLE IF NOT EXISTS procs_priv (
-Host char(60) binary DEFAULT '' NOT NULL,
-Db char(64) binary DEFAULT '' NOT NULL,
-User char(16) binary DEFAULT '' NOT NULL,
-Routine_name char(64) binary DEFAULT '' NOT NULL,
-Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
-Grantor char(77) DEFAULT '' NOT NULL,
-Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
-Timestamp timestamp(14),
-PRIMARY KEY (Host,Db,User,Routine_name,Routine_type),
-KEY Grantor (Grantor)
+ Host char(60) binary DEFAULT '' NOT NULL,
+ Db char(64) binary DEFAULT '' NOT NULL,
+ User char(16) binary DEFAULT '' NOT NULL,
+ Routine_name char(64) binary DEFAULT '' NOT NULL,
+ Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
+ Grantor char(77) DEFAULT '' NOT NULL,
+ Proc_priv set('Execute','Alter Routine','Grant')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL,
+ Timestamp timestamp(14),
+ PRIMARY KEY (Host, Db, User, Routine_name, Routine_type),
+ KEY Grantor (Grantor)
) CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+ALTER TABLE procs_priv
+ ENGINE=MyISAM,
+ CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE procs_priv
+ MODIFY Proc_priv set('Execute','Alter Routine','Grant')
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+
+ALTER TABLE procs_priv
+ ADD Routine_type enum('FUNCTION','PROCEDURE')
+ COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
+
+ALTER TABLE procs_priv
+ MODIFY Timestamp timestamp(14) AFTER Proc_priv;
+
+--
+-- help_topic
+--
CREATE TABLE IF NOT EXISTS help_topic (
help_topic_id int unsigned not null,
name varchar(64) not null,
@@ -408,7 +452,7 @@ PRIMARY KEY TranTime (Transition_time)
#
-# Create proc table if it doesn't exists
+# Create proc table if it does not exists
#
CREATE TABLE IF NOT EXISTS proc (
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 40bc9c79b63..2669f234143 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -411,7 +411,9 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
if (number_of_fields < 3 ||
l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
- l_time->minute > 59 || l_time->second > 59)
+ l_time->minute > 59 || l_time->second > 59 ||
+ (l_time->year == 0 && l_time->month == 0 && l_time->day == 0 &&
+ (l_time->hour != 0 || l_time->minute != 0 || l_time->second != 0)))
{
/* Only give warning for a zero date if there is some garbage after */
if (!not_zero_date) /* If zero date */
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 95ff985376d..3286695d733 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -309,6 +309,21 @@ static void do_field_string(Copy_field *copy)
}
+static void do_field_varbinary_pre50(Copy_field *copy)
+{
+ char buff[MAX_FIELD_WIDTH];
+ copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
+ copy->from_field->val_str(&copy->tmp);
+
+ /* Use the same function as in 4.1 to trim trailing spaces */
+ uint length= my_lengthsp_8bit(&my_charset_bin, copy->tmp.c_ptr_quick(),
+ copy->from_field->field_length);
+
+ copy->to_field->store(copy->tmp.c_ptr_quick(), length,
+ copy->tmp.charset());
+}
+
+
static void do_field_int(Copy_field *copy)
{
longlong value= copy->from_field->val_int();
@@ -571,6 +586,15 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
if (from->result_type() == STRING_RESULT)
{
/*
+ Detect copy from pre 5.0 varbinary to varbinary as of 5.0 and
+ use special copy function that removes trailing spaces and thus
+ repairs data.
+ */
+ if (from->type() == MYSQL_TYPE_VAR_STRING && !from->has_charset() &&
+ to->type() == MYSQL_TYPE_VARCHAR && !to->has_charset())
+ return do_field_varbinary_pre50;
+
+ /*
If we are copying date or datetime's we have to check the dates
if we don't allow 'all' dates.
*/
diff --git a/sql/handler.cc b/sql/handler.cc
index ae314afb991..65ed7b43855 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1981,6 +1981,10 @@ int handler::check_old_types()
{
return HA_ADMIN_NEEDS_ALTER;
}
+ if ((*field)->type() == MYSQL_TYPE_VAR_STRING)
+ {
+ return HA_ADMIN_NEEDS_ALTER;
+ }
}
}
return 0;
diff --git a/sql/item.cc b/sql/item.cc
index 58c2bc75522..d14956dee84 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5487,6 +5487,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
ER(ER_NO_DEFAULT_FOR_FIELD),
field_arg->field_name);
}
+ field_arg->set_default();
return 1;
}
field_arg->set_default();
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 659a214e9c2..e5ac133e35e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1342,6 +1342,10 @@ longlong Item_func_mod::int_op()
signal_divide_by_null();
return 0;
}
+
+ if (args[0]->unsigned_flag)
+ return ((ulonglong) value) % val2;
+
return value % val2;
}
@@ -2713,39 +2717,47 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
char *to=num_buffer;
for (uint i=0; i < arg_count; i++)
{
- f_args.args[i]=0;
+ /*
+ For a constant argument i, args->args[i] points to the argument value.
+ For non-constant, args->args[i] is NULL.
+ */
+ f_args.args[i]= NULL; /* Non-const unless updated below. */
+
f_args.lengths[i]= arguments[i]->max_length;
f_args.maybe_null[i]= (char) arguments[i]->maybe_null;
f_args.attributes[i]= arguments[i]->name;
f_args.attribute_lengths[i]= arguments[i]->name_length;
- switch(arguments[i]->type()) {
- case Item::STRING_ITEM: // Constant string !
+ if (arguments[i]->const_item())
{
- String *res=arguments[i]->val_str(&buffers[i]);
- if (arguments[i]->null_value)
- continue;
- f_args.args[i]= (char*) res->ptr();
- break;
- }
- case Item::INT_ITEM:
- *((longlong*) to) = arguments[i]->val_int();
- if (!arguments[i]->null_value)
- {
- f_args.args[i]=to;
- to+= ALIGN_SIZE(sizeof(longlong));
- }
- break;
- case Item::REAL_ITEM:
- *((double*) to)= arguments[i]->val_real();
- if (!arguments[i]->null_value)
- {
- f_args.args[i]=to;
- to+= ALIGN_SIZE(sizeof(double));
- }
- break;
- default: // Skip these
- break;
+ if (arguments[i]->null_value)
+ continue;
+
+ switch (arguments[i]->result_type())
+ {
+ case STRING_RESULT:
+ case DECIMAL_RESULT:
+ {
+ String *res= arguments[i]->val_str(&buffers[i]);
+ f_args.args[i]= (char*) res->ptr();
+ break;
+ }
+ case INT_RESULT:
+ *((longlong*) to)= arguments[i]->val_int();
+ f_args.args[i]= to;
+ to+= ALIGN_SIZE(sizeof(longlong));
+ break;
+ case REAL_RESULT:
+ *((double*) to)= arguments[i]->val_real();
+ f_args.args[i]= to;
+ to+= ALIGN_SIZE(sizeof(double));
+ break;
+ case ROW_RESULT:
+ default:
+ // This case should never be chosen
+ DBUG_ASSERT(0);
+ break;
+ }
}
}
thd->net.last_error[0]=0;
diff --git a/sql/item_func.h b/sql/item_func.h
index ca835177f18..92bc870d509 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1292,7 +1292,7 @@ public:
Item_func_inet_aton(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "inet_aton"; }
- void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;}
+ void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;unsigned_flag=1;}
};
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index ca593664299..8504434aed5 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -289,15 +289,16 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
for (; ptr != end && val != val_end; ptr++)
{
+ /* Skip pre-space between each argument */
+ while (val != val_end && my_isspace(cs, *val))
+ val++;
+
if (*ptr == '%' && ptr+1 != end)
{
int val_len;
char *tmp;
error= 0;
- /* Skip pre-space between each argument */
- while (val != val_end && my_isspace(cs, *val))
- val++;
val_len= (uint) (val_end - val);
switch (*++ptr) {
@@ -3321,7 +3322,9 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
date_time_format.format.str= (char*) format->ptr();
date_time_format.format.length= format->length();
if (extract_date_time(&date_time_format, val->ptr(), val->length(),
- ltime, cached_timestamp_type, 0, "datetime"))
+ ltime, cached_timestamp_type, 0, "datetime") ||
+ ((fuzzy_date & TIME_NO_ZERO_DATE) &&
+ (ltime->year == 0 || ltime->month == 0 || ltime->day == 0)))
goto null_date;
if (cached_timestamp_type == MYSQL_TIMESTAMP_TIME && ltime->day)
{
@@ -3358,8 +3361,13 @@ String *Item_func_str_to_date::val_str(String *str)
bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date)
{
- if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE))
+ if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) ||
+ (ltime->month == 0))
+ {
+ null_value= 1;
return 1;
+ }
+ null_value= 0;
uint month_idx= ltime->month-1;
ltime->day= days_in_month[month_idx];
if ( month_idx == 1 && calc_days_in_year(ltime->year) == 366)
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index c5ec6f02cdd..55b182049b6 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -952,6 +952,7 @@ bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
bool is_locked);
+void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table);
/* mysql_ha_flush mode_flags bits */
#define MYSQL_HA_CLOSE_FINAL 0x00
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index df1b7f1dd70..9411ba2ef12 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -339,7 +339,7 @@ bool opt_error_log= IF_WIN(1,0);
bool opt_disable_networking=0, opt_skip_show_db=0;
my_bool opt_character_set_client_handshake= 1;
bool server_id_supplied = 0;
-bool opt_endinfo,using_udf_functions;
+bool opt_endinfo, using_udf_functions;
my_bool locked_in_memory;
bool opt_using_transactions, using_update_log;
bool volatile abort_loop;
@@ -2114,13 +2114,24 @@ later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\
mysqld that is not statically linked.\n");
#endif
- if (test_flags & TEST_CORE_ON_SIGNAL)
- {
- fprintf(stderr, "Writing a core file\n");
- fflush(stderr);
- write_core(sig);
- }
- exit(1);
+ if (locked_in_memory)
+ {
+ fprintf(stderr, "\n\
+The \"--memlock\" argument, which was enabled, uses system calls that are\n\
+unreliable and unstable on some operating systems and operating-system\n\
+versions (notably, some versions of Linux). This crash could be due to use\n\
+of those buggy OS calls. You should consider whether you really need the\n\
+\"--memlock\" parameter and/or consult the OS distributer about \"mlockall\"\n\
+bugs.\n");
+ }
+
+ if (test_flags & TEST_CORE_ON_SIGNAL)
+ {
+ fprintf(stderr, "Writing a core file\n");
+ fflush(stderr);
+ write_core(sig);
+ }
+ exit(1);
}
#ifndef SA_RESETHAND
@@ -6054,6 +6065,7 @@ struct show_var_st status_vars[]= {
{"Com_create_function", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_FUNCTION]), SHOW_LONG_STATUS},
{"Com_create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS},
{"Com_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS},
+ {"Com_create_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_USER]), SHOW_LONG_STATUS},
{"Com_dealloc_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DEALLOCATE_PREPARE]), SHOW_LONG_STATUS},
{"Com_delete", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE]), SHOW_LONG_STATUS},
{"Com_delete_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE_MULTI]), SHOW_LONG_STATUS},
diff --git a/sql/sp.cc b/sql/sp.cc
index eae6e624d59..188db4546c9 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -494,17 +494,10 @@ db_create_routine(THD *thd, int type, sp_head *sp)
char definer[USER_HOST_BUFF_SIZE];
char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
- bool dbchanged;
DBUG_ENTER("db_create_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length,
sp->m_name.str));
- if ((ret= sp_use_new_db(thd, sp->m_db, &old_db, 0, &dbchanged)))
- {
- ret= SP_NO_DB_ERROR;
- goto done;
- }
-
if (!(table= open_proc_table_for_update(thd)))
ret= SP_OPEN_TABLE_FAILED;
else
@@ -629,8 +622,6 @@ db_create_routine(THD *thd, int type, sp_head *sp)
done:
close_thread_tables(thd);
- if (dbchanged)
- (void) mysql_change_db(thd, old_db.str, 1);
DBUG_RETURN(ret);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 90043e45052..0a7abc87061 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -519,7 +519,15 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables));
- found_old_table= 0;
+
+ /*
+ End open index scans and table scans and remove references to the tables
+ from the handler tables hash. After this preparation it is safe to close
+ the tables.
+ */
+ mysql_ha_mark_tables_for_reopen(thd, thd->open_tables);
+
+ found_old_table= 0;
while (thd->open_tables)
found_old_table|=close_thread_table(thd, &thd->open_tables);
thd->some_tables_deleted=0;
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 7eb248f3706..4c0916c389f 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -747,3 +747,41 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
DBUG_RETURN(0);
}
+
+
+/*
+ Mark tables for reopen.
+
+ SYNOPSIS
+ mysql_ha_mark_tables_for_reopen()
+ thd Thread identifier.
+ table Table list to mark for reopen.
+
+ DESCRIPTION
+ For each table found in the handler hash mark it as closed
+ (ready for reopen) and end all index/table scans.
+
+ NOTE
+ The caller must lock LOCK_open.
+*/
+
+void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table)
+{
+ DBUG_ENTER("mysql_ha_mark_tables_for_reopen");
+
+ safe_mutex_assert_owner(&LOCK_open);
+ for (; table; table= table->next)
+ {
+ TABLE_LIST *hash_tables;
+ if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
+ (byte*) table->alias,
+ strlen(table->alias) + 1)))
+ {
+ /* Mark table as ready for reopen. */
+ hash_tables->table= NULL;
+ /* End open index/table scans. */
+ table->file->ha_index_or_rnd_end();
+ }
+ }
+ DBUG_VOID_RETURN;
+}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fec7e5ab20d..65257c06d69 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2533,12 +2533,13 @@ mysql_execute_command(THD *thd)
tables. Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
- !(thd->security_ctx->master_access & SUPER_ACL) &&
- uc_update_queries[lex->sql_command] &&
- !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
- (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
- ((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
- some_non_temp_table_to_be_updated(thd, all_tables)))
+ !(thd->security_ctx->master_access & SUPER_ACL) &&
+ uc_update_queries[lex->sql_command] &&
+ !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
+ (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
+ !((lex->sql_command == SQLCOM_DROP_TABLE) && lex->drop_temporary) &&
+ ((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
+ some_non_temp_table_to_be_updated(thd, all_tables)))
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
DBUG_RETURN(-1);
@@ -4243,26 +4244,38 @@ end_with_restore_list:
{
uint namelen;
char *name;
- int result;
+ int result= SP_INTERNAL_ERROR;
DBUG_ASSERT(lex->sphead != 0);
DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */
-
- if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0,
- is_schema_db(lex->sphead->m_db.str)))
+ /*
+ Verify that the database name is allowed, optionally
+ lowercase it.
+ */
+ if (check_db_name(lex->sphead->m_db.str))
{
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
+ my_error(ER_WRONG_DB_NAME, MYF(0), lex->sphead->m_db.str);
+ goto create_sp_error;
}
- if (end_active_trans(thd))
+ /*
+ Check that a database directory with this name
+ exists. Design note: This won't work on virtual databases
+ like information_schema.
+ */
+ if (check_db_dir_existence(lex->sphead->m_db.str))
{
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
+ my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
+ goto create_sp_error;
}
+ if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0,
+ is_schema_db(lex->sphead->m_db.str)))
+ goto create_sp_error;
+
+ if (end_active_trans(thd))
+ goto create_sp_error;
+
name= lex->sphead->name(&namelen);
#ifdef HAVE_DLOPEN
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION)
@@ -4271,10 +4284,8 @@ end_with_restore_list:
if (udf)
{
- my_error(ER_UDF_EXISTS, MYF(0), name);
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
+ my_error(ER_UDF_EXISTS, MYF(0), name);
+ goto create_sp_error;
}
}
#endif
@@ -4282,7 +4293,7 @@ end_with_restore_list:
/*
If the definer is not specified, this means that CREATE-statement missed
DEFINER-clause. DEFINER-clause can be missed in two cases:
-
+
- The user submitted a statement w/o the clause. This is a normal
case, we should assign CURRENT_USER as definer.
@@ -4291,7 +4302,7 @@ end_with_restore_list:
CURRENT_USER as definer here, but also we should mark this routine
as NON-SUID. This is essential for the sake of backward
compatibility.
-
+
The problem is the slave thread is running under "special" user (@),
that actually does not exist. In the older versions we do not fail
execution of a stored routine if its definer does not exist and
@@ -4316,13 +4327,9 @@ end_with_restore_list:
if (ps_arena)
thd->restore_active_arena(ps_arena, &original_arena);
+ /* Error has been already reported. */
if (res)
- {
- /* Error has been already reported. */
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
- }
+ goto create_sp_error;
if (thd->slave_thread)
lex->sphead->m_chistics->suid= SP_IS_NOT_SUID;
@@ -4333,7 +4340,7 @@ end_with_restore_list:
that the current user has SUPER privilege (in order to create a stored
routine under another user one must have SUPER privilege).
*/
-
+
else if (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) ||
my_strcasecmp(system_charset_info,
lex->definer->host.str,
@@ -4342,9 +4349,7 @@ end_with_restore_list:
if (check_global_access(thd, SUPER_ACL))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
+ goto create_sp_error;
}
}
@@ -4364,54 +4369,51 @@ end_with_restore_list:
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
res= (result= lex->sphead->create(thd));
- if (result == SP_OK)
- {
+ switch (result) {
+ case SP_OK:
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* only add privileges if really neccessary */
if (sp_automatic_privileges && !opt_noacl &&
check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS,
- lex->sphead->m_db.str, name,
+ lex->sphead->m_db.str, name,
lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
{
- close_thread_tables(thd);
if (sp_grant_privileges(thd, lex->sphead->m_db.str, name,
lex->sql_command == SQLCOM_CREATE_PROCEDURE))
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_PROC_AUTO_GRANT_FAIL,
- ER(ER_PROC_AUTO_GRANT_FAIL));
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_PROC_AUTO_GRANT_FAIL,
+ ER(ER_PROC_AUTO_GRANT_FAIL));
+ close_thread_tables(thd);
}
#endif
- lex->unit.cleanup();
- delete lex->sphead;
- lex->sphead= 0;
- send_ok(thd);
- }
- else
- {
- switch (result) {
- case SP_WRITE_ROW_FAILED:
- my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
- break;
- case SP_NO_DB_ERROR:
- my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
- break;
- case SP_BAD_IDENTIFIER:
- my_error(ER_TOO_LONG_IDENT, MYF(0), name);
- break;
- case SP_BODY_TOO_LONG:
- my_error(ER_TOO_LONG_BODY, MYF(0), name);
- break;
- default:
- my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
- break;
- }
- lex->unit.cleanup();
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
- }
break;
- }
+ case SP_WRITE_ROW_FAILED:
+ my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
+ break;
+ case SP_BAD_IDENTIFIER:
+ my_error(ER_TOO_LONG_IDENT, MYF(0), name);
+ break;
+ case SP_BODY_TOO_LONG:
+ my_error(ER_TOO_LONG_BODY, MYF(0), name);
+ break;
+ default:
+ my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
+ break;
+ } /* end switch */
+
+ /*
+ Capture all errors within this CASE and
+ clean up the environment.
+ */
+create_sp_error:
+ lex->unit.cleanup();
+ delete lex->sphead;
+ lex->sphead= 0;
+ if (result != SP_OK )
+ goto error;
+ send_ok(thd);
+ break; /* break super switch */
+ } /* end case group bracket */
case SQLCOM_CALL:
{
sp_head *sp;
@@ -4487,8 +4489,6 @@ end_with_restore_list:
select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
- thd->row_count_func= 0;
-
/*
We never write CALL statements into binlog:
- If the mode is non-prelocked, each statement will be logged
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c14529f6eb1..d036750de7f 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -37,7 +37,9 @@ static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
static int copy_data_between_tables(TABLE *from,TABLE *to,
List<create_field> &create, bool ignore,
uint order_num, ORDER *order,
- ha_rows *copied,ha_rows *deleted);
+ ha_rows *copied,ha_rows *deleted,
+ enum enum_enable_or_disable keys_onoff);
+
static bool prepare_blob_field(THD *thd, create_field *sql_field);
static bool check_engine(THD *thd, const char *table_name,
enum db_type *new_engine);
@@ -2934,6 +2936,54 @@ err:
/*
+ Manages enabling/disabling of indexes for ALTER TABLE
+
+ SYNOPSIS
+ alter_table_manage_keys()
+ table Target table
+ indexes_were_disabled Whether the indexes of the from table
+ were disabled
+ keys_onoff ENABLE | DISABLE | LEAVE_AS_IS
+
+ RETURN VALUES
+ FALSE OK
+ TRUE Error
+*/
+
+static
+bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
+ enum enum_enable_or_disable keys_onoff)
+{
+ int error= 0;
+ DBUG_ENTER("alter_table_manage_keys");
+ DBUG_PRINT("enter", ("table=%p were_disabled=%d on_off=%d",
+ table, indexes_were_disabled, keys_onoff));
+
+ switch (keys_onoff) {
+ case ENABLE:
+ error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
+ break;
+ case LEAVE_AS_IS:
+ if (!indexes_were_disabled)
+ break;
+ /* fall-through: disabled indexes */
+ case DISABLE:
+ error= table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
+ }
+
+ if (error == HA_ERR_WRONG_COMMAND)
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), table->s->table_name);
+ error= 0;
+ } else if (error)
+ table->file->print_error(error, MYF(0));
+
+ DBUG_RETURN(error);
+}
+
+
+/*
Alter table
*/
@@ -3097,13 +3147,35 @@ view_err:
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
!table->s->tmp_table) // no need to touch frm
{
- error=0;
VOID(pthread_mutex_lock(&LOCK_open));
- if (new_name != table_name || new_db != db)
+
+ switch (alter_info->keys_onoff) {
+ case LEAVE_AS_IS:
+ error= 0;
+ break;
+ case ENABLE:
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+ error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
+ /* COND_refresh will be signaled in close_thread_tables() */
+ break;
+ case DISABLE:
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+ error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
+ /* COND_refresh will be signaled in close_thread_tables() */
+ break;
+ }
+ if (error == HA_ERR_WRONG_COMMAND)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
+ table->alias);
+ error= 0;
+ }
+
+ if (!error && (new_name != table_name || new_db != db))
{
thd->proc_info="rename";
/* Then do a 'simple' rename of the table */
- error=0;
if (!access(new_name_buff,F_OK))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name);
@@ -3125,31 +3197,14 @@ view_err:
}
}
- if (!error)
- {
- switch (alter_info->keys_onoff) {
- case LEAVE_AS_IS:
- break;
- case ENABLE:
- wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- /* COND_refresh will be signaled in close_thread_tables() */
- break;
- case DISABLE:
- wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- /* COND_refresh will be signaled in close_thread_tables() */
- break;
- }
- }
-
if (error == HA_ERR_WRONG_COMMAND)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
table->alias);
- error=0;
+ error= 0;
}
+
if (!error)
{
if (mysql_bin_log.is_open())
@@ -3167,7 +3222,7 @@ view_err:
error= -1;
}
VOID(pthread_mutex_unlock(&LOCK_open));
- table_list->table=0; // For query cache
+ table_list->table= NULL; // For query cache
query_cache_invalidate3(thd, table_list, 0);
DBUG_RETURN(error);
}
@@ -3581,8 +3636,20 @@ view_err:
new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
new_table->next_number_field=new_table->found_next_number_field;
error=copy_data_between_tables(table, new_table, create_list, ignore,
- order_num, order, &copied, &deleted);
+ order_num, order, &copied, &deleted,
+ alter_info->keys_onoff);
}
+ else if (!new_table)
+ {
+ VOID(pthread_mutex_lock(&LOCK_open));
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+ table->file->external_lock(thd, F_WRLCK);
+ alter_table_manage_keys(table, table->file->indexes_are_disabled(),
+ alter_info->keys_onoff);
+ table->file->external_lock(thd, F_UNLCK);
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ }
+
thd->last_insert_id=next_insert_id; // Needed for correct log
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -3810,7 +3877,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
bool ignore,
uint order_num, ORDER *order,
ha_rows *copied,
- ha_rows *deleted)
+ ha_rows *deleted,
+ enum enum_enable_or_disable keys_onoff)
{
int error;
Copy_field *copy,*copy_end;
@@ -3843,6 +3911,9 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (to->file->external_lock(thd, F_WRLCK))
DBUG_RETURN(-1);
+ /* We need external lock before we can disable/enable keys */
+ alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
+
/* We can abort alter table for any table type */
thd->no_trans_update= 0;
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 2fa7474eb16..bbab47e253d 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -165,6 +165,9 @@ void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error
void avgcost_clear( UDF_INIT* initid, char* is_null, char *error );
void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
+char *is_const(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long
+ *length, char *is_null, char *error);
/*************************************************************************
@@ -1075,4 +1078,32 @@ char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)),
return result;
}
+
+
+my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ if (args->arg_count != 1)
+ {
+ strmov(message, "IS_CONST accepts only one argument");
+ return 1;
+ }
+ initid->ptr= (char*)((args->args[0] != NULL) ? 1 : 0);
+ return 0;
+}
+
+char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
+ char *result, unsigned long *length,
+ char *is_null, char *error __attribute__((unused)))
+{
+ if (initid->ptr != 0) {
+ sprintf(result, "const");
+ } else {
+ sprintf(result, "not const");
+ }
+ *is_null= 0;
+ *length= strlen(result);
+ return result;
+}
+
+
#endif /* HAVE_DLOPEN */
diff --git a/sql/udf_example.def b/sql/udf_example.def
index d3081ca7768..ee107d58e51 100644
--- a/sql/udf_example.def
+++ b/sql/udf_example.def
@@ -22,3 +22,5 @@ EXPORTS
avgcost_add
avgcost_clear
avgcost
+ is_const
+ is_const_init
diff --git a/strings/strtod.c b/strings/strtod.c
index ddb570718a0..932a34f921d 100644
--- a/strings/strtod.c
+++ b/strings/strtod.c
@@ -31,7 +31,6 @@
#define MAX_DBL_EXP 308
#define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157
-#define MIN_RESULT_FOR_MIN_EXP 2.225073858507202
static double scaler10[] = {
1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90
};
@@ -161,26 +160,15 @@ double my_strtod(const char *str, char **end_ptr, int *error)
order= exp + (neg_exp ? -1 : 1) * (ndigits - 1);
if (order < 0)
order= -order;
- if (order >= MAX_DBL_EXP && result)
+ if (order >= MAX_DBL_EXP && !neg_exp && result)
{
double c;
/* Compute modulus of C (see comment above) */
c= result / scaler * 10.0;
- if (neg_exp)
+ if (order > MAX_DBL_EXP || c > MAX_RESULT_FOR_MAX_EXP)
{
- if (order > MAX_DBL_EXP || c < MIN_RESULT_FOR_MIN_EXP)
- {
- result= 0.0;
- goto done;
- }
- }
- else
- {
- if (order > MAX_DBL_EXP || c > MAX_RESULT_FOR_MAX_EXP)
- {
- overflow= 1;
- goto done;
- }
+ overflow= 1;
+ goto done;
}
}
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index d5041f30c0a..f5fa4e9ed9a 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -82,7 +82,7 @@ datadir_set=
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
- source $lsb_functions
+ . $lsb_functions
else
log_success_msg()
{
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9f143173827..79c7535f7ba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,11 +17,6 @@
## Process this file with automake to create Makefile.in
-if HAVE_YASSL
- yassl_dummy_link_fix= $(top_srcdir)/extra/yassl/src/dummy.cpp
-else
- yassl_dummy_link_fix=
-endif
EXTRA_DIST = auto_increment.res auto_increment.tst \
function.res function.tst lock_test.pl lock_test.res \
export.pl big_record.pl \
@@ -35,9 +30,6 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \
bin_PROGRAMS = mysql_client_test
noinst_PROGRAMS = insert_test select_test thread_test
-#
-# C Test for 4.1 protocol
-#
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes)
LIBS = @CLIENT_LIBS@
@@ -45,11 +37,11 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la
mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS)
-mysql_client_test_SOURCES= mysql_client_test.c $(yassl_dummy_link_fix) \
+mysql_client_test_SOURCES= mysql_client_test.c\
$(top_srcdir)/mysys/my_memmem.c
-insert_test_SOURCES= insert_test.c $(yassl_dummy_link_fix)
-select_test_SOURCES= select_test.c $(yassl_dummy_link_fix)
+insert_test_SOURCES= insert_test.c
+select_test_SOURCES= select_test.c
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 61b9a612dc5..845ad7cd7dc 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -15,18 +15,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
-if HAVE_YASSL
- yassl_dummy_link_fix= $(top_srcdir)/extra/yassl/src/dummy.cpp
-else
- yassl_dummy_link_fix=
-endif
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes)
+
LDADD= @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
- @openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
+ @openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
+
bin_PROGRAMS= mysqltestmanager
-mysqltestmanager_SOURCES= mysqlmanager.c $(yassl_dummy_link_fix)
+mysqltestmanager_SOURCES= mysqlmanager.c
mysqltestmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
DEF= -DUNDEF_THREADS_HACK
diff --git a/vio/Makefile.am b/vio/Makefile.am
index cb70501046e..1f16894f4c1 100644
--- a/vio/Makefile.am
+++ b/vio/Makefile.am
@@ -1,43 +1,29 @@
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-if HAVE_YASSL
- yassl_dummy_link_fix= $(top_srcdir)/extra/yassl/src/dummy.cpp
-else
- yassl_dummy_link_fix=
-endif
-INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes)
-LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs)
-pkglib_LIBRARIES= libvio.a
-noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
-noinst_HEADERS= vio_priv.h
-test_ssl_SOURCES= test-ssl.c $(yassl_dummy_link_fix)
-test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
- ../mysys/libmysys.a ../strings/libmystrings.a \
- $(openssl_libs) $(yassl_libs)
-test_sslserver_SOURCES= test-sslserver.c $(yassl_dummy_link_fix)
-test_sslserver_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
- ../mysys/libmysys.a ../strings/libmystrings.a \
- $(openssl_libs) $(yassl_libs)
-test_sslclient_SOURCES= test-sslclient.c $(yassl_dummy_link_fix)
-test_sslclient_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
- ../mysys/libmysys.a ../strings/libmystrings.a \
- $(openssl_libs) $(yassl_libs)
-libvio_a_SOURCES= vio.c viosocket.c viossl.c viosslfactories.c
+LDADD = @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs)
+pkglib_LIBRARIES = libvio.a
+
+noinst_HEADERS = vio_priv.h
+
+libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c
+
EXTRA_DIST= CMakeLists.txt
+
# Don't update the files from bitkeeper
%::SCCS/s.%