Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
duke@1 | 1 | /* |
ohair@158 | 2 | * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@158 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@158 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@158 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@158 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@158 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package org.omg.CORBA; |
duke@1 | 27 | |
duke@1 | 28 | /** |
duke@1 | 29 | * The definition for a CORBA object reference. |
duke@1 | 30 | * <p> |
duke@1 | 31 | * A CORBA object reference is a handle for a particular |
duke@1 | 32 | * CORBA object implemented by a server. A CORBA object reference |
duke@1 | 33 | * identifies the same CORBA object each time the reference is used to invoke |
duke@1 | 34 | * a method on the object. |
duke@1 | 35 | * A CORBA object may have multiple, distinct object references. |
duke@1 | 36 | * <p> |
duke@1 | 37 | * The <code>org.omg.CORBA.Object</code> interface is the root of |
duke@1 | 38 | * the inheritance hierarchy for all CORBA object references in the Java |
duke@1 | 39 | * programming language, analogous to <code>java.rmi.Remote</code> |
duke@1 | 40 | * for RMI remote objects. |
duke@1 | 41 | * <p> |
duke@1 | 42 | * A CORBA object may be either local or remote. |
duke@1 | 43 | * If it is a local object (that is, running in the same |
duke@1 | 44 | * VM as the client), invocations may be directly serviced by |
duke@1 | 45 | * the object instance, and the object reference could point to the actual |
duke@1 | 46 | * instance of the object implementation class. |
duke@1 | 47 | * If a CORBA object is a remote object (that is, running in a different |
duke@1 | 48 | * VM from the client), the object reference points to a stub (proxy) which uses the |
duke@1 | 49 | * ORB machinery to make a remote invocation on the server where the object |
duke@1 | 50 | * implementation resides. |
duke@1 | 51 | * <p> |
duke@1 | 52 | * Default implementations of the methods in the interface |
duke@1 | 53 | * <code>org.omg.CORBA.Object</code> |
duke@1 | 54 | * are provided in the class <code>org.omg.CORBA.portable.ObjectImpl</code>, |
duke@1 | 55 | * which is the base class for stubs and object implementations. |
duke@1 | 56 | * <p> |
duke@1 | 57 | * @see org.omg.CORBA.portable.ObjectImpl |
duke@1 | 58 | */ |
duke@1 | 59 | |
duke@1 | 60 | public interface Object { |
duke@1 | 61 | |
duke@1 | 62 | /** |
duke@1 | 63 | * Checks whether this object is an instance of a class that |
duke@1 | 64 | * implements the given interface. |
duke@1 | 65 | * |
duke@1 | 66 | * @param repositoryIdentifier the interface to check against |
duke@1 | 67 | * @return <code>true</code> if this object reference is an instance |
duke@1 | 68 | * of a class that implements the interface; |
duke@1 | 69 | * <code>false</code> otherwise |
duke@1 | 70 | */ |
duke@1 | 71 | boolean _is_a(String repositoryIdentifier); |
duke@1 | 72 | |
duke@1 | 73 | |
duke@1 | 74 | /** |
duke@1 | 75 | * Determines whether the two object references are equivalent, |
duke@1 | 76 | * so far as the ORB can easily determine. Two object references are equivalent |
duke@1 | 77 | * if they are identical. Two distinct object references which in fact refer to |
duke@1 | 78 | * the same object are also equivalent. However, ORBs are not required |
duke@1 | 79 | * to attempt determination of whether two distinct object references |
duke@1 | 80 | * refer to the same object, since such determination could be impractically |
duke@1 | 81 | * expensive. |
duke@1 | 82 | * @param other the other object reference with which to check for equivalence |
duke@1 | 83 | * @return <code>true</code> if this object reference is known to be |
duke@1 | 84 | * equivalent to the given object reference. |
duke@1 | 85 | * Note that <code>false</code> indicates only that the two |
duke@1 | 86 | * object references are distinct, not necessarily that |
duke@1 | 87 | * they reference distinct objects. |
duke@1 | 88 | */ |
duke@1 | 89 | boolean _is_equivalent(org.omg.CORBA.Object other); |
duke@1 | 90 | |
duke@1 | 91 | |
duke@1 | 92 | /** |
duke@1 | 93 | * Determines whether the server object for this object reference has been |
duke@1 | 94 | * destroyed. |
duke@1 | 95 | * @return <code>true</code> if the ORB knows authoritatively that the |
duke@1 | 96 | * server object does not exist; <code>false</code> otherwise |
duke@1 | 97 | */ |
duke@1 | 98 | boolean _non_existent(); |
duke@1 | 99 | |
duke@1 | 100 | |
duke@1 | 101 | /** |
duke@1 | 102 | * Returns an ORB-internal identifier for this object reference. |
duke@1 | 103 | * This is a hash identifier, which does |
duke@1 | 104 | * not change during the lifetime of the object reference, and so |
duke@1 | 105 | * neither will any hash function of that identifier change. The value returned |
duke@1 | 106 | * is not guaranteed to be unique; in other words, another object |
duke@1 | 107 | * reference may have the same hash value. |
duke@1 | 108 | * If two object references hash differently, |
duke@1 | 109 | * then they are distinct object references; however, both may still refer |
duke@1 | 110 | * to the same CORBA object. |
duke@1 | 111 | * |
duke@1 | 112 | * @param maximum the upper bound on the hash value returned by the ORB |
duke@1 | 113 | * @return the ORB-internal hash identifier for this object reference |
duke@1 | 114 | */ |
duke@1 | 115 | int _hash(int maximum); |
duke@1 | 116 | |
duke@1 | 117 | |
duke@1 | 118 | /** |
duke@1 | 119 | * Returns a duplicate of this CORBA object reference. |
duke@1 | 120 | * The server object implementation is not involved in creating |
duke@1 | 121 | * the duplicate, and the implementation cannot distinguish whether |
duke@1 | 122 | * the original object reference or a duplicate was used to make a request. |
duke@1 | 123 | * <P> |
duke@1 | 124 | * Note that this method is not very useful in the Java platform, |
duke@1 | 125 | * since memory management is handled by the VM. |
duke@1 | 126 | * It is included for compliance with the CORBA APIs. |
duke@1 | 127 | * <P> |
duke@1 | 128 | * The method <code>_duplicate</code> may return this object reference itself. |
duke@1 | 129 | * |
duke@1 | 130 | * @return a duplicate of this object reference or this object reference |
duke@1 | 131 | * itself |
duke@1 | 132 | */ |
duke@1 | 133 | org.omg.CORBA.Object _duplicate(); |
duke@1 | 134 | |
duke@1 | 135 | |
duke@1 | 136 | /** |
duke@1 | 137 | * Signals that the caller is done using this object reference, so |
duke@1 | 138 | * internal ORB resources associated with this object reference can be |
duke@1 | 139 | * released. Note that the object implementation is not involved in |
duke@1 | 140 | * this operation, and other references to the same object are not affected. |
duke@1 | 141 | */ |
duke@1 | 142 | void _release(); |
duke@1 | 143 | |
duke@1 | 144 | |
duke@1 | 145 | /** |
duke@1 | 146 | * Obtains an <code>InterfaceDef</code> for the object implementation |
duke@1 | 147 | * referenced by this object reference. |
duke@1 | 148 | * The <code>InterfaceDef</code> object |
duke@1 | 149 | * may be used to introspect on the methods, attributes, and other |
duke@1 | 150 | * type information for the object referred to by this object reference. |
duke@1 | 151 | * |
duke@1 | 152 | * @return the <code>InterfaceDef</code> object in the Interface Repository |
duke@1 | 153 | * which provides type information about the object referred to by |
duke@1 | 154 | * this object reference |
duke@1 | 155 | */ |
duke@1 | 156 | org.omg.CORBA.Object _get_interface_def(); |
duke@1 | 157 | |
duke@1 | 158 | |
duke@1 | 159 | |
duke@1 | 160 | /** |
duke@1 | 161 | * Creates a <code>Request</code> instance for use in the |
duke@1 | 162 | * Dynamic Invocation Interface. |
duke@1 | 163 | * |
duke@1 | 164 | * @param operation the name of the method to be invoked using the |
duke@1 | 165 | * <code>Request</code> instance |
duke@1 | 166 | * @return the newly-created <code>Request</code> instance |
duke@1 | 167 | */ |
duke@1 | 168 | Request _request(String operation); |
duke@1 | 169 | |
duke@1 | 170 | |
duke@1 | 171 | |
duke@1 | 172 | /** |
duke@1 | 173 | * Creates a <code>Request</code> instance initialized with the |
duke@1 | 174 | * given context, method name, list of arguments, and container |
duke@1 | 175 | * for the method's return value. |
duke@1 | 176 | * |
duke@1 | 177 | * @param ctx a <code>Context</code> object containing |
duke@1 | 178 | * a list of properties |
duke@1 | 179 | * @param operation the name of the method to be invoked |
duke@1 | 180 | * @param arg_list an <code>NVList</code> containing the actual arguments |
duke@1 | 181 | * to the method being invoked |
duke@1 | 182 | * @param result a <code>NamedValue</code> object to serve as a |
duke@1 | 183 | * container for the method's return value |
duke@1 | 184 | * @return the newly-created <code>Request</code> object |
duke@1 | 185 | * |
duke@1 | 186 | * @see Request |
duke@1 | 187 | * @see NVList |
duke@1 | 188 | * @see NamedValue |
duke@1 | 189 | */ |
duke@1 | 190 | |
duke@1 | 191 | Request _create_request(Context ctx, |
duke@1 | 192 | String operation, |
duke@1 | 193 | NVList arg_list, |
duke@1 | 194 | NamedValue result); |
duke@1 | 195 | |
duke@1 | 196 | /** |
duke@1 | 197 | * Creates a <code>Request</code> instance initialized with the |
duke@1 | 198 | * given context, method name, list of arguments, container |
duke@1 | 199 | * for the method's return value, list of possible exceptions, |
duke@1 | 200 | * and list of context strings needing to be resolved. |
duke@1 | 201 | * |
duke@1 | 202 | * @param ctx a <code>Context</code> object containing |
duke@1 | 203 | * a list of properties |
duke@1 | 204 | * @param operation the name of the method to be invoked |
duke@1 | 205 | * @param arg_list an <code>NVList</code> containing the actual arguments |
duke@1 | 206 | * to the method being invoked |
duke@1 | 207 | * @param result a <code>NamedValue</code> object to serve as a |
duke@1 | 208 | * container for the method's return value |
duke@1 | 209 | * @param exclist an <code>ExceptionList</code> object containing a |
duke@1 | 210 | * list of possible exceptions the method can throw |
duke@1 | 211 | * @param ctxlist a <code>ContextList</code> object containing a list of |
duke@1 | 212 | * context strings that need to be resolved and sent with the |
duke@1 | 213 | * <code>Request</code> instance |
duke@1 | 214 | * @return the newly-created <code>Request</code> object |
duke@1 | 215 | * |
duke@1 | 216 | * @see Request |
duke@1 | 217 | * @see NVList |
duke@1 | 218 | * @see NamedValue |
duke@1 | 219 | * @see ExceptionList |
duke@1 | 220 | * @see ContextList |
duke@1 | 221 | */ |
duke@1 | 222 | |
duke@1 | 223 | Request _create_request(Context ctx, |
duke@1 | 224 | String operation, |
duke@1 | 225 | NVList arg_list, |
duke@1 | 226 | NamedValue result, |
duke@1 | 227 | ExceptionList exclist, |
duke@1 | 228 | ContextList ctxlist); |
duke@1 | 229 | |
duke@1 | 230 | |
duke@1 | 231 | |
duke@1 | 232 | |
duke@1 | 233 | /** |
duke@1 | 234 | * Returns the <code>Policy</code> object of the specified type |
duke@1 | 235 | * which applies to this object. |
duke@1 | 236 | * |
duke@1 | 237 | * @param policy_type the type of policy to be obtained |
duke@1 | 238 | * @return A <code>Policy</code> object of the type specified by |
duke@1 | 239 | * the policy_type parameter |
duke@1 | 240 | * @exception org.omg.CORBA.BAD_PARAM when the value of policy type |
duke@1 | 241 | * is not valid either because the specified type is not supported by this |
duke@1 | 242 | * ORB or because a policy object of that type is not associated with this |
duke@1 | 243 | * Object |
duke@1 | 244 | */ |
duke@1 | 245 | Policy _get_policy(int policy_type); |
duke@1 | 246 | |
duke@1 | 247 | |
duke@1 | 248 | /** |
duke@1 | 249 | * Retrieves the <code>DomainManagers</code> of this object. |
duke@1 | 250 | * This allows administration services (and applications) to retrieve the |
duke@1 | 251 | * domain managers, and hence the security and other policies applicable |
duke@1 | 252 | * to individual objects that are members of the domain. |
duke@1 | 253 | * |
duke@1 | 254 | * @return the list of immediately enclosing domain managers of this object. |
duke@1 | 255 | * At least one domain manager is always returned in the list since by |
duke@1 | 256 | * default each object is associated with at least one domain manager at |
duke@1 | 257 | * creation. |
duke@1 | 258 | */ |
duke@1 | 259 | DomainManager[] _get_domain_managers(); |
duke@1 | 260 | |
duke@1 | 261 | |
duke@1 | 262 | /** |
duke@1 | 263 | * Returns a new <code>Object</code> with the given policies |
duke@1 | 264 | * either replacing any existing policies in this |
duke@1 | 265 | * <code>Object</code> or with the given policies added |
duke@1 | 266 | * to the existing ones, depending on the value of the |
duke@1 | 267 | * given <code>SetOverrideType</code> object. |
duke@1 | 268 | * |
duke@1 | 269 | * @param policies an array of <code>Policy</code> objects containing |
duke@1 | 270 | * the policies to be added or to be used as replacements |
duke@1 | 271 | * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>, indicating |
duke@1 | 272 | * that the given policies will replace any existing ones, or |
duke@1 | 273 | * <code>SetOverrideType.ADD_OVERRIDE</code>, indicating that |
duke@1 | 274 | * the given policies should be added to any existing ones |
duke@1 | 275 | * @return a new <code>Object</code> with the given policies replacing |
duke@1 | 276 | * or added to those in this <code>Object</code> |
duke@1 | 277 | */ |
duke@1 | 278 | org.omg.CORBA.Object _set_policy_override(Policy[] policies, |
duke@1 | 279 | SetOverrideType set_add); |
duke@1 | 280 | |
duke@1 | 281 | |
duke@1 | 282 | } |