5266N/A * Copyright (c) 1999, 2012, 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 Some java apps need to have access to read "accessClassInPackage.sun.rmi.server" 0N/A * @author Laird Dornin 0N/A * @library ../../../testlibrary 5551N/A * @build TestLibrary RMID ActivationLibrary 5551N/A * CanCreateStubs StubClassesPermitted_Stub 0N/A * The RMI activation system needs to explicitly allow itself to 0N/A * create the following sun.* classes on behalf of code that runs with 0N/A * user privileges and needs to make use of RMI activation: 0N/A * sun.rmi.server.Activation$ActivationMonitorImpl_Stub 0N/A * sun.rmi.server.Activation$ActivationSystemImpl_Stub 0N/A * sun.rmi.registry.RegistryImpl_Stub 0N/A * The test causes the activation system to need to create each of 0N/A * these classes in turn. The test will fail if the activation system 169N/A * does not allow these classes to be created. 169N/A // must run with java.lang.SecurityManager or the test 169N/A // result will be nullified if running with a build where 169N/A // 4180392 has not been fixed. 169N/A //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"}); 169N/A // Ensure that activation groups run with the correct 169N/A "java.lang.SecurityManager");
169N/A // This action causes the following classes to be created 169N/A // in this VM (RMI must permit the creation of these classes): 169N/A // sun.rmi.server.Activation$ActivationSystemImpl_Stub 169N/A // sun.rmi.server.Activation$ActivationMonitorImpl_Stub 169N/A // Fix for: 4271615: make sure activation group runs in a new VM 169N/A // ensure registry stub can be passed in a remote call 169N/A // make sure a client cant load just any sun.* class, just 169N/A // as a sanity check, try to create a class we are not 169N/A // allowed to access but which was passed in a remote call 169N/A " sun.security.provider.SecureRandom");
169N/A // Make sure we received a *local* AccessControlException 169N/A // make sure that an ActivationGroupID can be passed in a 169N/A // remote call; this is slightly more inclusive than 169N/A // just passing a reference to the activation system 169N/A (
"Deactivate object via method call");
169N/A (
"\nsuccess: StubClassesPermitted test passed ");
169N/A * implementation of CanCreateStubs 169N/A // obtain reference to the test registry 0N/A * Spawns a thread to deactivate the object. 0N/A * Thread to deactivate object. First attempts to make object 0N/A * inactive (via the inactive method). If that fails (the 0N/A * unexport the object forcibly. 0N/A * Return a reference to the RMI registry, to make sure that 0N/A * the stub for it can be deserialized in the test client VM. 0N/A * Remote call to create and return a random serializable sun.* 0N/A * class, the test should get a local security exception when 0N/A * trying to create the class. Ensure that not all sun.* classes 0N/A * can be resolved in a remote call. 0N/A * Ensures that an activation group id can be passed in a remote 0N/A * call (class may contain a remote reference to the activation 0N/A * system implementation).