Attempt to get the canonical name of a host before doing realm lookup, it
authortholo <tholo@openbsd.org>
Sat, 9 Mar 1996 20:11:52 +0000 (20:11 +0000)
committertholo <tholo@openbsd.org>
Sat, 9 Mar 1996 20:11:52 +0000 (20:11 +0000)
might be a CNAME which does not match anything we know about

kerberosIV/krb/getrealm.c

index f4bd245..4b3e0e9 100644 (file)
@@ -28,6 +28,7 @@ or implied warranty.
   */
 
 #include "krb_locl.h"
+#include <netdb.h>
 
 #define MATCH_SUBDOMAINS        0
 
@@ -64,8 +65,12 @@ krb_realmofhost(host)
        FILE *trans_file;
        char trans_host[MAXHOSTNAMELEN+1];
        char trans_realm[REALM_SZ+1];
+       struct hostent *hp;
        int retval;
 
+       if ((hp = gethostbyname(host)) != NULL)
+               host = hp->h_name;
+
        domain = strchr(host, '.');
 
        /* prepare default */