mirror of
https://github.com/MariaDB/server.git
synced 2026-04-30 20:25:32 +02:00
Backport of JimW's localhost patch to 4.1 tree.
Handle systems like default FC4 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 allways return 'localhost'. sql/sql_parse.cc: Push special handling of 127.0.0.1 into ip_to_hostname().
This commit is contained in:
parent
cbb1da77cf
commit
a59a444108
2 changed files with 19 additions and 21 deletions
|
|
@ -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 == htonl(INADDR_LOOPBACK))
|
||||
DBUG_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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue