Commit 74b38a0e authored by unknown's avatar unknown

Always call vio_in_addr() so that thd->remote is

always initialized. (Bug #5569)


vio/viosocket.c:
  Remove comment that is no longer correct
sql/sql_parse.cc:
  Always call vio_in_addr() on successful connection,
  so that thd->remote always gets set
vio/viossl.c:
  Remove comment that is no longer correct
parent 22ecb9ce
...@@ -501,6 +501,9 @@ check_connections(THD *thd) ...@@ -501,6 +501,9 @@ check_connections(THD *thd)
thd->thread_id)); thd->thread_id));
DBUG_PRINT("info",("New connection received on %s", DBUG_PRINT("info",("New connection received on %s",
vio_description(net->vio))); vio_description(net->vio)));
vio_in_addr(net->vio,&thd->remote.sin_addr);
if (!thd->host) // If TCP/IP connection if (!thd->host) // If TCP/IP connection
{ {
char ip[30]; char ip[30];
...@@ -521,7 +524,6 @@ check_connections(THD *thd) ...@@ -521,7 +524,6 @@ check_connections(THD *thd)
#endif #endif
if (!(specialflag & SPECIAL_NO_RESOLVE)) if (!(specialflag & SPECIAL_NO_RESOLVE))
{ {
vio_in_addr(net->vio,&thd->remote.sin_addr);
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
/* Cut very long hostnames to avoid possible overflows */ /* Cut very long hostnames to avoid possible overflows */
if (thd->host) if (thd->host)
...@@ -543,7 +545,6 @@ check_connections(THD *thd) ...@@ -543,7 +545,6 @@ check_connections(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host)); DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host; thd->host_or_ip= thd->host;
thd->ip= 0; thd->ip= 0;
bzero((char*) &thd->remote,sizeof(struct sockaddr));
} }
vio_keepalive(net->vio, TRUE); vio_keepalive(net->vio, TRUE);
......
...@@ -295,7 +295,7 @@ void vio_in_addr(Vio *vio, struct in_addr *in) ...@@ -295,7 +295,7 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
{ {
DBUG_ENTER("vio_in_addr"); DBUG_ENTER("vio_in_addr");
if (vio->localhost) if (vio->localhost)
bzero((char*) in, sizeof(*in)); /* This should never be executed */ bzero((char*) in, sizeof(*in));
else else
*in=vio->remote.sin_addr; *in=vio->remote.sin_addr;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -259,7 +259,7 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in) ...@@ -259,7 +259,7 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
{ {
DBUG_ENTER("vio_ssl_in_addr"); DBUG_ENTER("vio_ssl_in_addr");
if (vio->localhost) if (vio->localhost)
bzero((char*) in, sizeof(*in)); /* This should never be executed */ bzero((char*) in, sizeof(*in));
else else
*in=vio->remote.sin_addr; *in=vio->remote.sin_addr;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
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