2850 Alexander Nozdrin 2009-08-10
Postfix for Bug#45584:
- Initialize vio->remote and vio->addLen in vio_peer_addr()
even when vio->localhost is set.
- Postpone ip_key construction in ip_to_hostname().
modified:
sql/hostname.cc
vio/viosocket.c
2849 Alexander Nozdrin 2009-08-08
Fix valgrind warnings (typo).
modified:
sql/hostname.cc
=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc 2009-08-08 11:48:48 +0000
+++ b/sql/hostname.cc 2009-08-10 04:17:39 +0000
@@ -298,11 +298,6 @@ bool ip_to_hostname(struct sockaddr_stor
(const char *) ip_string,
(int) ip->sa_family));
- /* Prepare host name cache key. */
-
- char ip_key[HOST_ENTRY_KEY_SIZE];
- prepare_hostname_cache_key(ip_string, ip_key);
-
/* Check if we have loopback address (127.0.0.1 or ::1). */
if (is_ip_loopback(ip))
@@ -315,6 +310,11 @@ bool ip_to_hostname(struct sockaddr_stor
DBUG_RETURN(FALSE);
}
+ /* Prepare host name cache key. */
+
+ char ip_key[HOST_ENTRY_KEY_SIZE];
+ prepare_hostname_cache_key(ip_string, ip_key);
+
/* Check first if we have host name in the cache. */
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
=== modified file 'vio/viosocket.c'
--- a/vio/viosocket.c 2009-08-07 19:53:03 +0000
+++ b/vio/viosocket.c 2009-08-10 04:17:39 +0000
@@ -448,9 +448,21 @@ my_bool vio_peer_addr(Vio *vio, char *ip
if (vio->localhost)
{
+ /*
+ Initialize vio->remote and vio->addLen. Set vio->remote to IPv4 loopback
+ address.
+ */
+ struct in_addr *ip4= &((struct sockaddr_in *) &(vio->remote))->sin_addr;
+
+ vio->remote.ss_family= AF_INET;
+ vio->addrLen= sizeof (struct sockaddr_in);
+
+ ip4->s_addr= INADDR_LOOPBACK;
+
+ /* Initialize ip_buffer and port. */
+
strmov(ip_buffer, "127.0.0.1");
*port= 0;
- /* NOTE: vio->remote left uninitialized here. */
}
else
{
Attachment: [text/bzr-bundle] bzr/alik@sun.com-20090810041739-ugmx34h34uid8mox.bundle
| Thread |
|---|
| • bzr push into mysql branch (alik:2849 to 2850) Bug#45584 | Alexander Nozdrin | 10 Aug |