Fix empty hostname in GetHostByName on windows (#3397)
authorHenric Müller <henric.muller@gmail.com>
Mon, 15 Aug 2016 02:05:32 +0000 (04:05 +0200)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 15 Aug 2016 02:05:32 +0000 (22:05 -0400)
mono/metadata/socket-io.c

index aaef8f6422a9e5fce06a7565c9912321cc17dd51..04c55e7241bc4a85ced64fc6cf8bfbc3ae11a192 100644 (file)
@@ -2676,8 +2676,16 @@ ves_icall_System_Net_Dns_GetHostByName_internal (MonoString *host, MonoString **
                }
        }
 
+#ifdef HOST_WIN32
+       // Win32 APIs already returns local interface addresses for empty hostname ("")
+       // so we never want to add them manually.
+       add_local_ips = FALSE;
+       if (mono_get_address_info(hostname, 0, MONO_HINT_CANONICAL_NAME | hint, &info))
+               add_info_ok = FALSE;
+#else
        if (*hostname && mono_get_address_info (hostname, 0, MONO_HINT_CANONICAL_NAME | hint, &info))
                add_info_ok = FALSE;
+#endif
 
        g_free(hostname);