summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authorunknown <jani@ibmlab.site>2005-05-06 12:18:37 +0300
committerunknown <jani@ibmlab.site>2005-05-06 12:18:37 +0300
commit72490191019af446fccf3bd44ffb6b1a7519fc4c (patch)
tree1f9c964f6a0bfdd225c63cb4cabb1893aab036a8 /sql/hostname.cc
parent98eb8d7c1691a8cc1a853428bf14048dbf6ab434 (diff)
downloadmariadb-git-72490191019af446fccf3bd44ffb6b1a7519fc4c.tar.gz
A fix for Bug#8467.
BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 47960275e3a..ec5c6f29a27 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -207,13 +207,17 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
{
VOID(pthread_mutex_unlock(&LOCK_hostname));
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
{
VOID(pthread_mutex_unlock(&LOCK_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))))
{
@@ -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 '.'"));
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)
DBUG_PRINT("error",("Couldn't verify hostname with gethostbyname"));
my_free(name,MYF(0));
-err:
+add_wrong_ip_and_return:
add_wrong_ip(in);
DBUG_RETURN(0);
}