From 1d4d371cdeed3713ff599e7c2e207f79875bfb1f Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Wed, 28 Jul 1999 03:23:26 +0000 Subject: [PATCH] (krb5_sname_to_principal): use getipnodebyname git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6615 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/principal.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/krb5/principal.c b/lib/krb5/principal.c index 807ed5d64..19401a755 100644 --- a/lib/krb5/principal.c +++ b/lib/krb5/principal.c @@ -851,12 +851,19 @@ krb5_sname_to_principal (krb5_context context, if(sname == NULL) sname = "host"; if(type == KRB5_NT_SRV_HST){ - struct hostent *hp; - hp = roken_gethostbyname(hostname); + struct hostent *hp = NULL; + int error; + +#ifdef HAVE_IPV6 + if (hp == NULL) + hp = getipnodebyname (hostname, AF_INET6, 0, &error); +#endif + if (hp == NULL) + hp = getipnodebyname (hostname, AF_INET, 0, &error); if(hp != NULL) hostname = hp->h_name; } - if(type == KRB5_NT_SRV_HST){ + if(type == KRB5_NT_SRV_HST) { host = strdup(hostname); if(host == NULL){ return ENOMEM;