From: John Kohl Date: Wed, 27 Feb 1991 13:32:09 +0000 (+0000) Subject: make it implement spec via gethostname X-Git-Tag: krb5-1.0-alpha4~167 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5941642db5333a4f12eb04a53e1873d6600281ed;p=krb5.git make it implement spec via gethostname git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1805 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index 0b17b4198..d899df064 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -81,6 +81,7 @@ char ***realmsp; char *domain; FILE *trans_file; char trans_host[MAXHOSTNAMELEN+1]; + char local_host[MAXHOSTNAMELEN+1]; char trans_realm[DEF_REALMNAME_SIZE]; krb5_error_code retval; int scanval; @@ -89,6 +90,12 @@ char ***realmsp; if (!(retrealms = (char **)calloc(2, sizeof(*retrealms)))) return ENOMEM; + if (!host) { + if (gethostname(local_host, sizeof(local_host)-1) == -1) + return errno; + local_host[sizeof(local_host)-1] = '\0'; + host = local_host; + } domain = strchr(host, '.'); /* prepare default */