2362N/A * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @summary parser incorrectly ignores a principal if the principal name 0N/A * expands to nothing. this test is a bit complicated. 0N/A * the test itself. this test creates a Subject with a 0N/A * SolarisPrincipal("TestPrincipal") and calls doAs 0N/A * with a PrincipalExpansionErrorAction. 0N/A * 2) PrincipalExpansionErrorAction 0N/A * this action tries to read the file, /testfile 0N/A * 3) to run the test: 0N/A * b) PrincipalExpansionError is compiled and put into 0N/A * the "test.classes" directory 0N/A * c) PrincipalExpansionErrorAction is compiled and put into 0N/A * the "test.classes"/apackage directory 0N/A * (since it belongs to the 'apackage' package 0N/A * d) the PrincipalExpansionError shell script moves 0N/A * this guarantees that the test will run 0N/A * with codebase test.classes, and the action 0N/A * will run with codebase test.src. 0N/A * e) the test is executed. permissions to read the file, 0N/A * /testfile, were granted to the PrincipalExpansionError. 0N/A * the policy entry for PrincipalExpansionErrorAction 0N/A * running as SolarisPrincipal("TestPrincipal") 0N/A * was also granted the file permission, 0N/A * but it has a bogus second SolarisPrincipal with 0N/A * a name that can't be property-expanded. 0N/A * the old behavior of the code would ignore the 0N/A * bogus entry and incorrectly grants the file permission 0N/A * to SolarisPrincipal("TestPrincipal"). 0N/A * the new behavior correctly ignores the entire 0N/A * Please note that the jtreg needs to be granted 0N/A * allpermissions for this test to succeed. If the codebase 0N/A * for jtreg changes, the PrincipalExpansionError.policy 0N/A * needs to be updated. 0N/A * f) original @ tags: 0N/A * run shell PrincipalExpansionError.sh 0N/A * -Djava.security.debug=access,domain,failure 0N/A * PrincipalExpansionError 0N/A * @ignore unable to rely on location or javatest.jar 0N/A * (so we can grant it AllPermission) 0N/A // test incorrectly set up 0N/A (
"PrincipalExpansionError test incorrectly set up:" +
se);
0N/A (
"PrincipalExpansionError test failed (file not found)");
0N/A "test failed (file not found)");
0N/A // good! test succeeded