Author: abartlet Date: 2005-12-13 15:35:22 +0000 (Tue, 13 Dec 2005) New Revision: 506
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=506 Log: In lorikeet-heimdal, if the local hostname is not fully qualified, we will not do DNS lookups to try and guess a realm. This means we will look for the default realm of our hostname. I added code that uses our default realm from the config file as the fallback here, but this now recurses in the absense of [libdefualts] default_realm. So, this patch avoids recursion in the case were we don't have a default realm in the krb5.conf, and makes the tests pass again by specifying one into the config file. Andrew Bartlett Modified: trunk/heimdal/lib/krb5/set_default_realm.c trunk/heimdal/tests/db/krb5.conf.in Changeset: Modified: trunk/heimdal/lib/krb5/set_default_realm.c =================================================================== --- trunk/heimdal/lib/krb5/set_default_realm.c 2005-12-12 15:11:31 UTC (rev 505) +++ trunk/heimdal/lib/krb5/set_default_realm.c 2005-12-13 15:35:22 UTC (rev 506) @@ -77,8 +77,19 @@ "libdefaults", "default_realm", NULL); - if (realms == NULL) - ret = krb5_get_host_realm(context, NULL, &realms); + if (realms == NULL) { + char hostname[MAXHOSTNAMELEN]; + if (gethostname (hostname, sizeof(hostname))) { + return errno; + } + + if (strchr(hostname, '.') == NULL) { + /* There is no way we can get this mapping, as we can't do DNS */ + return KRB5_CONFIG_NODEFREALM; + } + ret = krb5_get_host_realm(context, hostname, + &realms); + } } else { ret = string_to_list (context, realm, &realms); } Modified: trunk/heimdal/tests/db/krb5.conf.in =================================================================== --- trunk/heimdal/tests/db/krb5.conf.in 2005-12-12 15:11:31 UTC (rev 505) +++ trunk/heimdal/tests/db/krb5.conf.in 2005-12-13 15:35:22 UTC (rev 506) @@ -1,3 +1,5 @@ +[libdefaults] +default_realm = EXAMPLE.ORG [realms] EXAMPLE.ORG = {