summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-09-21 10:17:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:34 -0500
commit42f2519b507bcb70157039a390529bf4b5df4d9c (patch)
treead2ea8c81a8b83c2d35cedcc7f4fe8f2447fa57d
parente0739187715d6432ec00fc6aacfb20fe8f034bfa (diff)
downloadsamba-42f2519b507bcb70157039a390529bf4b5df4d9c.tar.gz
samba-42f2519b507bcb70157039a390529bf4b5df4d9c.tar.bz2
samba-42f2519b507bcb70157039a390529bf4b5df4d9c.zip
r10382: In the absence of client support for the full KDC-side
canonicalisation code, I've hacked Heimdal to use the default realm if no other realm can be determined for a given host. Andrew Bartlett (This used to be commit 0f0b0021b7728ce75ca0060003a3d08264ead810)
-rw-r--r--source4/heimdal/lib/krb5/get_host_realm.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source4/heimdal/lib/krb5/get_host_realm.c b/source4/heimdal/lib/krb5/get_host_realm.c
index feb01f0036..78684f20a9 100644
--- a/source4/heimdal/lib/krb5/get_host_realm.c
+++ b/source4/heimdal/lib/krb5/get_host_realm.c
@@ -187,15 +187,18 @@ _krb5_get_host_realm_int (krb5_context context,
return 0;
}
}
- p = strchr(host, '.');
- if(p != NULL) {
- p++;
- *realms = malloc(2 * sizeof(krb5_realm));
- if (*realms == NULL) {
+
+ *realms = malloc(2 * sizeof(krb5_realm));
+ if (*realms == NULL) {
krb5_set_error_string(context, "malloc: out of memory");
return ENOMEM;
- }
+ }
+
+ (*realms)[1] = NULL;
+ p = strchr(host, '.');
+ if(p != NULL) {
+ p++;
(*realms)[0] = strdup(p);
if((*realms)[0] == NULL) {
free(*realms);
@@ -203,11 +206,21 @@ _krb5_get_host_realm_int (krb5_context context,
return ENOMEM;
}
strupr((*realms)[0]);
- (*realms)[1] = NULL;
- return 0;
+ } else {
+ krb5_error_code ret;
+ ret = krb5_get_default_realm(context, &(*realms)[0]);
+ if(ret) {
+ free(*realms);
+ krb5_set_error_string(context, "malloc: out of memory");
+ return ENOMEM;
+ }
+ if((*realms)[0] == NULL) {
+ free(*realms);
+ krb5_set_error_string(context, "unable to find realm of host %s", host);
+ return KRB5_ERR_HOST_REALM_UNKNOWN;
+ }
}
- krb5_set_error_string(context, "unable to find realm of host %s", host);
- return KRB5_ERR_HOST_REALM_UNKNOWN;
+ return 0;
}
/*