mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 04:28:05 +02:00
gio/gresolver.c: Fix build on Windows
Windows does not come with inet_aton(), and this check on IPv4 addresses is actually not needed on Windows as the getaddrinfo() implementation on Windows already rejects non-standard and non-real IPv4 numbers-and-dots addresses. https://bugzilla.gnome.org/show_bug.cgi?id=724609
This commit is contained in:
parent
a5ae016359
commit
9cb53851be
@ -308,8 +308,10 @@ handle_ip_address (const char *hostname,
|
|||||||
/* Reject non-standard IPv4 numbers-and-dots addresses.
|
/* Reject non-standard IPv4 numbers-and-dots addresses.
|
||||||
* g_inet_address_new_from_string() will have accepted any "real" IP
|
* g_inet_address_new_from_string() will have accepted any "real" IP
|
||||||
* address, so if inet_aton() succeeds, then it's an address we want
|
* address, so if inet_aton() succeeds, then it's an address we want
|
||||||
* to reject.
|
* to reject. This check is not necessary for Windows, as getaddrinfo()
|
||||||
|
* already rejects such IPv4 addresses on Windows.
|
||||||
*/
|
*/
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
if (inet_aton (hostname, &ip4addr))
|
if (inet_aton (hostname, &ip4addr))
|
||||||
{
|
{
|
||||||
g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
||||||
@ -317,6 +319,7 @@ handle_ip_address (const char *hostname,
|
|||||||
hostname, gai_strerror (EAI_NONAME));
|
hostname, gai_strerror (EAI_NONAME));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user