From ca1987a7cc1612ef86bd2f372df2a329bb76ebb7 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 24 Jul 2001 20:29:38 +0000 Subject: [PATCH] 2001-07-24 Jeffrey Altman * def_realm.c: krb5_get_default_realm() required a profile file even when KRB5_DNS_LOOKUP was defined. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13634 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 6 ++++++ src/lib/krb5/os/def_realm.c | 30 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 5a4aeec93..7b09b1bfd 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,9 @@ +2001-07-24 Jeffrey Altman + + * def_realm.c: + krb5_get_default_realm() required a profile file + even when KRB5_DNS_LOOKUP was defined. + 2001-07-19 Ken Raeburn * hostaddr.c: Include fake-addrinfo.h. diff --git a/src/lib/krb5/os/def_realm.c b/src/lib/krb5/os/def_realm.c index 65e3902cd..82ef8ac32 100644 --- a/src/lib/krb5/os/def_realm.c +++ b/src/lib/krb5/os/def_realm.c @@ -86,23 +86,25 @@ krb5_get_default_realm(context, lrealm) * on the host's DNS domain. */ context->default_realm = 0; - if (context->profile == 0) - return KRB5_CONFIG_CANTOPEN; - retval = profile_get_string(context->profile, "libdefaults", - "default_realm", 0, 0, - &realm); - - if (!retval && realm) { - context->default_realm = malloc(strlen(realm) + 1); - if (!context->default_realm) { + if (context->profile != 0) { + retval = profile_get_string(context->profile, "libdefaults", + "default_realm", 0, 0, + &realm); + + if (!retval && realm) { + context->default_realm = malloc(strlen(realm) + 1); + if (!context->default_realm) { + profile_release_string(realm); + return ENOMEM; + } + strcpy(context->default_realm, realm); profile_release_string(realm); - return ENOMEM; } - strcpy(context->default_realm, realm); - profile_release_string(realm); } - -#ifdef KRB5_DNS_LOOKUP +#ifndef KRB5_DNS_LOOKUP + else + return KRB5_CONFIG_CANTOPEN; +#else /* KRB5_DNS_LOOKUP */ if (context->default_realm == 0) { int use_dns = _krb5_use_dns_realm(context); if ( use_dns ) { -- 2.26.2