From b267a04468055eedf7a06eeb7c18df9e2a051c61 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Wed, 2 Feb 2000 04:42:57 +0000 Subject: [PATCH] remember to lower-case host names. bug reported by git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7846 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/expand_hostname.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/krb5/expand_hostname.c b/lib/krb5/expand_hostname.c index 5bf568aff..7c090f36b 100644 --- a/lib/krb5/expand_hostname.c +++ b/lib/krb5/expand_hostname.c @@ -43,6 +43,7 @@ copy_hostname(krb5_context context, *new_hostname = strdup (orig_hostname); if (*new_hostname == NULL) return ENOMEM; + strlwr (*new_hostname); return 0; } @@ -92,6 +93,7 @@ krb5_expand_hostname_realms (krb5_context context, { struct addrinfo *ai, *a, hints; int error; + krb5_error_code ret = 0; memset (&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; @@ -101,17 +103,18 @@ krb5_expand_hostname_realms (krb5_context context, return copy_hostname (context, orig_hostname, new_hostname); for (a = ai; a != NULL; a = a->ai_next) { if (a->ai_canonname != NULL) { - krb5_error_code ret = krb5_get_host_realm (context, - a->ai_canonname, - realms); - - if (ret == 0) { - ret = copy_hostname (context, a->ai_canonname, new_hostname); - freeaddrinfo (ai); - return ret; - } + ret = copy_hostname (context, orig_hostname, new_hostname); + if (ret) + goto out; + strlwr (*new_hostname); + ret = krb5_get_host_realm (context, *new_hostname, realms); + if (ret == 0) + goto out; + free (*new_hostname); } } + ret = copy_hostname (context, orig_hostname, new_hostname); + out: freeaddrinfo (ai); - return copy_hostname (context, orig_hostname, new_hostname); + return ret; }