changeset 894:10c82a89e8e8

Merge
author asaha
date Tue, 01 Oct 2013 12:31:55 -0700
parents 47d37ba79129 b1f069eb48ed
children c3a9d8ffbd69
files .hgtags
diffstat 6 files changed, 134 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Sep 12 17:17:16 2013 -0700
+++ b/.hgtags	Tue Oct 01 12:31:55 2013 -0700
@@ -302,6 +302,22 @@
 161ec4dd450d59e1b8ad136db231925c97ff6205 jdk7u25-b09
 c9da98e82bb006dccd94a50871d6cdb66fa2d7e7 jdk7u25-b10
 109386df5b8e259d0af802217769a3c448404e49 jdk7u25-b11
+38282b734daefcbb8155b7d7ef9664130330ed14 jdk7u14-b16
+8b1d77697ca4d2a9c29d67fd2ff03aded9b06012 jdk7u14-b17
+862b43d26e03bbceb3465f93354860e0d17eb324 jdk7u14-b18
+bfbaab73969d4d978d0280d6ad51bac8c47dbaf8 jdk7u14-b19
+bfbaab73969d4d978d0280d6ad51bac8c47dbaf8 jdk7u14-b19
+a921b45a1f9086a7d598a76f920639050386f996 jdk7u14-b19
+54320e5d9da60df24f0e2c57c011809911dc06e1 jdk7u14-b20
+fb590ca4de9aaf1f6bca945be040dffc55b5e8d2 jdk7u14-b21
+e5d89aa2c1a11dba841a646858dda9ea18dc8f57 jdk7u14-b22
+d85df1552f877a1cc51f43bc07a42a0c48f18e0b jdk7u40-b23
+d3ab3b19caa02ee85359cfe07b6e0b74eb7b3d74 jdk7u40-b24
+abfc54516d0b7f9aed34ef175f6bbb93fda4cbb3 jdk7u40-b25
+be9099c54a35c00d0dfe6beeed8ea5d4ab3cd3fe jdk7u40-b26
+f745eeabb0eaabe8c0835c175b31f1e1c0f00bd4 jdk7u40-b27
+c8b9201f88f4ce417df7a40efcb7fef656d94512 jdk7u40-b28
+1ad0a5a3f7b1e9d95670d733d7e70714050ba6bf jdk7u40-b29
 ef8e6f8305d524f3b448a85f901aadf1adc81fc0 jdk7u25-b12
 eca480919c71072a31f62a61cb3aad30677007e3 jdk7u25-b13
 577c4dd1a6e9bc1bb2c2e5d5ecbab8eacb4121af jdk7u25-b14
@@ -342,4 +358,20 @@
 acb0571052b8dbef036fc50235ef95c0a46cff6b jdk7u40-b41
 b4a480a039bc19b27bfb5fcbbbf75e651d2718b7 jdk7u40-b42
 e29ea0b297e519010e661603a07bb8d48fa904a2 jdk7u40-b43
+08737d863a7aa5eb39374b26c9585e1770affe92 jdk7u40-b60
+4f54264ca4df2fc50fbb9bb2654dad97776d10ac jdk7u45-b01
+1a1a1dedf437c50797a49c21a12161a79c761757 jdk7u45-b02
+3a2cca8c2f209b533af6c1201cc8aee43628e578 jdk7u45-b03
+4f4f7869bd6585042ad9596426dd1aa0829b8e98 jdk7u45-b04
+faee62d13040eae3d081f0383843a391ceef1edd jdk7u45-b05
+435dd0e1ab9ec9cbc83dc5ed260886f6becbef25 jdk7u45-b06
+2e19615f6045c3f39e39c56c485f7bc1df97e2ce jdk7u45-b07
+771c5c869d16d2da5668e412f505ad75f8f610c1 jdk7u45-b08
+a89d69bef3614f618843f5e9a495b12d13597851 jdk7u45-b09
+fd8a2041b75c4f712f2b08d627388d44a0cf2ee7 jdk7u45-b10
+55e0d3d9514343f380336b68aa8691a89b2e710b jdk7u45-b11
+336566c2905a49fc9a6f90f5ecd30517cfcaefff jdk7u45-b12
+6cadc3dd82a423f6c24460bb1997c0f39159dd93 jdk7u45-b13
+43e22471d0c29451f282b162864c2d3e494d5871 jdk7u45-b14
+3d7a52de59f03589d7a9334a6895063ff3331bfc jdk7u45-b15
 c5b5886004e6446b8b27ccdc1fd073354c1dc614 jdk7u60-b00
--- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java	Thu Sep 12 17:17:16 2013 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java	Tue Oct 01 12:31:55 2013 -0700
@@ -905,28 +905,4 @@
 
         return contents.toString();
     }
-
-    public static void main(String[] args) {
-
-        Class remoteInterface = java.rmi.Remote.class;
-
-        if( args.length > 0 ) {
-            String className = args[0];
-            try {
-                remoteInterface = Class.forName(className);
-            } catch(Exception e) {
-                e.printStackTrace();
-                System.exit(-1);
-            }
-        }
-
-        System.out.println("Building name translation for " + remoteInterface);
-        try {
-            IDLNameTranslator nameTranslator =
-                IDLNameTranslatorImpl.get(remoteInterface);
-            System.out.println(nameTranslator);
-        } catch(IllegalStateException ise) {
-            ise.printStackTrace();
-        }
-    }
 }
--- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java	Thu Sep 12 17:17:16 2013 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java	Tue Oct 01 12:31:55 2013 -0700
@@ -43,6 +43,8 @@
 import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ;
 import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ;
 import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory
 {
@@ -114,24 +116,32 @@
         // which extends org.omg.CORBA.Object.  This handler delegates all
         // calls directly to a DynamicStubImpl, which extends
         // org.omg.CORBA.portable.ObjectImpl.
-        InvocationHandler dynamicStubHandler =
+        final InvocationHandler dynamicStubHandler =
             DelegateInvocationHandlerImpl.create( stub ) ;
 
         // Create an invocation handler that handles any remote interface
         // methods.
-        InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
+        final InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
             pm, classData, stub ) ;
 
         // Create a composite handler that handles the DynamicStub interface
         // as well as the remote interfaces.
         final CompositeInvocationHandler handler =
             new CustomCompositeInvocationHandlerImpl( stub ) ;
+
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
         handler.addInvocationHandler( DynamicStub.class,
             dynamicStubHandler ) ;
         handler.addInvocationHandler( org.omg.CORBA.Object.class,
             dynamicStubHandler ) ;
         handler.addInvocationHandler( Object.class,
             dynamicStubHandler ) ;
+                return null;
+            }
+        });
+
 
         // If the method passed to invoke is not from DynamicStub or its superclasses,
         // it must be from an implemented interface, so we just handle
--- a/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java	Thu Sep 12 17:17:16 2013 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java	Tue Oct 01 12:31:55 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -55,7 +55,7 @@
 /**
  * @author Harold Carr
  */
-public class SelectorImpl
+class SelectorImpl
     extends
         Thread
     implements
--- a/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java	Thu Sep 12 17:17:16 2013 -0700
+++ b/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java	Tue Oct 01 12:31:55 2013 -0700
@@ -36,6 +36,7 @@
 
 import com.sun.corba.se.spi.logging.CORBALogDomains ;
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission;
 
 public class CompositeInvocationHandlerImpl implements
     CompositeInvocationHandler
@@ -46,11 +47,13 @@
     public void addInvocationHandler( Class interf,
         InvocationHandler handler )
     {
+        checkAccess();
         classToInvocationHandler.put( interf, handler ) ;
     }
 
     public void setDefaultHandler( InvocationHandler handler )
     {
+        checkAccess();
         defaultHandler = handler ;
     }
 
@@ -78,4 +81,12 @@
 
         return handler.invoke( proxy, method, args ) ;
     }
+
+    private static final DynamicAccessPermission perm = new DynamicAccessPermission("access");
+    private void checkAccess() {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(perm);
 }
+    }
+}
--- a/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Thu Sep 12 17:17:16 2013 -0700
+++ b/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Tue Oct 01 12:31:55 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -34,6 +34,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.Enumeration;
@@ -49,6 +52,7 @@
 import com.sun.corba.se.impl.util.PackagePrefixChecker;
 import sun.rmi.rmic.Main;
 
+
 /**
  * An IIOP stub/tie generator for rmic.
  *
@@ -78,6 +82,7 @@
     protected boolean castArray = false;
     protected Hashtable transactionalObjects = new Hashtable() ;
     protected boolean POATie = false ;
+    protected boolean emitPermissionCheck = false;
 
     /**
      * Default constructor for Main to use.
@@ -193,6 +198,9 @@
                     } else if (argv[i].equals("-standardPackage")) {
                         standardPackage = true;
                         argv[i] = null;
+                    } else if (argv[i].equals("-emitPermissionCheck")) {
+                        emitPermissionCheck = true;
+                        argv[i] = null;
                     } else if (arg.equals("-xstubbase")) {
                         argv[i] = null;
                         if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) {
@@ -390,9 +398,22 @@
 
         writePackageAndImports(p);
 
+//        generate
+//        import java.security.AccessController;
+//        import java.security.PrivilegedAction;
+//        import java.io.SerializablePermission;
+        if (emitPermissionCheck) {
+            p.pln("import java.security.AccessController;");
+            p.pln("import java.security.PrivilegedAction;");
+            p.pln("import java.io.SerializablePermission;");
+            p.pln();
+            p.pln();
+        }
+
         // Declare the stub class; implement all remote interfaces.
 
         p.p("public class " + currentClass);
+
         p.p(" extends " + getName(stubBaseClass));
         p.p(" implements ");
         if (remoteInterfaces.length > 0) {
@@ -422,6 +443,56 @@
         writeIds( p, theType, false );
         p.pln();
 
+        if (emitPermissionCheck) {
+
+            // produce the following generated code
+            // private static Void checkPermission() {
+            // SecurityManager sm = System.getSecurityManager();
+            // if (sm != null) {
+            //     sm.checkPermission(new SerializablePermission(
+            // "enableSubclassImplementation")); // testing
+            // }
+            // return null;
+            // }
+            //
+            // private _XXXXXX_Stub(Void ignore) {
+            // }
+            //
+            // public _XXXXXX_Stub() {
+            // this(checkPermission());
+            // }
+            // where XXXXXX is the name of the remote interface
+
+                p.pln();
+                p.plnI("private static Void checkPermission() {");
+                p.plnI("SecurityManager sm = System.getSecurityManager();");
+                p.pln("if (sm != null) {");
+                p.pI();
+                p.plnI("sm.checkPermission(new SerializablePermission(");
+                p.plnI("\"enableSubclassImplementation\"));");
+                p.pO();
+                p.pO();
+                p.pOln("}");
+                p.pln("return null;");
+                p.pO();
+                p.pOln("}");
+                p.pln();
+                p.pO();
+
+                p.pI();
+                p.pln("private " + currentClass + "(Void ignore) {  }");
+                p.pln();
+
+                p.plnI("public " + currentClass + "() { ");
+                p.pln("this(checkPermission());");
+                p.pOln("}");
+                p.pln();
+        }
+
+       if (!emitPermissionCheck) {
+            p.pI();
+       }
+
         // Write the _ids() method...
 
         p.plnI("public String[] _ids() { ");
@@ -815,7 +886,6 @@
                             CompoundType theType) throws IOException {
 
         // Wtite the method declaration and opening brace...
-
         String methodName = method.getName();
         String methodIDLName = method.getIDLName();
 
@@ -1631,7 +1701,7 @@
 
         // Write data members...
         p.pln();
-        p.pln("private " + getName(theType) + " target = null;");
+        p.pln("volatile private " + getName(theType) + " target = null;");
         p.pln();
 
         // Write the ids...
@@ -1695,6 +1765,10 @@
 
         if (remoteMethods.length > 0) {
             p.plnI("try {");
+            p.pln(getName(theType) + " target = this.target;");
+            p.plnI("if (target == null) {");
+            p.pln("throw new java.io.IOException();");
+            p.pOln("}");
             p.plnI(idExtInputStream + " "+in+" = ");
             p.pln("(" + idExtInputStream + ") "+_in+";");
             p.pO();