List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:April 5 2011 3:46pm
Subject:bzr commit into mysql-5.5 branch (alexander.nozdrin:3421) Bug#12325375
View as plain text  
#At file:///home/alik/MySQL/bzr/00/bug12325375/mysql-5.5-bug12325375/ based on revid:georgi.kodinov@stripped

 3421 Alexander Nozdrin	2011-04-05
      A patch for Bug#12325375: THE SERVER ON WINXP DOES NOT ALLOW CONNECTIONS
      IF NO DNS-SERVER AVAILABLE.
      
      The thing is that on Windows XP getnameinfo() returns WSANO_DATA
      when hostname-lookup is not available. The problem was that
      this error code was treated as serious error and the client
      connection got rejected.
      
      The fix is to treat WSANO_DATA as EAI_NONAME, i.e. log a warning
      and allow client with unresolved host name.

    modified:
      include/violite.h
      sql/hostname.cc
      vio/viosocket.c
=== modified file 'include/violite.h'
--- a/include/violite.h	2010-06-07 14:01:39 +0000
+++ b/include/violite.h	2011-04-05 15:46:41 +0000
@@ -93,6 +93,8 @@ ssize_t vio_pending(Vio *vio);
 my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
                                      char *ip_string, size_t ip_string_size);
 
+my_bool vio_is_no_name_error(int err_code);
+
 int vio_getnameinfo(const struct sockaddr *sa,
                     char *hostname, size_t hostname_size,
                     char *port, size_t port_size,

=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc	2010-07-23 20:17:55 +0000
+++ b/sql/hostname.cc	2011-04-05 15:46:41 +0000
@@ -366,7 +366,7 @@ bool ip_to_hostname(struct sockaddr_stor
   err_code= vio_getnameinfo(ip, hostname_buffer, NI_MAXHOST, NULL, 0,
                             NI_NAMEREQD);
 
-  if (err_code == EAI_NONAME)
+  if (vio_is_no_name_error(err_code))
   {
     /*
       There is no reverse address mapping for the IP address. A host name

=== modified file 'vio/viosocket.c'
--- a/vio/viosocket.c	2010-08-16 12:50:27 +0000
+++ b/vio/viosocket.c	2011-04-05 15:46:41 +0000
@@ -1060,6 +1060,34 @@ ssize_t vio_pending(Vio *vio)
 
 
 /**
+  Checks if the error code, returned by vio_getnameinfo(), means it was the
+  "No-name" error.
+
+  Windows-specific note: getnameinfo() returns WSANO_DATA instead of
+  EAI_NODATA or EAI_NONAME when no reverse mapping is available at the host
+  (i.e. Windows can't get hostname by IP-address). This error should be
+  treated as EAI_NONAME.
+
+  @return if the error code is actually EAI_NONAME.
+  @retval true if the error code is EAI_NONAME.
+  @retval false otherwise.
+*/
+
+my_bool vio_is_no_name_error(int err_code)
+{
+#ifdef __WIN__
+
+  return err_code == WSANO_DATA || err_code == EAI_NONAME;
+
+#else
+
+  return err_code == EAI_NONAME;
+
+#endif
+}
+
+
+/**
   This is a wrapper for the system getnameinfo(), because different OS
   differ in the getnameinfo() implementation:
     - Solaris 10 requires that the 2nd argument (salen) must match the


Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110405154641-29ggqe5fui6xw0qm.bundle
Thread
bzr commit into mysql-5.5 branch (alexander.nozdrin:3421) Bug#12325375Alexander Nozdrin5 Apr
  • Re: bzr commit into mysql-5.5 branch (alexander.nozdrin:3421) Bug#12325375Magne Mæhre6 Apr