--- old/src/share/lib/security/java.security Tue Feb 22 13:11:40 2011 +++ new/src/share/lib/security/java.security Tue Feb 22 13:11:40 2011 @@ -123,7 +123,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.imageio. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio. # # List of comma-separated packages that start with or equal this string --- old/src/share/lib/security/java.security-solaris Tue Feb 22 13:11:41 2011 +++ new/src/share/lib/security/java.security-solaris Tue Feb 22 13:11:40 2011 @@ -124,7 +124,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.imageio. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio. # # List of comma-separated packages that start with or equal this string --- old/src/share/lib/security/java.security-windows Tue Feb 22 13:11:41 2011 +++ new/src/share/lib/security/java.security-windows Tue Feb 22 13:11:41 2011 @@ -124,7 +124,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.imageio. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio. # # List of comma-separated packages that start with or equal this string --- /dev/null Tue Feb 22 13:11:42 2011 +++ new/test/com/sun/org/apache/xml/internal/ws/server/Test.java Tue Feb 22 13:11:42 2011 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6592792 + * @summary Add com.sun.xml.internal to the "package.access" property in $JAVA_HOME/lib/security/java.security + * @run shell Test6592792.sh + */ + +import java.lang.*; +import java.lang.reflect.*; +import com.sun.xml.internal.ws.server.*; +import com.sun.xml.internal.ws.server.SingletonResolver; +import com.sun.xml.internal.ws.api.server.*; + +public class Test { + + public static void main(String[] args) throws Exception{ + // Enable the security manager + SecurityManager sm = new SecurityManager(); + System.setSecurityManager(sm); + new Test(); + } + + Object invokeMethod(Object target,Method m,Object args[]) throws Exception { + SingletonResolver r = new SingletonResolver(target); + Invoker invoker = r.createInvoker(); + return invoker.invoke(null, m, args); + } + + public Test() throws Exception{ + try { + Class c=Class.forName("java.lang.Class"); + + Class ctab[]=new Class[1]; + ctab[0]=Class.forName("java.lang.String"); + Method forName=c.getMethod("forName",ctab); + + Class gtab[]=new Class[2]; + gtab[0]=Class.forName("java.lang.String"); + gtab[1]=Class[].class; + Method getMethod=c.getMethod("getMethod",gtab); + + Method newInstance=c.getMethod("newInstance",(Class[])null); + + Object otab[]=new Object[1]; + otab[0]="sun.misc.Unsafe"; + + Object o=invokeMethod(null,forName,otab); + c = (Class)o; // sun.misc.Unsafe class + // Test FAILED: Should n't have got the reference. + throw new RuntimeException("Test Failed: Got reference to: "+o); + + + //o=invokeMethod(c,getMethod, new Object[]{"getUnsafe", (Class[])null}); + //System.out.println("Got reference to: "+o); + //throw new RuntimeException("Got reference to: "+o); + //o=invokeMethod(c,(Method)o,null); + //System.out.println("Got reference to: "+o); + //throw new RuntimeException("Got reference to: "+o); + + } catch(java.security.AccessControlException e) { + System.out.println("Test passed"); + //e.printStackTrace(); + } + } +} --- /dev/null Tue Feb 22 13:11:43 2011 +++ new/test/com/sun/org/apache/xml/internal/ws/server/Test6592792.sh Tue Feb 22 13:11:42 2011 @@ -0,0 +1,84 @@ +#!/bin/sh + +# +# Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +if [ "${TESTSRC}" = "" ] +then TESTSRC=. +fi + +if [ "${TESTJAVA}" = "" ] +then + PARENT=`dirname \`which java\`` + TESTJAVA=`dirname ${PARENT}` + echo "TESTJAVA not set, selecting " ${TESTJAVA} + echo "If this is incorrect, try setting the variable manually." +fi + +if [ "${TESTCLASSES}" = "" ] +then + echo "TESTCLASSES not set. Test cannot execute. Failed." + exit 1 +fi + +BIT_FLAG="" + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + SunOS | Linux ) + NULL=/dev/null + PS=":" + FS="/" + ## for solaris, linux it's HOME + FILE_LOCATION=$HOME + if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ] + then + BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT` + fi + ;; + Windows_* ) + NULL=NUL + PS=";" + FS="\\" + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + +JEMMYPATH=${CPAPPEND} +CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH + +THIS_DIR=`pwd` + +${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version + +${TESTJAVA}${FS}bin${FS}javac ${BIT_FLAG} -d . -cp ${TESTJAVA}${FS}jre${FS}lib${FS}rt.jar ${TESTSRC}${FS}Test.java + +${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -cp . Test + +STATUS=$? + +exit $STATUS