make it implement spec via gethostname
authorJohn Kohl <jtkohl@mit.edu>
Wed, 27 Feb 1991 13:32:09 +0000 (13:32 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Wed, 27 Feb 1991 13:32:09 +0000 (13:32 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1805 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/hst_realm.c

index 0b17b4198ac3d6a49249a51d27711eaa87103bc6..d899df0647c3bb96c7123db9a1a19630b006c11a 100644 (file)
@@ -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 */