Always return numeric service lookups
This commit is contained in:
parent
3a7c4e0e28
commit
7f4007d1d8
|
@ -432,6 +432,7 @@ static int _tcp_server_add_client(TCP * tcp, TCPSocket * client)
|
||||||
#endif
|
#endif
|
||||||
char host[NI_MAXHOST];
|
char host[NI_MAXHOST];
|
||||||
char const * name = host;
|
char const * name = host;
|
||||||
|
const int flags = NI_NUMERICSERV;
|
||||||
|
|
||||||
if((p = realloc(tcp->u.server.clients, sizeof(*p)
|
if((p = realloc(tcp->u.server.clients, sizeof(*p)
|
||||||
* (tcp->u.server.clients_cnt + 1)))
|
* (tcp->u.server.clients_cnt + 1)))
|
||||||
|
@ -440,9 +441,10 @@ static int _tcp_server_add_client(TCP * tcp, TCPSocket * client)
|
||||||
tcp->u.server.clients = p;
|
tcp->u.server.clients = p;
|
||||||
/* XXX may not be instant */
|
/* XXX may not be instant */
|
||||||
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
|
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
|
||||||
NI_NAMEREQD) != 0
|
NI_NAMEREQD | flags) != 0
|
||||||
&& getnameinfo(client->sa, client->sa_len, host,
|
&& getnameinfo(client->sa, client->sa_len, host,
|
||||||
sizeof(host), NULL, 0, NI_NUMERICHOST) != 0)
|
sizeof(host), NULL, 0, NI_NUMERICHOST | flags)
|
||||||
|
!= 0)
|
||||||
name = NULL;
|
name = NULL;
|
||||||
if((client->client = tcp->helper->client_new(tcp->helper->transport,
|
if((client->client = tcp->helper->client_new(tcp->helper->transport,
|
||||||
name)) == NULL)
|
name)) == NULL)
|
||||||
|
|
|
@ -398,15 +398,16 @@ static int _udp_client_init(UDPClient * client, struct sockaddr * sa,
|
||||||
#endif
|
#endif
|
||||||
char host[NI_MAXHOST];
|
char host[NI_MAXHOST];
|
||||||
char const * name = host;
|
char const * name = host;
|
||||||
|
const int flags = NI_NUMERICSERV | NI_DGRAM;
|
||||||
|
|
||||||
if((client->sa = malloc(sa_len)) == NULL)
|
if((client->sa = malloc(sa_len)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
/* XXX may not be instant */
|
/* XXX may not be instant */
|
||||||
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
|
if(getnameinfo(client->sa, client->sa_len, host, sizeof(host), NULL, 0,
|
||||||
NI_NAMEREQD | NI_DGRAM) != 0
|
NI_NAMEREQD | flags) != 0
|
||||||
&& getnameinfo(client->sa, client->sa_len, host,
|
&& getnameinfo(client->sa, client->sa_len, host,
|
||||||
sizeof(host), NULL, 0,
|
sizeof(host), NULL, 0, NI_NUMERICHOST | flags)
|
||||||
NI_NUMERICHOST | NI_DGRAM) != 0)
|
!= 0)
|
||||||
name = NULL;
|
name = NULL;
|
||||||
if((client->client = helper->client_new(helper->transport, name))
|
if((client->client = helper->client_new(helper->transport, name))
|
||||||
== NULL)
|
== NULL)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user