mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug #33831 mysql_real_connect() connects again if
given an already connected MYSQL handle mysql_real_connect() did not check whether the MYSQL connection handler was already connected and connected again even if so. Now a CR_ALREADY_CONNECTED error is returned.
This commit is contained in:
@ -18026,6 +18026,49 @@ static void test_bug44495()
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Bug# 33831 mysql_real_connect() should fail if
|
||||
given an already connected MYSQL handle.
|
||||
*/
|
||||
|
||||
static void test_bug33831(void)
|
||||
{
|
||||
MYSQL *l_mysql;
|
||||
my_bool error;
|
||||
|
||||
DBUG_ENTER("test_bug33831");
|
||||
|
||||
error= 0;
|
||||
|
||||
if (!(l_mysql= mysql_init(NULL)))
|
||||
{
|
||||
myerror("mysql_init() failed");
|
||||
DIE_UNLESS(0);
|
||||
}
|
||||
if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
|
||||
opt_password, current_db, opt_port,
|
||||
opt_unix_socket, 0)))
|
||||
{
|
||||
myerror("connection failed");
|
||||
DIE_UNLESS(0);
|
||||
}
|
||||
|
||||
if (mysql_real_connect(l_mysql, opt_host, opt_user,
|
||||
opt_password, current_db, opt_port,
|
||||
opt_unix_socket, 0))
|
||||
{
|
||||
myerror("connection should have failed");
|
||||
DIE_UNLESS(0);
|
||||
}
|
||||
|
||||
|
||||
mysql_close(l_mysql);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read and parse arguments and MySQL options from my.cnf
|
||||
*/
|
||||
@ -18336,6 +18379,7 @@ static struct my_tests_st my_tests[]= {
|
||||
{ "test_wl4166_1", test_wl4166_1 },
|
||||
{ "test_wl4166_2", test_wl4166_2 },
|
||||
{ "test_bug38486", test_bug38486 },
|
||||
{ "test_bug33831", test_bug33831 },
|
||||
{ "test_bug40365", test_bug40365 },
|
||||
{ "test_bug43560", test_bug43560 },
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
|
Reference in New Issue
Block a user