Commit c82b842a authored by istruewing@stella.local's avatar istruewing@stella.local

Merge stella.local:/home2/mydev/mysql-5.0-ateam

into  stella.local:/home2/mydev/mysql-5.0-axmrg
parents fde9b55d f064cd84
...@@ -2069,6 +2069,8 @@ a b ...@@ -2069,6 +2069,8 @@ a b
1 1 1 1
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://';
DROP TABLE t1;
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated; DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
......
...@@ -1738,4 +1738,16 @@ DROP TABLE t1; ...@@ -1738,4 +1738,16 @@ DROP TABLE t1;
connection slave; connection slave;
DROP TABLE t1; DROP TABLE t1;
#
# BUG#34788 - malformed federated connection url is not handled correctly -
# crashes server !
#
# also tests
#
# BUG#35509 - Federated leaks memory when connecting to localhost/default
# port
#
CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://';
DROP TABLE t1;
source include/federated_cleanup.inc; source include/federated_cleanup.inc;
...@@ -643,13 +643,20 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table, ...@@ -643,13 +643,20 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
if ((strchr(share->table_name, '/'))) if ((strchr(share->table_name, '/')))
goto error; goto error;
/*
If hostname is omitted, we set it to NULL. According to
mysql_real_connect() manual:
The value of host may be either a hostname or an IP address.
If host is NULL or the string "localhost", a connection to the
local host is assumed.
*/
if (share->hostname[0] == '\0') if (share->hostname[0] == '\0')
share->hostname= NULL; share->hostname= NULL;
if (!share->port) if (!share->port)
{ {
if (strcmp(share->hostname, my_localhost) == 0) if (!share->hostname || strcmp(share->hostname, my_localhost) == 0)
share->socket= my_strdup(MYSQL_UNIX_ADDR, MYF(0)); share->socket= (char*) MYSQL_UNIX_ADDR;
else else
share->port= MYSQL_PORT; share->port= MYSQL_PORT;
} }
...@@ -1335,7 +1342,6 @@ static int free_share(FEDERATED_SHARE *share) ...@@ -1335,7 +1342,6 @@ static int free_share(FEDERATED_SHARE *share)
{ {
hash_delete(&federated_open_tables, (byte*) share); hash_delete(&federated_open_tables, (byte*) share);
my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR)); my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR));
thr_lock_delete(&share->lock); thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex)); VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0)); my_free((gptr) share, MYF(0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment