(get_nodes): use getipnodebyname instead of gethostbyname(2)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7627 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -304,6 +304,7 @@ get_nodes (const char *nodename,
|
|||||||
int family = PF_UNSPEC;
|
int family = PF_UNSPEC;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int ret = EAI_NONAME;
|
int ret = EAI_NONAME;
|
||||||
|
int error;
|
||||||
|
|
||||||
if (hints != NULL) {
|
if (hints != NULL) {
|
||||||
family = hints->ai_family;
|
family = hints->ai_family;
|
||||||
@@ -314,21 +315,25 @@ get_nodes (const char *nodename,
|
|||||||
if (family == PF_INET6 || family == PF_UNSPEC) {
|
if (family == PF_INET6 || family == PF_UNSPEC) {
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
|
|
||||||
he = gethostbyname2 (nodename, PF_INET6);
|
he = getipnodebyname (nodename, PF_INET6, 0, &error);
|
||||||
|
|
||||||
if (he != NULL)
|
if (he != NULL) {
|
||||||
ret = add_hostent (port, protocol, socktype,
|
ret = add_hostent (port, protocol, socktype,
|
||||||
¤t, const_v6, he, &flags);
|
¤t, const_v6, he, &flags);
|
||||||
|
freehostent (he);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (family == PF_INET || family == PF_UNSPEC) {
|
if (family == PF_INET || family == PF_UNSPEC) {
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
|
|
||||||
he = gethostbyname (nodename);
|
he = getipnodebyname (nodename, PF_INET, 0, &error);
|
||||||
|
|
||||||
if (he != NULL)
|
if (he != NULL) {
|
||||||
ret = add_hostent (port, protocol, socktype,
|
ret = add_hostent (port, protocol, socktype,
|
||||||
¤t, const_v4, he, &flags);
|
¤t, const_v4, he, &flags);
|
||||||
|
freehostent (he);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*res = first;
|
*res = first;
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user