From b905e53ad76c02f0406a66016d3a7d38a65e258f Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 1 Sep 1995 17:29:15 +0000 Subject: [PATCH] Makefile.in (check-unix): Add a test case to make sure krb5_get_host_realm does something sane when passed in a hostname which doesn't have a default domain. hst_realm.c (krb5_get_host_realm): If an hostname does not have a domain, don't try to get a domain default (which results in a strange error being returned). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6651 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 8 ++++++++ src/lib/krb5/os/Makefile.in | 2 +- src/lib/krb5/os/hst_realm.c | 14 ++++++++------ src/lib/krb5/os/ref_std_conf.out | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 41e501380..23aec1672 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,5 +1,13 @@ Fri Sep 1 00:47:27 1995 Theodore Y. Ts'o + * Makefile.in (check-unix): Add a test case to make sure + krb5_get_host_realm does something sane when passed in a + hostname which doesn't have a default domain. + + * hst_realm.c (krb5_get_host_realm): If an hostname does not have + a domain, don't try to get a domain default (which + results in a strange error being returned). + * toffset.c: Added new file which implements the abstract interfaces for manipulating the time offset fields in the os context. diff --git a/src/lib/krb5/os/Makefile.in b/src/lib/krb5/os/Makefile.in index 72228c303..81e46851b 100644 --- a/src/lib/krb5/os/Makefile.in +++ b/src/lib/krb5/os/Makefile.in @@ -121,7 +121,7 @@ check-unix:: $(TEST_PROGS) -k IGGY.ORG -k DEFAULT_REALM.TST \ -D DEFAULT_REALM.TST -r bad.idea -r itar.bad.idea \ -r really.BAD.IDEA. -r clipper.bad.idea -r KeYEsCrOW.BaD.IDea \ - -r pgp.good.idea > test.out + -r pgp.good.idea -r no_domain > test.out cmp test.out $(srcdir)/ref_std_conf.out $(RM) test.out diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index 3cd135566..5ecbd6ebd 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -123,12 +123,14 @@ krb5_get_host_realm(context, host, realmsp) } } - retval = profile_get_string(context->profile, "domain_realm", domain, - 0, default_realm, &realm); - free(default_realm); - if (retval) - return retval; - default_realm = realm; + if (domain) { + retval = profile_get_string(context->profile, "domain_realm", + domain, 0, default_realm, &realm); + free(default_realm); + if (retval) + return retval; + default_realm = realm; + } retval = profile_get_string(context->profile, "domain_realm", local_host, 0, default_realm, &realm); diff --git a/src/lib/krb5/os/ref_std_conf.out b/src/lib/krb5/os/ref_std_conf.out index 45270828a..273a7664b 100644 --- a/src/lib/krb5/os/ref_std_conf.out +++ b/src/lib/krb5/os/ref_std_conf.out @@ -10,3 +10,4 @@ krb_get_host_realm(really.BAD.IDEA.) returned: 'NSA.GOV' krb_get_host_realm(clipper.bad.idea) returned: 'NIST.GOV' krb_get_host_realm(KeYEsCrOW.BaD.IDea) returned: 'NSA.GOV' krb_get_host_realm(pgp.good.idea) returned: 'GOOD.IDEA' +krb_get_host_realm(no_domain) returned: 'NEW.DEFAULT.REALM' -- 2.26.2