jdk/test/sun/security/krb5/auto/KDC.java
changeset 1456 1d3c6724de2f
parent 1454 d9b6f1de641f
child 1575 e0f1979051b5
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Fri Oct 17 00:51:59 2008 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Mon Oct 20 10:32:33 2008 +0800
@@ -152,12 +152,19 @@
                 return;
             }
         }
+        String localhost = "localhost";
+        try {
+            localhost = InetAddress.getByName(localhost)
+                    .getCanonicalHostName();
+        } catch (UnknownHostException uhe) {
+            ;   // Ignore, localhost is still "localhost"
+        }
         KDC kdc = create("RABBIT.HOLE", 8888, false);
         kdc.addPrincipal("dummy", "bogus".toCharArray());
         kdc.addPrincipal("foo", "bar".toCharArray());
         kdc.addPrincipalRandKey("krbtgt/" + kdc.realm);
-        kdc.addPrincipalRandKey("server/localhost");
-        kdc.addPrincipalRandKey("backend/localhost");
+        kdc.addPrincipalRandKey("server/" + localhost);
+        kdc.addPrincipalRandKey("backend/" + localhost);
     }
 
     /**