test/jdk/sun/security/krb5/auto/PrincipalNameEquals.java
author ssahoo
Thu, 25 Jan 2018 05:57:22 -0800
changeset 48668 2da4a52715d8
parent 47216 71c04702a3d5
permissions -rw-r--r--
8194486: Several krb5 tests failed in Mac. Summary: Several tests failed due to improper host service Reviewed-by: weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10141
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     1
/*
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 47216
diff changeset
     2
 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
10141
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     4
 *
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     8
 *
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    13
 * accompanied this code).
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    14
 *
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    18
 *
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    21
 * questions.
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    22
 */
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    23
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    24
/*
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    25
 * @test
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 47216
diff changeset
    26
 * @bug 7061379 8194486
10141
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    27
 * @summary [Kerberos] Cross-realm authentication fails, due to nameType problem
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 47216
diff changeset
    28
 * @library /test/lib
10141
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    29
 * @compile -XDignore.symbol.file PrincipalNameEquals.java
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 47216
diff changeset
    30
 * @run main jdk.test.lib.FileInstaller TestHosts TestHosts
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 47216
diff changeset
    31
 * @run main/othervm -Djdk.net.hosts.file=TestHosts PrincipalNameEquals
10141
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    32
 */
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    33
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    34
import sun.security.jgss.GSSUtil;
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    35
import sun.security.krb5.PrincipalName;
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    36
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    37
public class PrincipalNameEquals {
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    38
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    39
    public static void main(String[] args) throws Exception {
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    40
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    41
        OneKDC kdc = new OneKDC(null);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    42
        kdc.writeJAASConf();
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    43
        kdc.setOption(KDC.Option.RESP_NT, PrincipalName.KRB_NT_PRINCIPAL);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    44
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    45
        Context c, s;
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    46
        c = Context.fromJAAS("client");
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    47
        s = Context.fromJAAS("server");
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    48
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    49
        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    50
        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    51
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    52
        Context.handshake(c, s);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    53
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    54
        Context.transmit("i say high --", c, s);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    55
        Context.transmit("   you say low", s, c);
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    56
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    57
        s.dispose();
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    58
        c.dispose();
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    59
    }
664ba64d2472 7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff changeset
    60
}