From: Richard Basch Date: Mon, 18 Mar 1996 19:21:13 +0000 (+0000) Subject: Do not try to reassign "const" variables X-Git-Tag: krb5-1.0-beta6~345 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7cd938b8c4ca087f055089c113aced6c91f07131;p=krb5.git Do not try to reassign "const" variables git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7657 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 1588e1372..c132d31ac 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 18 14:18:58 EST 1996 Richard Basch + + * sn2princ.c: Do not try to re-assign const variables. + Sun Mar 17 20:42:17 1996 Ezra Peisach * configure.in: Add USE_ANAME, KRB5_LIBRARIES diff --git a/src/lib/krb5/os/sn2princ.c b/src/lib/krb5/os/sn2princ.c index 7c577220a..2ddcefb9d 100644 --- a/src/lib/krb5/os/sn2princ.c +++ b/src/lib/krb5/os/sn2princ.c @@ -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;