From 18609dbe95cae9c0ac72c826a2bfb27cdfcc5232 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Mon, 31 Jul 1995 22:21:19 +0000 Subject: [PATCH] * Don't always use the default realm on localhost, so that the domain to realm mapping can be used to overide for localhost git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6371 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 5 +++++ src/lib/krb5/os/sn2princ.c | 17 +++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 18364eb8b..128303b5e 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 28 23:28:11 1995 Sam Hartman + + * sn2princ.c (krb5_sname_to_principal): GDon't use default realm + just because we are on local machine. Instead, go through normal + translations. Fri Jul 7 16:32:41 EDT 1995 Paul Park (pjpark@mit.edu) * Makefile.in - Find com_err in TOPLIBD. diff --git a/src/lib/krb5/os/sn2princ.c b/src/lib/krb5/os/sn2princ.c index 6546b0041..7c577220a 100644 --- a/src/lib/krb5/os/sn2princ.c +++ b/src/lib/krb5/os/sn2princ.c @@ -45,13 +45,12 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ) krb5_error_code retval; register char *cp; char localname[MAXHOSTNAMELEN]; - int use_local_realm = 0; + if ((type == KRB5_NT_UNKNOWN) || (type == KRB5_NT_SRV_HST)) { if (!hostname) { - use_local_realm = 1; /* convenience hack: if hostname is NULL, use gethostname() */ if (gethostname(localname, MAXHOSTNAMELEN)) return errno; @@ -92,7 +91,7 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ) return ENOMEM; } } else /* type == KRB5_NT_UNKNOWN */ { - remote_host = strdup(hostname); + remote_host = strdup((char *) hostname); } if (!remote_host) return ENOMEM; @@ -102,12 +101,6 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ) if (isupper(*cp)) *cp = tolower(*cp); - if (use_local_realm) { - if (retval = krb5_get_default_realm(context, &realm)) { - free(remote_host); - return retval; - } - } else { if (retval = krb5_get_host_realm(context, remote_host, &hrealms)) { free(remote_host); return retval; @@ -118,7 +111,7 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ) return KRB5_ERR_HOST_REALM_UNKNOWN; } realm = hrealms[0]; - } + retval = krb5_build_principal(context, ret_princ, strlen(realm), realm, sname, remote_host, @@ -127,8 +120,8 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ) krb5_princ_type(context, *ret_princ) = type; free(remote_host); - if (!use_local_realm) - krb5_free_host_realm(context, hrealms); + + krb5_free_host_realm(context, hrealms); return retval; } else { return KRB5_SNAME_UNSUPP_NAMETYPE; -- 2.26.2