(getnameinfo_verified): always capture the service from getnameinfo so

it can be sent back to getaddrinfo and set socktype to avoid
getaddrinfo not returning any addresses


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9663 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-02-08 19:05:15 +00:00
parent e303d1ef7f
commit ab0f3be0d5

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 - 2000 Kungliga Tekniska H<>gskolan
* Copyright (c) 1999 - 2001 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -46,14 +46,24 @@ getnameinfo_verified(const struct sockaddr *sa, socklen_t salen,
{
int ret;
struct addrinfo *ai, *a;
char servbuf[NI_MAXSERV];
struct addrinfo hints;
if (host == NULL)
return EAI_NONAME;
if (serv == NULL) {
serv = servbuf;
servlen = sizeof(servbuf);
}
ret = getnameinfo (sa, salen, host, hostlen, serv, servlen, flags);
if (ret)
return ret;
ret = getaddrinfo (host, serv, NULL, &ai);
memset (&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo (host, serv, &hints, &ai);
if (ret)
return ret;
for (a = ai; a != NULL; a = a->ai_next) {