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, 2000, 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 used in <code>Request</code> operations |
duke@1 | 30 | * to specify the context object in which context strings |
duke@1 | 31 | * must be resolved before being sent along with the request invocation. |
duke@1 | 32 | * A <code>Context</code> object |
duke@1 | 33 | * contains a list of properties in the form of <code>NamedValue</code> |
duke@1 | 34 | * objects. These properties represent information |
duke@1 | 35 | * about the client, the environment, or the circumstances of a request |
duke@1 | 36 | * and generally are properties that might be inconvenient |
duke@1 | 37 | * to pass as parameters. |
duke@1 | 38 | * <P> |
duke@1 | 39 | * A <code>Context</code> object is created by first calling the |
duke@1 | 40 | * <code>ORB</code> method <code>get_default_context</code> |
duke@1 | 41 | * and then calling the method <code>create_child</code> on the |
duke@1 | 42 | * default context. |
duke@1 | 43 | * <P> |
duke@1 | 44 | * Each property in a <code>Context</code> object is represented by |
duke@1 | 45 | * a <code>NamedValue</code> object. The property name is contained |
duke@1 | 46 | * in the <code>NamedValue</code> object's <code>name</code> field, and |
duke@1 | 47 | * the value associated with the name is contained in the <code>Any</code> |
duke@1 | 48 | * object that was assigned to the <code>NamedValue</code> object's |
duke@1 | 49 | * <code>value</code> field. |
duke@1 | 50 | * <P> |
duke@1 | 51 | * <code>Context</code> properties can represent a portion of a client's |
duke@1 | 52 | * or application's environment that is meant to be propagated to |
duke@1 | 53 | * (and made implicitly part of) a server's environment. |
duke@1 | 54 | * (Examples might be a window identifier or user preference information). |
duke@1 | 55 | * Once a server has been invoked (that is, after the properties are |
duke@1 | 56 | * propagated), the server may query its <code>Context</code> object |
duke@1 | 57 | * for these properties using the method <code>get_values</code>. |
duke@1 | 58 | * |
duke@1 | 59 | *<P> |
duke@1 | 60 | * When an operation declaration includes a context clause, |
duke@1 | 61 | * the stubs and skeletons will have an additional argument |
duke@1 | 62 | * added for the context. When an operation invocation occurs, |
duke@1 | 63 | * the ORB causes the properties that were named in the operation |
duke@1 | 64 | * definition in IDL and |
duke@1 | 65 | * that are present in the client's <code>Context</code> object |
duke@1 | 66 | * to be provided in the <code>Context</code> object parameter to |
duke@1 | 67 | * the invoked method. |
duke@1 | 68 | * <P> |
duke@1 | 69 | * <code>Context</code> property names (which are strings) |
duke@1 | 70 | * typically have the form of an OMG IDL identifier or |
duke@1 | 71 | * a series of OMG IDL identifiers separated by periods. |
duke@1 | 72 | * A context property name pattern is either a property name |
duke@1 | 73 | * or a property name followed by a single "*". A property |
duke@1 | 74 | * name pattern without a trailing "*" is said to match only |
duke@1 | 75 | * itself. A property name pattern of the form "<name>*" matches any |
duke@1 | 76 | * property name that starts with <name> and continues with zero |
duke@1 | 77 | * or more additional characters. |
duke@1 | 78 | * <P> |
duke@1 | 79 | * Property name patterns are used in the context clause of |
duke@1 | 80 | * an operation definition and as a parameter for the |
duke@1 | 81 | * method <code>Context.get_values</code>. |
duke@1 | 82 | * <P> |
duke@1 | 83 | * <code>Context</code> objects may be "chained" together to achieve a |
duke@1 | 84 | * particular defaulting behavior. A <code>Context</code> |
duke@1 | 85 | * object created with the method <code>create_child</code> will |
duke@1 | 86 | * be chained to its parent (the <code>Context</code> object |
duke@1 | 87 | * that created it), and that means that the parent will be searched |
duke@1 | 88 | * after the child in a search for property names. |
duke@1 | 89 | *<P> |
duke@1 | 90 | * Properties defined in a particular <code>Context</code> object |
duke@1 | 91 | * effectively override those properties in the next higher level. |
duke@1 | 92 | * The scope used in a search for properties may be restricted by specifying a |
duke@1 | 93 | * starting scope and by using the flag <code>CTX_RESTRICT_SCOPE</code> |
duke@1 | 94 | * when invoking the method <code>get_values</code>. |
duke@1 | 95 | * <P> |
duke@1 | 96 | * A <code>Context</code> object may be named for purposes of specifying |
duke@1 | 97 | * a starting search scope. |
duke@1 | 98 | * |
duke@1 | 99 | * @since JDK1.2 |
duke@1 | 100 | */ |
duke@1 | 101 | |
duke@1 | 102 | public abstract class Context { |
duke@1 | 103 | |
duke@1 | 104 | /** |
duke@1 | 105 | * Retrieves the name of this <code>Context</code> object. |
duke@1 | 106 | * |
duke@1 | 107 | * @return the name of this <code>Context</code> object |
duke@1 | 108 | */ |
duke@1 | 109 | |
duke@1 | 110 | public abstract String context_name(); |
duke@1 | 111 | |
duke@1 | 112 | |
duke@1 | 113 | /** |
duke@1 | 114 | * Retrieves the parent of this <code>Context</code> object. |
duke@1 | 115 | * |
duke@1 | 116 | * @return the <code>Context</code> object that is the |
duke@1 | 117 | * parent of this <code>Context</code> object |
duke@1 | 118 | */ |
duke@1 | 119 | |
duke@1 | 120 | public abstract Context parent(); |
duke@1 | 121 | |
duke@1 | 122 | /** |
duke@1 | 123 | * Creates a <code>Context</code> object with the given string as its |
duke@1 | 124 | * name and with this <code>Context</code> object set as its parent. |
duke@1 | 125 | * <P> |
duke@1 | 126 | * The new <code>Context</code> object is chained into its parent |
duke@1 | 127 | * <code>Context</code> object. This means that in a search for |
duke@1 | 128 | * matching property names, if a match is not found in this context, |
duke@1 | 129 | * the search will continue in the parent. If that is not successful, |
duke@1 | 130 | * the search will continue in the grandparent, if there is one, and |
duke@1 | 131 | * so on. |
duke@1 | 132 | * |
duke@1 | 133 | * |
duke@1 | 134 | * @param child_ctx_name the <code>String</code> object to be set as |
duke@1 | 135 | * the name of the new <code>Context</code> object |
duke@1 | 136 | * @return the newly-created child <code>Context</code> object |
duke@1 | 137 | * initialized with the specified name |
duke@1 | 138 | */ |
duke@1 | 139 | |
duke@1 | 140 | public abstract Context create_child(String child_ctx_name); |
duke@1 | 141 | |
duke@1 | 142 | /** |
duke@1 | 143 | * Creates a <code>NamedValue</code> object and adds it to this |
duke@1 | 144 | * <code>Context</code> object. The <code>name</code> field of the |
duke@1 | 145 | * new <code>NamedValue</code> object is set to the given string, |
duke@1 | 146 | * the <code>value</code> field is set to the given <code>Any</code> |
duke@1 | 147 | * object, and the <code>flags</code> field is set to zero. |
duke@1 | 148 | * |
duke@1 | 149 | * @param propname the name of the property to be set |
duke@1 | 150 | * @param propvalue the <code>Any</code> object to which the |
duke@1 | 151 | * value of the property will be set. The |
duke@1 | 152 | * <code>Any</code> object's <code>value</code> |
duke@1 | 153 | * field contains the value to be associated |
duke@1 | 154 | * with the given propname; the |
duke@1 | 155 | * <code>kind</code> field must be set to |
duke@1 | 156 | * <code>TCKind.tk_string</code>. |
duke@1 | 157 | */ |
duke@1 | 158 | |
duke@1 | 159 | public abstract void set_one_value(String propname, Any propvalue); |
duke@1 | 160 | |
duke@1 | 161 | /** |
duke@1 | 162 | I Sets one or more property values in this <code>Context</code> |
duke@1 | 163 | * object. The <code>NVList</code> supplied to this method |
duke@1 | 164 | * contains one or more <code>NamedValue</code> objects. |
duke@1 | 165 | * In each <code>NamedValue</code> object, |
duke@1 | 166 | * the <code>name</code> field holds the name of the property, and |
duke@1 | 167 | * the <code>flags</code> field must be set to zero. |
duke@1 | 168 | * The <code>NamedValue</code> object's <code>value</code> field |
duke@1 | 169 | * contains an <code>Any</code> object, which, in turn, contains the value |
duke@1 | 170 | * for the property. Since the value is always a string, |
duke@1 | 171 | * the <code>Any</code> object must have the <code>kind</code> |
duke@1 | 172 | * field of its <code>TypeCode</code> set to <code>TCKind.tk_string</code>. |
duke@1 | 173 | * |
duke@1 | 174 | * @param values an NVList containing the property |
duke@1 | 175 | * names and associated values to be set |
duke@1 | 176 | * |
duke@1 | 177 | * @see #get_values |
duke@1 | 178 | * @see org.omg.CORBA.NamedValue |
duke@1 | 179 | * @see org.omg.CORBA.Any |
duke@1 | 180 | */ |
duke@1 | 181 | |
duke@1 | 182 | public abstract void set_values(NVList values); |
duke@1 | 183 | |
duke@1 | 184 | /** |
duke@1 | 185 | * Deletes from this <code>Context</code> object the |
duke@1 | 186 | * <code>NamedValue</code> object(s) whose |
duke@1 | 187 | * <code>name</code> field matches the given property name. |
duke@1 | 188 | * If the <code>String</code> object supplied for |
duke@1 | 189 | * <code>propname</code> has a |
duke@1 | 190 | * trailing wildcard character ("*"), then |
duke@1 | 191 | * all <code>NamedValue</code> objects whose <code>name</code> |
duke@1 | 192 | * fields match will be deleted. The search scope is always |
duke@1 | 193 | * limited to this <code>Context</code> object. |
duke@1 | 194 | * <P> |
duke@1 | 195 | * If no matching property is found, an exception is returned. |
duke@1 | 196 | * |
duke@1 | 197 | * @param propname name of the property to be deleted |
duke@1 | 198 | */ |
duke@1 | 199 | |
duke@1 | 200 | public abstract void delete_values(String propname); |
duke@1 | 201 | |
duke@1 | 202 | /** |
duke@1 | 203 | * Retrieves the <code>NamedValue</code> objects whose |
duke@1 | 204 | * <code>name</code> field matches the given name or name |
duke@1 | 205 | * pattern. This method allows for wildcard searches, |
duke@1 | 206 | * which means that there can be multiple matches and |
duke@1 | 207 | * therefore multiple values returned. If the |
duke@1 | 208 | * property is not found at the indicated level, the search |
duke@1 | 209 | * continues up the context object tree until a match is found or |
duke@1 | 210 | * all <code>Context</code> objects in the chain have been exhausted. |
duke@1 | 211 | * <P> |
duke@1 | 212 | * If no match is found, an error is returned and no property list |
duke@1 | 213 | * is returned. |
duke@1 | 214 | * |
duke@1 | 215 | * @param start_scope a <code>String</code> object indicating the |
duke@1 | 216 | * context object level at which to initiate the |
duke@1 | 217 | * search for the specified properties |
duke@1 | 218 | * (for example, "_USER", "_GROUP", "_SYSTEM"). Valid scope |
duke@1 | 219 | * names are implementation-specific. If a |
duke@1 | 220 | * scope name is omitted, the search |
duke@1 | 221 | * begins with the specified context |
duke@1 | 222 | * object. If the specified scope name is |
duke@1 | 223 | * not found, an exception is returned. |
duke@1 | 224 | * @param op_flags an operation flag. The one flag |
duke@1 | 225 | * that may be specified is <code>CTX_RESTRICT_SCOPE</code>. |
duke@1 | 226 | * If this flag is specified, searching is limited to the |
duke@1 | 227 | * specified <code>start_scope</code> or this |
duke@1 | 228 | * <code>Context</code> object. |
duke@1 | 229 | * @param pattern the property name whose values are to |
duke@1 | 230 | * be retrieved. <code>pattern</code> may be a |
duke@1 | 231 | * name or a name with a |
duke@1 | 232 | * trailing wildcard character ("*"). |
duke@1 | 233 | * |
duke@1 | 234 | * @return an <code>NVList</code> containing all the property values |
duke@1 | 235 | * (in the form of <code>NamedValue</code> objects) |
duke@1 | 236 | * whose associated property name matches the given name or |
duke@1 | 237 | * name pattern |
duke@1 | 238 | * @see #set_values |
duke@1 | 239 | * @see org.omg.CORBA.NamedValue |
duke@1 | 240 | */ |
duke@1 | 241 | |
duke@1 | 242 | abstract public NVList get_values(String start_scope, int op_flags, |
duke@1 | 243 | String pattern); |
duke@1 | 244 | }; |