Commit 7b9e62c2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_getaddrinfo: pass AI_IDN explicitly where applicable

parent b0b8f4c4
...@@ -224,6 +224,9 @@ VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *, ...@@ -224,6 +224,9 @@ VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *,
#ifndef AI_NUMERICSERV #ifndef AI_NUMERICSERV
# define AI_NUMERICSERV 0 # define AI_NUMERICSERV 0
#endif #endif
#ifndef AI_IDN
# define AI_IDN 0 /* GNU/libc extension */
#endif
#ifdef __OS2__ #ifdef __OS2__
# ifndef NI_NUMERICHOST # ifndef NI_NUMERICHOST
......
...@@ -157,7 +157,7 @@ static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access) ...@@ -157,7 +157,7 @@ static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
.ai_family = AF_UNSPEC, .ai_family = AF_UNSPEC,
.ai_socktype = SOCK_DGRAM, .ai_socktype = SOCK_DGRAM,
.ai_protocol = 0, .ai_protocol = 0,
.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_IDN,
}; };
char *shost = var_GetNonEmptyString (p_access, "src-addr"); char *shost = var_GetNonEmptyString (p_access, "src-addr");
char *dhost = var_GetNonEmptyString (p_access, "dst-addr"); char *dhost = var_GetNonEmptyString (p_access, "dst-addr");
......
...@@ -166,19 +166,10 @@ int vlc_getaddrinfo (const char *node, unsigned port, ...@@ -166,19 +166,10 @@ int vlc_getaddrinfo (const char *node, unsigned port,
goto out; goto out;
hints.ai_flags &= ~AI_NUMERICHOST; hints.ai_flags &= ~AI_NUMERICHOST;
} }
#endif
#ifdef AI_IDN
/* Run-time I18n Domain Names support */
hints.ai_flags |= AI_IDN;
ret = getaddrinfo (node, servname, &hints, res);
if (ret != EAI_BADFLAGS)
goto out;
/* IDN not available: disable and retry without it */
hints.ai_flags &= ~AI_IDN;
#endif #endif
ret = getaddrinfo (node, servname, &hints, res); ret = getaddrinfo (node, servname, &hints, res);
#if defined(AI_IDN) || defined(WIN32) #if defined(WIN32)
out: out:
#endif #endif
return ret; return ret;
......
...@@ -130,7 +130,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, ...@@ -130,7 +130,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
struct addrinfo hints = { struct addrinfo hints = {
.ai_socktype = type, .ai_socktype = type,
.ai_protocol = protocol, .ai_protocol = protocol,
.ai_flags = AI_PASSIVE | AI_NUMERICSERV, .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN,
}, *res; }, *res;
msg_Dbg (p_this, "net: listening to %s port %d", msg_Dbg (p_this, "net: listening to %s port %d",
......
...@@ -134,7 +134,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port, ...@@ -134,7 +134,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
struct addrinfo hints = { struct addrinfo hints = {
.ai_socktype = type, .ai_socktype = type,
.ai_protocol = proto, .ai_protocol = proto,
.ai_flags = AI_NUMERICSERV, .ai_flags = AI_NUMERICSERV | AI_IDN,
}, *res; }, *res;
int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res); int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res);
...@@ -450,7 +450,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj, ...@@ -450,7 +450,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
.ai_family = AF_INET, .ai_family = AF_INET,
.ai_socktype = SOCK_STREAM, .ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP, .ai_protocol = IPPROTO_TCP,
.ai_flags = 0, .ai_flags = AI_IDN,
}; };
struct addrinfo *res; struct addrinfo *res;
......
...@@ -141,7 +141,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port, ...@@ -141,7 +141,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
struct addrinfo hints = { struct addrinfo hints = {
.ai_socktype = SOCK_DGRAM, .ai_socktype = SOCK_DGRAM,
.ai_protocol = protocol, .ai_protocol = protocol,
.ai_flags = AI_PASSIVE | AI_NUMERICSERV, .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN,
}, *res; }, *res;
if (host && !*host) if (host && !*host)
...@@ -506,7 +506,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port, ...@@ -506,7 +506,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
struct addrinfo hints = { struct addrinfo hints = {
.ai_socktype = SOCK_DGRAM, .ai_socktype = SOCK_DGRAM,
.ai_protocol = proto, .ai_protocol = proto,
.ai_flags = AI_NUMERICSERV, .ai_flags = AI_NUMERICSERV | AI_IDN,
}, *res; }, *res;
int i_handle = -1; int i_handle = -1;
bool b_unreach = false; bool b_unreach = false;
...@@ -604,7 +604,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind, ...@@ -604,7 +604,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
struct addrinfo hints = { struct addrinfo hints = {
.ai_socktype = SOCK_DGRAM, .ai_socktype = SOCK_DGRAM,
.ai_protocol = protocol, .ai_protocol = protocol,
.ai_flags = AI_NUMERICSERV, .ai_flags = AI_NUMERICSERV | AI_IDN,
}, *loc, *rem; }, *loc, *rem;
int val = vlc_getaddrinfo (psz_server, i_server, &hints, &rem); int val = vlc_getaddrinfo (psz_server, i_server, &hints, &rem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment