List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:January 23 2008 5:34pm
Subject:bk commit into 5.0 tree (cmiller:1.2562) BUG#27427
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller.  When cmiller 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@stripped, 2008-01-23 11:34:08-05:00, cmiller@stripped +2 -0
  Bug#27427: resolveip fails on hostnames with a leading digit
  
  Patch by Kasper Dupont.  No CLA required for this size of patch.
  
  "resolveip" program produces incorrect result if given a hostname
  starting with a digit.  Someone seems to have thought that names 
  can not have digits at the beginning.
  
  Instead, use the resolver library to work out the rules of hostnames, 
  as it will undoubtedly be better at it than we are.

  configure.in@stripped, 2008-01-23 11:34:07-05:00, cmiller@stripped +2 -0
    See if we need to a library for address lookups.

  extra/resolveip.c@stripped, 2008-01-23 11:34:07-05:00, cmiller@stripped +4 -2
    Don't use silly heuristic to know whether a string is a dotted
    quad.  Instead, pass the whole thing into the resolver and let
    its smarts do all the work.

diff -Nrup a/configure.in b/configure.in
--- a/configure.in	2007-12-14 10:58:00 -05:00
+++ b/configure.in	2008-01-23 11:34:07 -05:00
@@ -838,6 +838,8 @@ AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen
 AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
 # Check if crypt() exists in libc or libcrypt, sets LIBS if needed
 AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
+# See if we need a library for address lookup.
+AC_SEARCH_LIBS(inet_aton, [socket nsl resolv])
 
 # For the sched_yield() function on Solaris
 AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield))
diff -Nrup a/extra/resolveip.c b/extra/resolveip.c
--- a/extra/resolveip.c	2006-12-23 14:04:04 -05:00
+++ b/extra/resolveip.c	2008-01-23 11:34:07 -05:00
@@ -116,11 +116,13 @@ int main(int argc, char **argv)
 
   while (argc--)
   {
+    struct in_addr addr;
     ip = *argv++;    
 
-    if (my_isdigit(&my_charset_latin1,ip[0]))
+    /* Not compatible with IPv6!  Probably should use getnameinfo(). */
+    if (inet_aton(ip, &addr) != 0)
     {
-      taddr = inet_addr(ip);
+      taddr= addr.s_addr;
       if (taddr == htonl(INADDR_BROADCAST))
       {	
 	puts("Broadcast");
Thread
bk commit into 5.0 tree (cmiller:1.2562) BUG#27427Chad MILLER23 Jan 2008