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) 1996, 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 | * An object containing the information necessary for |
duke@1 | 30 | * invoking a method. This class is |
duke@1 | 31 | * the cornerstone of the ORB Dynamic |
duke@1 | 32 | * Invocation Interface (DII), which allows dynamic creation and |
duke@1 | 33 | * invocation of requests. |
duke@1 | 34 | * A server cannot tell the difference between a client |
duke@1 | 35 | * invocation using a client stub and a request using the DII. |
duke@1 | 36 | * <P> |
duke@1 | 37 | * A <code>Request</code> object consists of: |
duke@1 | 38 | * <UL> |
duke@1 | 39 | * <LI>the name of the operation to be invoked |
duke@1 | 40 | * <LI>an <code>NVList</code> containing arguments for the operation.<BR> |
duke@1 | 41 | * Each item in the list is a <code>NamedValue</code> object, which has three |
duke@1 | 42 | * parts: |
duke@1 | 43 | * <OL> |
duke@1 | 44 | * <LI>the name of the argument |
duke@1 | 45 | * <LI>the value of the argument (as an <code>Any</code> object) |
duke@1 | 46 | * <LI>the argument mode flag indicating whether the argument is |
duke@1 | 47 | * for input, output, or both |
duke@1 | 48 | * </OL> |
duke@1 | 49 | * </UL> |
duke@1 | 50 | * <P> |
duke@1 | 51 | * <code>Request</code> objects may also contain additional information, |
duke@1 | 52 | * depending on how an operation was defined in the original IDL |
duke@1 | 53 | * interface definition. For example, where appropriate, they may contain |
duke@1 | 54 | * a <code>NamedValue</code> object to hold the return value or exception, |
duke@1 | 55 | * a context, a list of possible exceptions, and a list of |
duke@1 | 56 | * context strings that need to be resolved. |
duke@1 | 57 | * <P> |
duke@1 | 58 | * New <code>Request</code> objects are created using one of the |
duke@1 | 59 | * <code>create_request</code> methods in the <code>Object</code> class. |
duke@1 | 60 | * In other words, a <code>create_request</code> method is performed on the |
duke@1 | 61 | * object which is to be invoked. |
duke@1 | 62 | * |
duke@1 | 63 | * @see org.omg.CORBA.NamedValue |
duke@1 | 64 | * |
duke@1 | 65 | */ |
duke@1 | 66 | |
duke@1 | 67 | public abstract class Request { |
duke@1 | 68 | |
duke@1 | 69 | /** |
duke@1 | 70 | * Retrieves the the target object reference. |
duke@1 | 71 | * |
duke@1 | 72 | * @return the object reference that points to the |
duke@1 | 73 | * object implementation for the method |
duke@1 | 74 | * to be invoked |
duke@1 | 75 | */ |
duke@1 | 76 | |
duke@1 | 77 | public abstract org.omg.CORBA.Object target(); |
duke@1 | 78 | |
duke@1 | 79 | /** |
duke@1 | 80 | * Retrieves the name of the method to be invoked. |
duke@1 | 81 | * |
duke@1 | 82 | * @return the name of the method to be invoked |
duke@1 | 83 | */ |
duke@1 | 84 | |
duke@1 | 85 | public abstract String operation(); |
duke@1 | 86 | |
duke@1 | 87 | /** |
duke@1 | 88 | * Retrieves the <code>NVList</code> object containing the arguments |
duke@1 | 89 | * to the method being invoked. The elements in the list are |
duke@1 | 90 | * <code>NamedValue</code> objects, with each one describing an argument |
duke@1 | 91 | * to the method. |
duke@1 | 92 | * |
duke@1 | 93 | * @return the <code>NVList</code> object containing the arguments |
duke@1 | 94 | * for the method |
duke@1 | 95 | * |
duke@1 | 96 | */ |
duke@1 | 97 | |
duke@1 | 98 | public abstract NVList arguments(); |
duke@1 | 99 | |
duke@1 | 100 | /** |
duke@1 | 101 | * Retrieves the <code>NamedValue</code> object containing the return |
duke@1 | 102 | * value for the method. |
duke@1 | 103 | * |
duke@1 | 104 | * @return the <code>NamedValue</code> object containing the result |
duke@1 | 105 | * of the method |
duke@1 | 106 | */ |
duke@1 | 107 | |
duke@1 | 108 | public abstract NamedValue result(); |
duke@1 | 109 | |
duke@1 | 110 | /** |
duke@1 | 111 | * Retrieves the <code>Environment</code> object for this request. |
duke@1 | 112 | * It contains the exception that the method being invoked has |
duke@1 | 113 | * thrown (after the invocation returns). |
duke@1 | 114 | * |
duke@1 | 115 | * |
duke@1 | 116 | * @return the <code>Environment</code> object for this request |
duke@1 | 117 | */ |
duke@1 | 118 | |
duke@1 | 119 | public abstract Environment env(); |
duke@1 | 120 | |
duke@1 | 121 | /** |
duke@1 | 122 | * Retrieves the <code>ExceptionList</code> object for this request. |
duke@1 | 123 | * This list contains <code>TypeCode</code> objects describing the |
duke@1 | 124 | * exceptions that may be thrown by the method being invoked. |
duke@1 | 125 | * |
duke@1 | 126 | * @return the <code>ExceptionList</code> object describing the exceptions |
duke@1 | 127 | * that may be thrown by the method being invoked |
duke@1 | 128 | */ |
duke@1 | 129 | |
duke@1 | 130 | public abstract ExceptionList exceptions(); |
duke@1 | 131 | |
duke@1 | 132 | /** |
duke@1 | 133 | * Retrieves the <code>ContextList</code> object for this request. |
duke@1 | 134 | * This list contains context <code>String</code>s that need to |
duke@1 | 135 | * be resolved and sent with the invocation. |
duke@1 | 136 | * |
duke@1 | 137 | * |
duke@1 | 138 | * @return the list of context strings whose values |
duke@1 | 139 | * need to be resolved and sent with the |
duke@1 | 140 | * invocation. |
duke@1 | 141 | */ |
duke@1 | 142 | |
duke@1 | 143 | public abstract ContextList contexts(); |
duke@1 | 144 | |
duke@1 | 145 | /** |
duke@1 | 146 | * Retrieves the <code>Context</code> object for this request. |
duke@1 | 147 | * This is a list of properties giving information about the |
duke@1 | 148 | * client, the environment, or the circumstances of this request. |
duke@1 | 149 | * |
duke@1 | 150 | * @return the <code>Context</code> object that is to be used |
duke@1 | 151 | * to resolve any context strings whose |
duke@1 | 152 | * values need to be sent with the invocation |
duke@1 | 153 | */ |
duke@1 | 154 | |
duke@1 | 155 | public abstract Context ctx(); |
duke@1 | 156 | |
duke@1 | 157 | /** |
duke@1 | 158 | * Sets this request's <code>Context</code> object to the one given. |
duke@1 | 159 | * |
duke@1 | 160 | * @param c the new <code>Context</code> object to be used for |
duke@1 | 161 | * resolving context strings |
duke@1 | 162 | */ |
duke@1 | 163 | |
duke@1 | 164 | public abstract void ctx(Context c); |
duke@1 | 165 | |
duke@1 | 166 | |
duke@1 | 167 | /** |
duke@1 | 168 | * Creates an input argument and adds it to this <code>Request</code> |
duke@1 | 169 | * object. |
duke@1 | 170 | * |
duke@1 | 171 | * @return an <code>Any</code> object that contains the |
duke@1 | 172 | * value and typecode for the input argument added |
duke@1 | 173 | */ |
duke@1 | 174 | |
duke@1 | 175 | public abstract Any add_in_arg(); |
duke@1 | 176 | |
duke@1 | 177 | /** |
duke@1 | 178 | * Creates an input argument with the given name and adds it to |
duke@1 | 179 | * this <code>Request</code> object. |
duke@1 | 180 | * |
duke@1 | 181 | * @param name the name of the argument being added |
duke@1 | 182 | * @return an <code>Any</code> object that contains the |
duke@1 | 183 | * value and typecode for the input argument added |
duke@1 | 184 | */ |
duke@1 | 185 | |
duke@1 | 186 | public abstract Any add_named_in_arg(String name); |
duke@1 | 187 | |
duke@1 | 188 | /** |
duke@1 | 189 | * Adds an input/output argument to this <code>Request</code> object. |
duke@1 | 190 | * |
duke@1 | 191 | * @return an <code>Any</code> object that contains the |
duke@1 | 192 | * value and typecode for the input/output argument added |
duke@1 | 193 | */ |
duke@1 | 194 | |
duke@1 | 195 | public abstract Any add_inout_arg(); |
duke@1 | 196 | |
duke@1 | 197 | /** |
duke@1 | 198 | * Adds an input/output argument with the given name to this |
duke@1 | 199 | * <code>Request</code> object. |
duke@1 | 200 | * |
duke@1 | 201 | * @param name the name of the argument being added |
duke@1 | 202 | * @return an <code>Any</code> object that contains the |
duke@1 | 203 | * value and typecode for the input/output argument added |
duke@1 | 204 | */ |
duke@1 | 205 | |
duke@1 | 206 | public abstract Any add_named_inout_arg(String name); |
duke@1 | 207 | |
duke@1 | 208 | |
duke@1 | 209 | /** |
duke@1 | 210 | * Adds an output argument to this <code>Request</code> object. |
duke@1 | 211 | * |
duke@1 | 212 | * @return an <code>Any</code> object that contains the |
duke@1 | 213 | * value and typecode for the output argument added |
duke@1 | 214 | */ |
duke@1 | 215 | |
duke@1 | 216 | public abstract Any add_out_arg(); |
duke@1 | 217 | |
duke@1 | 218 | /** |
duke@1 | 219 | * Adds an output argument with the given name to this |
duke@1 | 220 | * <code>Request</code> object. |
duke@1 | 221 | * |
duke@1 | 222 | * @param name the name of the argument being added |
duke@1 | 223 | * @return an <code>Any</code> object that contains the |
duke@1 | 224 | * value and typecode for the output argument added |
duke@1 | 225 | */ |
duke@1 | 226 | |
duke@1 | 227 | public abstract Any add_named_out_arg(String name); |
duke@1 | 228 | |
duke@1 | 229 | /** |
duke@1 | 230 | * Sets the typecode for the return |
duke@1 | 231 | * value of the method. |
duke@1 | 232 | * |
duke@1 | 233 | * @param tc the <code>TypeCode</code> object containing type information |
duke@1 | 234 | * for the return value |
duke@1 | 235 | */ |
duke@1 | 236 | |
duke@1 | 237 | public abstract void set_return_type(TypeCode tc); |
duke@1 | 238 | |
duke@1 | 239 | /** |
duke@1 | 240 | * Returns the <code>Any</code> object that contains the value for the |
duke@1 | 241 | * result of the method. |
duke@1 | 242 | * |
duke@1 | 243 | * @return an <code>Any</code> object containing the value and |
duke@1 | 244 | * typecode for the return value |
duke@1 | 245 | */ |
duke@1 | 246 | |
duke@1 | 247 | public abstract Any return_value(); |
duke@1 | 248 | |
duke@1 | 249 | /** |
duke@1 | 250 | * Makes a synchronous invocation using the |
duke@1 | 251 | * information in the <code>Request</code> object. Exception information is |
duke@1 | 252 | * placed into the <code>Request</code> object's environment object. |
duke@1 | 253 | */ |
duke@1 | 254 | |
duke@1 | 255 | public abstract void invoke(); |
duke@1 | 256 | |
duke@1 | 257 | /** |
duke@1 | 258 | * Makes a oneway invocation on the |
duke@1 | 259 | * request. In other words, it does not expect or wait for a |
duke@1 | 260 | * response. Note that this can be used even if the operation was |
duke@1 | 261 | * not declared as oneway in the IDL declaration. No response or |
duke@1 | 262 | * exception information is returned. |
duke@1 | 263 | */ |
duke@1 | 264 | |
duke@1 | 265 | public abstract void send_oneway(); |
duke@1 | 266 | |
duke@1 | 267 | /** |
duke@1 | 268 | * Makes an asynchronous invocation on |
duke@1 | 269 | * the request. In other words, it does not wait for a response before it |
duke@1 | 270 | * returns to the user. The user can then later use the methods |
duke@1 | 271 | * <code>poll_response</code> and <code>get_response</code> to get |
duke@1 | 272 | * the result or exception information for the invocation. |
duke@1 | 273 | */ |
duke@1 | 274 | |
duke@1 | 275 | public abstract void send_deferred(); |
duke@1 | 276 | |
duke@1 | 277 | /** |
duke@1 | 278 | * Allows the user to determine |
duke@1 | 279 | * whether a response has been received for the invocation triggered |
duke@1 | 280 | * earlier with the <code>send_deferred</code> method. |
duke@1 | 281 | * |
duke@1 | 282 | * @return <code>true</code> if the method response has |
duke@1 | 283 | * been received; <code>false</code> otherwise |
duke@1 | 284 | */ |
duke@1 | 285 | |
duke@1 | 286 | public abstract boolean poll_response(); |
duke@1 | 287 | |
duke@1 | 288 | /** |
duke@1 | 289 | * Allows the user to access the |
duke@1 | 290 | * response for the invocation triggered earlier with the |
duke@1 | 291 | * <code>send_deferred</code> method. |
duke@1 | 292 | * |
duke@1 | 293 | * @exception WrongTransaction if the method <code>get_response</code> was invoked |
duke@1 | 294 | * from a different transaction's scope than the one from which the |
duke@1 | 295 | * request was originally sent. See the OMG Transaction Service specification |
duke@1 | 296 | * for details. |
duke@1 | 297 | */ |
duke@1 | 298 | |
duke@1 | 299 | public abstract void get_response() throws WrongTransaction; |
duke@1 | 300 | |
duke@1 | 301 | }; |