* Don't always use the default realm on localhost, so that the domain to realm mappin...
authorSam Hartman <hartmans@mit.edu>
Mon, 31 Jul 1995 22:21:19 +0000 (22:21 +0000)
committerSam Hartman <hartmans@mit.edu>
Mon, 31 Jul 1995 22:21:19 +0000 (22:21 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6371 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/ChangeLog
src/lib/krb5/os/sn2princ.c

index 18364eb8be055db50df3742aaeb5b0338755a1ba..128303b5e417e4215ecdc0458a9ec138452bef93 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jul 28 23:28:11 1995  Sam Hartman  <hartmans@tertius.mit.edu>
+
+       * 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.
index 6546b0041bb1c0a2f09f48921e52006a8fa56df8..7c577220a84101e0d0e4693f943845fd7246a6ce 100644 (file)
@@ -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;