author | ssahoo |
Thu, 25 Jan 2018 05:57:22 -0800 | |
changeset 48668 | 2da4a52715d8 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
1 |
/* |
48668 | 2 |
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
4 |
* |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
8 |
* |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
14 |
* |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
18 |
* |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
21 |
* questions. |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
22 |
*/ |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
23 |
|
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
24 |
/* |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
25 |
* @test |
48668 | 26 |
* @bug 7152121 8194486 |
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
27 |
* @summary Krb5LoginModule no longer handles keyTabNames with "file:" prefix |
48668 | 28 |
* @library /test/lib |
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
29 |
* @compile -XDignore.symbol.file FileKeyTab.java |
48668 | 30 |
* @run main jdk.test.lib.FileInstaller TestHosts TestHosts |
31 |
* @run main/othervm -Djdk.net.hosts.file=TestHosts FileKeyTab |
|
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
32 |
*/ |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
33 |
|
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
34 |
import java.io.File; |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
35 |
import java.io.FileOutputStream; |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
36 |
|
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
37 |
// The basic krb5 test skeleton you can copy from |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
38 |
public class FileKeyTab { |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
39 |
|
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
40 |
public static void main(String[] args) throws Exception { |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
41 |
new OneKDC(null).writeJAASConf(); |
13592 | 42 |
String ktab = new File(OneKDC.KTAB).getAbsolutePath().replace('\\', '/'); |
13590
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
43 |
File f = new File(OneKDC.JAAS_CONF); |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
44 |
try (FileOutputStream fos = new FileOutputStream(f)) { |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
45 |
fos.write(( |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
46 |
"server {\n" + |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
47 |
" com.sun.security.auth.module.Krb5LoginModule required\n" + |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
48 |
" principal=\"" + OneKDC.SERVER + "\"\n" + |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
49 |
" useKeyTab=true\n" + |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
50 |
" keyTab=\"file:" + ktab + "\"\n" + |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
51 |
" storeKey=true;\n};\n" |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
52 |
).getBytes()); |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
53 |
} |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
54 |
Context.fromJAAS("server"); |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
55 |
} |
f7f85d7f7a82
7152121: Krb5LoginModule no longer handles keyTabNames with "file:" prefix
weijun
parents:
diff
changeset
|
56 |
} |