11/*
2- * Copyright (c) 2009, 2018 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2009, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2323
2424/*
2525 * @test
26- * @bug 6851973 8194486
26+ * @bug 6851973 8194486 8279520
2727 * @summary ignore incoming channel binding if acceptor does not set one
2828 * @library /test/lib
2929 * @run main jdk.test.lib.FileInstaller TestHosts TestHosts
3333import java .net .InetAddress ;
3434import org .ietf .jgss .ChannelBinding ;
3535import org .ietf .jgss .GSSException ;
36+ import org .ietf .jgss .Oid ;
3637import sun .security .jgss .GSSUtil ;
3738
3839public class IgnoreChannelBinding {
@@ -41,33 +42,38 @@ public static void main(String[] args)
4142 throws Exception {
4243
4344 new OneKDC (null ).writeJAASConf ();
45+ test (GSSUtil .GSS_KRB5_MECH_OID );
46+ test (GSSUtil .GSS_SPNEGO_MECH_OID );
47+ }
48+
49+ static void test (Oid mech ) throws Exception {
4450
4551 Context c = Context .fromJAAS ("client" );
4652 Context s = Context .fromJAAS ("server" );
4753
4854 // All silent
49- c .startAsClient (OneKDC .SERVER , GSSUtil . GSS_KRB5_MECH_OID );
50- s .startAsServer (GSSUtil . GSS_KRB5_MECH_OID );
55+ c .startAsClient (OneKDC .SERVER , mech );
56+ s .startAsServer (mech );
5157 Context .handshake (c , s );
5258
5359 // Initiator req, acceptor ignore
54- c .startAsClient (OneKDC .SERVER , GSSUtil . GSS_KRB5_MECH_OID );
60+ c .startAsClient (OneKDC .SERVER , mech );
5561 c .x ().setChannelBinding (new ChannelBinding (
5662 InetAddress .getByName ("client.rabbit.hole" ),
5763 InetAddress .getByName ("host.rabbit.hole" ),
5864 new byte [0 ]
5965 ));
60- s .startAsServer (GSSUtil . GSS_KRB5_MECH_OID );
66+ s .startAsServer (mech );
6167 Context .handshake (c , s );
6268
6369 // Both req, and match
64- c .startAsClient (OneKDC .SERVER , GSSUtil . GSS_KRB5_MECH_OID );
70+ c .startAsClient (OneKDC .SERVER , mech );
6571 c .x ().setChannelBinding (new ChannelBinding (
6672 InetAddress .getByName ("client.rabbit.hole" ),
6773 InetAddress .getByName ("host.rabbit.hole" ),
6874 new byte [0 ]
6975 ));
70- s .startAsServer (GSSUtil . GSS_KRB5_MECH_OID );
76+ s .startAsServer (mech );
7177 s .x ().setChannelBinding (new ChannelBinding (
7278 InetAddress .getByName ("client.rabbit.hole" ),
7379 InetAddress .getByName ("host.rabbit.hole" ),
@@ -76,13 +82,13 @@ public static void main(String[] args)
7682 Context .handshake (c , s );
7783
7884 // Both req, NOT match
79- c .startAsClient (OneKDC .SERVER , GSSUtil . GSS_KRB5_MECH_OID );
85+ c .startAsClient (OneKDC .SERVER , mech );
8086 c .x ().setChannelBinding (new ChannelBinding (
8187 InetAddress .getByName ("client.rabbit.hole" ),
8288 InetAddress .getByName ("host.rabbit.hole" ),
8389 new byte [0 ]
8490 ));
85- s .startAsServer (GSSUtil . GSS_KRB5_MECH_OID );
91+ s .startAsServer (mech );
8692 s .x ().setChannelBinding (new ChannelBinding (
8793 InetAddress .getByName ("client.rabbit.hole" ),
8894 InetAddress .getByName ("host.rabbit.hole" ),
@@ -96,8 +102,8 @@ public static void main(String[] args)
96102 }
97103
98104 // Acceptor req, reject
99- c .startAsClient (OneKDC .SERVER , GSSUtil . GSS_KRB5_MECH_OID );
100- s .startAsServer (GSSUtil . GSS_KRB5_MECH_OID );
105+ c .startAsClient (OneKDC .SERVER , mech );
106+ s .startAsServer (mech );
101107 s .x ().setChannelBinding (new ChannelBinding (
102108 InetAddress .getByName ("client.rabbit.hole" ),
103109 InetAddress .getByName ("host.rabbit.hole" ),
0 commit comments