summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authorjani@ibmlab.site <>2005-05-06 12:18:37 +0300
committerjani@ibmlab.site <>2005-05-06 12:18:37 +0300
commitfa25b9b49de5d47248dc793af75992771485d187 (patch)
tree1f9c964f6a0bfdd225c63cb4cabb1893aab036a8 /sql/hostname.cc
parentf9e7e2ee900fdde3f46a6d2399a0b52e3e9a1394 (diff)
downloadmariadb-git-fa25b9b49de5d47248dc793af75992771485d187.tar.gz
A fix for Bug#8467.
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);
}