changeset 1346:00603805a6a3

Merge from main OpenJDK repository
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 20 Aug 2016 11:56:18 -0700
parents 8ca8e0cf891e (current diff) 96061c8b1b46 (diff)
children 1b83bb5d8cc6
files .hgtags
diffstat 4 files changed, 59 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Sun May 01 16:42:06 2016 -0700
+++ b/.hgtags	Sat Aug 20 11:56:18 2016 -0700
@@ -607,3 +607,5 @@
 96b735f85c61ad721113713551271106a5070742 jdk7u95-b00
 adda687205a9a40573fdb538240a5699fdc7dbd6 jdk7u99-b00
 9c164195bcc97da6c6567e6e6d55ea349f1c583d jdk7u101-b00
+c1def4cc27fb92914168a5f65658eba4a1754dfe jdk7u111-b00
+36715cc029596f86e977d486e547f62bb07eed74 jdk7u111-b01
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java	Sun May 01 16:42:06 2016 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java	Sat Aug 20 11:56:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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,21 +34,13 @@
 import java.security.Policy;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.Collection;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Enumeration;
-import java.util.Properties;
-import java.util.IdentityHashMap;
 import java.util.StringTokenizer;
 import java.util.NoSuchElementException;
 
@@ -165,8 +157,18 @@
      * Return default ValueHandler
      */
     public static ValueHandler createValueHandler() {
+        ValueHandler vh;
+        try {
+            vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
+                public ValueHandler run() throws Exception {
         return Util.createValueHandler();
     }
+            });
+        } catch (PrivilegedActionException e) {
+            throw new InternalError(e.getMessage());
+        }
+        return vh;
+    }
 
     /**
      * Returns true if it was accurately determined that the remote ORB is
@@ -664,7 +666,16 @@
      * ValueHandler.
      */
     public static byte getMaxStreamFormatVersion() {
-        ValueHandler vh = Util.createValueHandler();
+        ValueHandler vh;
+        try {
+            vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
+                public ValueHandler run() throws Exception {
+                    return Util.createValueHandler();
+                }
+            });
+        } catch (PrivilegedActionException e) {
+            throw new InternalError(e.getMessage());
+        }
 
         if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
             return ORBConstants.STREAM_FORMAT_VERSION_1;
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties	Sun May 01 16:42:06 2016 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties	Sat Aug 20 11:56:18 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2016, 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
@@ -103,5 +103,5 @@
 tnameserv.hs3=\u5C31\u7DD2\u3002
 
 orbd.commfailure=\n\u56E0\u70BA ORBinitialPort \u5728\u4F7F\u7528\u4E2D\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002
-orbd.internalexception=\n\u56E0\u70BA\u5167\u90E8\u767C\u751F\u7570\u5E38\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002 \n\u53EF\u80FD\u7684\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5728\u4F7F\u7528\u4E2D\u3002 \n2. \u6C92\u6709\u5BEB\u5165 orb.db \u7684\u6B0A\u9650\u3002 
+orbd.internalexception=\n\u56E0\u70BA\u5167\u90E8\u767C\u751F\u7570\u5E38\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002\n\u53EF\u80FD\u7684\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5728\u4F7F\u7528\u4E2D\u3002\n2. \u6C92\u6709\u5BEB\u5165 orb.db \u7684\u6B0A\u9650\u3002
 
--- a/src/share/classes/javax/rmi/CORBA/Util.java	Sun May 01 16:42:06 2016 -0700
+++ b/src/share/classes/javax/rmi/CORBA/Util.java	Sat Aug 20 11:56:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -45,6 +45,7 @@
 import java.rmi.Remote;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.SerializablePermission;
 import java.net.MalformedURLException ;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -63,8 +64,22 @@
     private static final javax.rmi.CORBA.UtilDelegate utilDelegate;
     private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass";
 
+    private static final String ALLOW_CREATEVALUEHANDLER_PROP = "jdk.rmi.CORBA.allowCustomValueHandler";
+    private static boolean allowCustomValueHandler;
+
     static {
         utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey);
+        allowCustomValueHandler = readAllowCustomValueHandlerProperty();
+    }
+
+    private static boolean readAllowCustomValueHandlerProperty () {
+       return AccessController
+        .doPrivileged(new PrivilegedAction<Boolean>() {
+            @Override
+            public Boolean run() {
+                return Boolean.getBoolean(ALLOW_CREATEVALUEHANDLER_PROP);
+            }
+        });
     }
 
     private Util(){}
@@ -111,7 +126,7 @@
      * Writes a java.lang.Object as a CORBA Object. If <code>obj</code> is
      * an exported RMI-IIOP server object, the tie is found
      * and wired to <code>obj</code>, then written to
-<code>out.write_Object(org.omg.CORBA.Object)</code>.
+     * <code>out.write_Object(org.omg.CORBA.Object)</code>.
      * If <code>obj</code> is a CORBA Object, it is written to
      * <code>out.write_Object(org.omg.CORBA.Object)</code>.
      * @param out the stream in which to write the object.
@@ -196,6 +211,8 @@
      */
     public static ValueHandler createValueHandler() {
 
+        isCustomSerializationPermitted();
+
         if (utilDelegate != null) {
             return utilDelegate.createValueHandler();
         }
@@ -336,6 +353,7 @@
     // security reasons. If you know a better solution how to share this code
     // then remove it from PortableRemoteObject. Also in Stub.java
     private static Object createDelegate(String classKey) {
+
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -388,4 +406,16 @@
             new GetORBPropertiesFileAction());
     }
 
+    private static void isCustomSerializationPermitted() {
+        SecurityManager sm = System.getSecurityManager();
+        if (!allowCustomValueHandler) {
+            if ( sm != null) {
+                // check that a serialization permission has been
+                // set to allow the loading of the Util delegate
+                // which provides access to custom ValueHandler
+                sm.checkPermission(new SerializablePermission(
+                        "enableCustomValueHandler"));
+            }
+        }
+    }
 }