6919610: KeyTabInputStream uses static field for per-instance value
Reviewed-by: mullan
This commit is contained in:
parent
1891bb8f68
commit
4641ee098b
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Portions Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Portions Copyright 2000-2010 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
|
||||
@ -49,7 +49,7 @@ import java.io.InputStream;
|
||||
public class KeyTabInputStream extends KrbDataInputStream implements KeyTabConstants {
|
||||
|
||||
boolean DEBUG = Krb5.DEBUG;
|
||||
static int index;
|
||||
int index;
|
||||
|
||||
public KeyTabInputStream(InputStream is) {
|
||||
super(is);
|
||||
|
52
jdk/test/sun/security/krb5/ktab/KeyTabIndex.java
Normal file
52
jdk/test/sun/security/krb5/ktab/KeyTabIndex.java
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
/*
|
||||
* @test
|
||||
* @bug 6919610
|
||||
* @summary KeyTabInputStream uses static field for per-instance value
|
||||
*/
|
||||
import sun.security.krb5.PrincipalName;
|
||||
import sun.security.krb5.internal.ktab.KeyTab;
|
||||
|
||||
public class KeyTabIndex {
|
||||
public static void main(String[] args) throws Exception {
|
||||
KeyTab kt = KeyTab.create("ktab");
|
||||
// Two entries with very different length, so that it's easy to
|
||||
// observice the abnormal change of "index" field.
|
||||
kt.addEntry(new PrincipalName(
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@A"),
|
||||
"x".toCharArray(), 1);
|
||||
kt.addEntry(new PrincipalName("a@A"), "x".toCharArray(), 1);
|
||||
kt.save();
|
||||
Runnable t = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
KeyTab.getInstance("ktab").getClass();
|
||||
}
|
||||
};
|
||||
KeyTab.refresh();
|
||||
for (int i=0; i<10; i++) {
|
||||
new Thread(t).start();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user