From af2fe633398e74bc470bcb7cdcc4a5ef79b333f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 17 Oct 2006 19:28:36 +0000 Subject: [PATCH] (krb5_get_host_realm): make sure we don't recurse git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18541 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/get_host_realm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/krb5/get_host_realm.c b/lib/krb5/get_host_realm.c index 00b5524c8..266161381 100644 --- a/lib/krb5/get_host_realm.c +++ b/lib/krb5/get_host_realm.c @@ -217,9 +217,10 @@ _krb5_get_host_realm_int (krb5_context context, krb5_error_code KRB5_LIB_FUNCTION krb5_get_host_realm(krb5_context context, - const char *host, + const char *targethost, krb5_realm **realms) { + const char *host = targethost; char hostname[MAXHOSTNAMELEN]; krb5_error_code ret; int use_dns; @@ -239,11 +240,11 @@ krb5_get_host_realm(krb5_context context, use_dns = (strchr(host, '.') != NULL); ret = _krb5_get_host_realm_int (context, host, use_dns, realms); - if (ret) { + if (ret && targethost != NULL) { /* - * If there was no realm mapping for the host guess at the - * local realm, maybe our KDC knows better then we do and we - * get a referral back. + * If there was no realm mapping for the host (and we wasn't + * looking for ourself), guess at the local realm, maybe our + * KDC knows better then we do and we get a referral back. */ ret = krb5_get_default_realms(context, realms); if (ret) { @@ -252,5 +253,5 @@ krb5_get_host_realm(krb5_context context, return KRB5_ERR_HOST_REALM_UNKNOWN; } } - return 0; + return ret; }