Below is the list of changes that have just been committed into a local
4.1 repository of eric. When eric 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.2404 05/09/02 17:07:05 eric@stripped +2 -0
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/sql_parse.cc
1.465 05/09/02 17:06:58 eric@stripped +10 -20
Push special handling of 127.0.0.1 into ip_to_hostname().
sql/hostname.cc
1.30 05/09/02 17:06:58 eric@stripped +9 -1
Short-circuit ip_to_hostname() lookup for INADDR_LOOPBACK to allways 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: eric
# Host: sleek.local
# Root: /Users/eric/bktmp/mysql-4.1
--- 1.29/sql/hostname.cc 2005-05-13 04:04:27 -07:00
+++ 1.30/sql/hostname.cc 2005-09-02 17:06:58 -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 == 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));
--- 1.464/sql/sql_parse.cc 2005-09-01 16:37:08 -07:00
+++ 1.465/sql/sql_parse.cc 2005-09-02 17:06:58 -07:00
@@ -696,29 +696,19 @@
return (ER_OUT_OF_RESOURCES);
thd->host_or_ip= thd->ip;
vio_in_addr(net->vio,&thd->remote.sin_addr);
-#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
- /* Fast local hostname resolve for Win32 */
- if (!strcmp(thd->ip,"127.0.0.1"))
+ if (!(specialflag & SPECIAL_NO_RESOLVE))
{
- thd->host= (char*) my_localhost;
- thd->host_or_ip= my_localhost;
- }
- else
-#endif
- {
- if (!(specialflag & SPECIAL_NO_RESOLVE))
+ vio_in_addr(net->vio,&thd->remote.sin_addr);
+ thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
+ /* Cut very long hostnames to avoid possible overflows */
+ if (thd->host)
{
- vio_in_addr(net->vio,&thd->remote.sin_addr);
- thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
- /* Cut very long hostnames to avoid possible overflows */
- if (thd->host)
- {
- thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
- thd->host_or_ip= thd->host;
- }
- if (connect_errors > max_connect_errors)
- return(ER_HOST_IS_BLOCKED);
+ 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)
+ return(ER_HOST_IS_BLOCKED);
}
DBUG_PRINT("info",("Host: %s ip: %s",
thd->host ? thd->host : "unknown host",
| Thread |
|---|
| • bk commit into 4.1 tree (eric:1.2404) BUG#11822 | Eric Herman | 3 Sep |