Do not try to reassign "const" variables
authorRichard Basch <probe@mit.edu>
Mon, 18 Mar 1996 19:21:13 +0000 (19:21 +0000)
committerRichard Basch <probe@mit.edu>
Mon, 18 Mar 1996 19:21:13 +0000 (19:21 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7657 dc483132-0cff-0310-8789-dd5450dbe970

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

index 1588e1372e06c830639a07938ef032568dcdbd30..c132d31acb83aa7a3652aea0637e00d7c7122d62 100644 (file)
@@ -1,3 +1,7 @@
+Mon Mar 18 14:18:58 EST 1996  Richard Basch  <basch@lehman.com>
+
+       * sn2princ.c: Do not try to re-assign const variables.
+
 Sun Mar 17 20:42:17 1996  Ezra Peisach  <epeisach@mit.edu>
 
         * configure.in: Add USE_ANAME, KRB5_LIBRARIES
index 7c577220a84101e0d0e4693f943845fd7246a6ce..2ddcefb9dedbd3678c5fce0f1b0db29bac443435 100644 (file)
@@ -45,30 +45,29 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ)
     krb5_error_code retval;
     register char *cp;
     char localname[MAXHOSTNAMELEN];
-
+    char *host = hostname;
+    char *service = sname;
 
     if ((type == KRB5_NT_UNKNOWN) ||
        (type == KRB5_NT_SRV_HST)) {
 
-       if (!hostname) {
-           /* convenience hack:  if hostname is NULL, use gethostname() */
+       /* if hostname is NULL, use local hostname */
+       if (! host) {
            if (gethostname(localname, MAXHOSTNAMELEN))
                return errno;
-           hostname = localname;
+           host = localname;
        }
 
        /* if sname is NULL, use "host" */
-
-       if (! sname) {
-           sname = "host";
-       }
+       if (! service)
+           service = "host";
 
        /* copy the hostname into non-volatile storage */
 
        if (type == KRB5_NT_SRV_HST) {
            char *addr;
            
-           if (!(hp = gethostbyname(hostname)))
+           if (!(hp = gethostbyname(host)))
                return KRB5_ERR_BAD_HOSTNAME;
            remote_host = strdup(hp->h_name);
            if (!remote_host)
@@ -91,7 +90,7 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ)
                    return ENOMEM;
            }
        } else /* type == KRB5_NT_UNKNOWN */ {
-           remote_host = strdup((char *) hostname);
+           remote_host = strdup((char *) host);
        }
        if (!remote_host)
            return ENOMEM;
@@ -114,7 +113,7 @@ krb5_sname_to_principal(context, hostname, sname, type, ret_princ)
 
 
        retval = krb5_build_principal(context, ret_princ, strlen(realm),
-                                     realm, sname, remote_host,
+                                     realm, service, remote_host,
                                      (char *)0);
 
        krb5_princ_type(context, *ret_princ) = type;