Commit 72490191 authored by unknown's avatar unknown

A fix for Bug#8467.


BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 98eb8d7c
...@@ -86,6 +86,7 @@ jani@dsl-jkl1657.dial.inet.fi ...@@ -86,6 +86,7 @@ jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none) jani@hynda.(none)
jani@hynda.mysql.fi jani@hynda.mysql.fi
jani@ibmlab.site
jani@janikt.pp.saunalahti.fi jani@janikt.pp.saunalahti.fi
jani@rhols221.adsl.netsonic.fi jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi jani@rhols221.arenanet.fi
......
...@@ -207,13 +207,17 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) ...@@ -207,13 +207,17 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
{ {
VOID(pthread_mutex_unlock(&LOCK_hostname)); VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("gethostbyaddr returned %d",errno)); DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
goto err;
if (errno == HOST_NOT_FOUND || errno == NO_DATA)
add_wrong_ip(in); /* only cache negative responses, not failures */
DBUG_RETURN(0);
} }
if (!hp->h_name[0]) // Don't allow empty hostnames if (!hp->h_name[0]) // Don't allow empty hostnames
{ {
VOID(pthread_mutex_unlock(&LOCK_hostname)); VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("Got an empty hostname")); DBUG_PRINT("error",("Got an empty hostname"));
goto err; goto add_wrong_ip_and_return;
} }
if (!(name=my_strdup(hp->h_name,MYF(0)))) if (!(name=my_strdup(hp->h_name,MYF(0))))
{ {
...@@ -240,7 +244,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) ...@@ -240,7 +244,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
{ {
DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'")); DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));
my_free(name,MYF(0)); my_free(name,MYF(0));
goto err; goto add_wrong_ip_and_return;
} }
} }
...@@ -256,7 +260,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) ...@@ -256,7 +260,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
DBUG_PRINT("error",("Couldn't verify hostname with gethostbyname")); DBUG_PRINT("error",("Couldn't verify hostname with gethostbyname"));
my_free(name,MYF(0)); my_free(name,MYF(0));
err: add_wrong_ip_and_return:
add_wrong_ip(in); add_wrong_ip(in);
DBUG_RETURN(0); DBUG_RETURN(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