summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-04-08 14:23:36 +0400
committerAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-04-08 14:23:36 +0400
commit6a293922899ed406d30b43d9018503f2bab2c5b7 (patch)
tree9a31e755274165f13c43c7199d63beb42ba0ce1f /vio
parent71ffbd4651ad1131965ea39252e979bcc719f7de (diff)
downloadmariadb-git-6a293922899ed406d30b43d9018503f2bab2c5b7.tar.gz
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 all errors from getnameinfo() as not ciritical, but add IP-address to the host cache only for EAI_NONAME (or WSANO_DATA).
Diffstat (limited to 'vio')
-rw-r--r--vio/viosocket.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 163eb279d45..0f3a32d62ae 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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 _WIN32
+
+ 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