List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:July 12 2005 12:53am
Subject:bk commit into 5.0 tree (jimw:1.1907) BUG#11822
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1907 05/07/11 15:52:56 jimw@stripped +2 -0
  Handle systems where 127.0.0.1 doesn't always map to 'localhost'
  first. (Bug #11822)

  sql/sql_parse.cc
    1.444 05/07/11 15:52:52 jimw@stripped +2 -1
    Don't try to modify thd->host if it is a constant.

  sql/hostname.cc
    1.30 05/07/11 15:52:52 jimw@stripped +9 -1
    Short-circuit ip_to_hostname() lookup for INADDR_LOOPBACK to
    always return 'localhost'.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-11822

--- 1.29/sql/hostname.cc	2005-05-13 04:04:27 -07:00
+++ 1.30/sql/hostname.cc	2005-07-11 15:52:52 -07:00
@@ -130,15 +130,23 @@
   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));

--- 1.443/sql/sql_parse.cc	2005-07-09 10:55:10 -07:00
+++ 1.444/sql/sql_parse.cc	2005-07-11 15:52:52 -07:00
@@ -792,7 +792,8 @@
 	/* Cut very long hostnames to avoid possible overflows */
 	if (thd->host)
 	{
-	  thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
+          if (thd->host != my_localhost)
+	    thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
 	  thd->host_or_ip= thd->host;
 	}
 	if (connect_errors > max_connect_errors)
Thread
bk commit into 5.0 tree (jimw:1.1907) BUG#11822Jim Winstead12 Jul