jdk/test/sun/security/krb5/auto/OneKDC.java
changeset 3046 dd50d75d88e6
parent 1456 1d3c6724de2f
child 4531 3a9206343ab2
--- a/jdk/test/sun/security/krb5/auto/OneKDC.java	Tue Jun 16 20:46:25 2009 +0800
+++ b/jdk/test/sun/security/krb5/auto/OneKDC.java	Wed Jun 17 15:26:58 2009 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,35 +46,22 @@
  */
 public class OneKDC extends KDC {
 
-    // The krb5 codes would try to canonicalize hostnames before creating
-    // a service principal name, so let's find out the canonicalized form
-    // of localhost first. The following codes mimic the process inside
-    // PrincipalName.java.
-    static String localhost = "localhost";
-    static {
-        try {
-            localhost = InetAddress.getByName(localhost)
-                    .getCanonicalHostName();
-        } catch (UnknownHostException uhe) {
-            ;   // Ignore, localhost is still "localhost"
-        }
-    }
     public static final String USER = "dummy";
     public static final char[] PASS = "bogus".toCharArray();
-    public static String SERVER = "server/" + localhost;
-    public static String BACKEND = "backend/" + localhost;
     public static final String KRB5_CONF = "localkdc-krb5.conf";
     public static final String KTAB = "localkdc.ktab";
     public static final String JAAS_CONF = "localkdc-jaas.conf";
     public static final String REALM = "RABBIT.HOLE";
-
+    public static String SERVER = "server/host." + REALM.toLowerCase();
+    public static String BACKEND = "backend/host." + REALM.toLowerCase();
+    public static String KDCHOST = "kdc." + REALM.toLowerCase();
     /**
      * Creates the KDC and starts it.
      * @param etype Encryption type, null if not specified
      * @throws java.lang.Exception if there's anything wrong
      */
     public OneKDC(String etype) throws Exception {
-        super(REALM, 0, true);
+        super(REALM, KDCHOST, 0, true);
         addPrincipal(USER, PASS);
         addPrincipalRandKey("krbtgt/" + REALM);
         addPrincipalRandKey(SERVER);