diff options
author | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-09-23 20:49:23 +0400 |
---|---|---|
committer | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-09-23 20:49:23 +0400 |
commit | bccea2cc5dc99f247687cf2bd64815f3e45268a0 (patch) | |
tree | 877decd533ae5c971c0758aa485413202ba714f7 /tests | |
parent | b6bcb8146ca9fdc84a856fc747beb5ff5099ba25 (diff) | |
parent | 41dc3049281c1718e49d80eaf0cf068def9519b5 (diff) | |
download | mariadb-git-bccea2cc5dc99f247687cf2bd64815f3e45268a0.tar.gz |
Manual merge from mysql-5.1-security.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 14a60f0e857..ac6af1dc93d 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19689,6 +19689,86 @@ static void test_bug11754979() /* + Bug#13001491: MYSQL_REFRESH CRASHES WHEN STORED ROUTINES ARE RUN CONCURRENTLY. +*/ +static void test_bug13001491() +{ + int rc; + char query[MAX_TEST_QUERY_LENGTH]; + MYSQL *c; + + myheader("test_bug13001491"); + + snprintf(query, MAX_TEST_QUERY_LENGTH, + "GRANT ALL PRIVILEGES ON *.* TO mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); + + snprintf(query, MAX_TEST_QUERY_LENGTH, + "GRANT RELOAD ON *.* TO mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); + + c= mysql_client_init(NULL); + + DIE_UNLESS(mysql_real_connect(c, opt_host, "mysqltest_u1", NULL, + current_db, opt_port, opt_unix_socket, + CLIENT_MULTI_STATEMENTS | + CLIENT_MULTI_RESULTS)); + + rc= mysql_query(c, "DROP PROCEDURE IF EXISTS p1"); + myquery(rc); + + rc= mysql_query(c, + "CREATE PROCEDURE p1() " + "BEGIN " + " DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; " + " SELECT COUNT(*) " + " FROM INFORMATION_SCHEMA.PROCESSLIST " + " GROUP BY user " + " ORDER BY NULL " + " INTO @a; " + "END"); + myquery(rc); + + rc= mysql_query(c, "CALL p1()"); + myquery(rc); + + mysql_free_result(mysql_store_result(c)); + + /* Check that mysql_refresh() succeeds without REFRESH_LOG. */ + rc= mysql_refresh(c, REFRESH_GRANT | + REFRESH_TABLES | REFRESH_HOSTS | + REFRESH_STATUS | REFRESH_THREADS); + myquery(rc); + + /* + Check that mysql_refresh(REFRESH_LOG) does not crash the server even if it + fails. mysql_refresh(REFRESH_LOG) fails when error log points to unavailable + location. + */ + mysql_refresh(c, REFRESH_LOG); + + rc= mysql_query(c, "DROP PROCEDURE p1"); + myquery(rc); + + mysql_close(c); + c= NULL; + + snprintf(query, MAX_TEST_QUERY_LENGTH, + "DROP USER mysqltest_u1@%s", + opt_host ? opt_host : "'localhost'"); + + rc= mysql_query(mysql, query); + myquery(rc); +} + + +/* Read and parse arguments and MySQL options from my.cnf */ @@ -20034,6 +20114,7 @@ static struct my_tests_st my_tests[]= { { "test_bug11766854", test_bug11766854 }, { "test_bug12337762", test_bug12337762 }, { "test_bug11754979", test_bug11754979 }, + { "test_bug13001491", test_bug13001491 }, { 0, 0 } }; |