diff options
author | unknown <jimw@mysql.com> | 2005-07-18 17:00:37 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-07-18 17:00:37 -0700 |
commit | f19af2946ff386748fa8f70af2b2d41c927e389a (patch) | |
tree | 22b0ecf8f5e1180f7e27b02b6520bcbe8ea3e66c /sql/hostname.cc | |
parent | c68257043108de5e58b7a769089036c6692b8df3 (diff) | |
download | mariadb-git-f19af2946ff386748fa8f70af2b2d41c927e389a.tar.gz |
Handle systems where 127.0.0.1 doesn't always map to 'localhost'
first. (Bug #11822)
sql/hostname.cc:
Short-circuit ip_to_hostname() lookup for INADDR_LOOPBACK to
always return 'localhost'.
sql/sql_parse.cc:
Push special handling of 127.0.0.1 into ip_to_hostname().
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r-- | sql/hostname.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc index 39223556024..12b69a97859 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -130,15 +130,23 @@ void reset_host_errors(struct in_addr *in) VOID(pthread_mutex_unlock(&hostname_cache->lock)); } +/* Deal with systems that don't defined INADDR_LOOPBACK */ +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001UL +#endif my_string ip_to_hostname(struct in_addr *in, uint *errors) { uint i; host_entry *entry; DBUG_ENTER("ip_to_hostname"); + *errors=0; + + /* We always treat the loopback address as "localhost". */ + if (in->s_addr == INADDR_LOOPBACK) + return (char *)my_localhost; /* Check first if we have name in cache */ - *errors=0; if (!(specialflag & SPECIAL_NO_HOST_CACHE)) { VOID(pthread_mutex_lock(&hostname_cache->lock)); |