Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
1 /*
2 * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 /*
26 * File: ./org/omg/CosNaming/_NamingContextImplBase.java
27 * From: nameservice.idl
28 * Date: Tue Aug 11 03:12:09 1998
29 * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
30 * @deprecated Deprecated in JDK 1.4.
31 */
33 package org.omg.CosNaming;
34 public abstract class _NamingContextImplBase extends org.omg.CORBA.DynamicImplementation implements org.omg.CosNaming.NamingContext {
35 // Constructor
36 public _NamingContextImplBase() {
37 super();
38 }
39 // Type strings for this class and its superclases
40 private static final String _type_ids[] = {
41 "IDL:omg.org/CosNaming/NamingContext:1.0"
42 };
44 public String[] _ids() { return (String[]) _type_ids.clone(); }
46 private static java.util.Dictionary _methods = new java.util.Hashtable();
47 static {
48 _methods.put("bind", new java.lang.Integer(0));
49 _methods.put("bind_context", new java.lang.Integer(1));
50 _methods.put("rebind", new java.lang.Integer(2));
51 _methods.put("rebind_context", new java.lang.Integer(3));
52 _methods.put("resolve", new java.lang.Integer(4));
53 _methods.put("unbind", new java.lang.Integer(5));
54 _methods.put("list", new java.lang.Integer(6));
55 _methods.put("new_context", new java.lang.Integer(7));
56 _methods.put("bind_new_context", new java.lang.Integer(8));
57 _methods.put("destroy", new java.lang.Integer(9));
58 }
59 // DSI Dispatch call
60 public void invoke(org.omg.CORBA.ServerRequest r) {
61 switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) {
62 case 0: // org.omg.CosNaming.NamingContext.bind
63 {
64 org.omg.CORBA.NVList _list = _orb().create_list(0);
65 org.omg.CORBA.Any _n = _orb().create_any();
66 _n.type(org.omg.CosNaming.NameHelper.type());
67 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
68 org.omg.CORBA.Any _obj = _orb().create_any();
69 _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));
70 _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value);
71 r.params(_list);
72 org.omg.CosNaming.NameComponent[] n;
73 n = org.omg.CosNaming.NameHelper.extract(_n);
74 org.omg.CORBA.Object obj;
75 obj = _obj.extract_Object();
76 try {
77 this.bind(n, obj);
78 }
79 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
80 org.omg.CORBA.Any _except = _orb().create_any();
81 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
82 r.except(_except);
83 return;
84 }
85 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
86 org.omg.CORBA.Any _except = _orb().create_any();
87 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
88 r.except(_except);
89 return;
90 }
91 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
92 org.omg.CORBA.Any _except = _orb().create_any();
93 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
94 r.except(_except);
95 return;
96 }
97 catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) {
98 org.omg.CORBA.Any _except = _orb().create_any();
99 org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3);
100 r.except(_except);
101 return;
102 }
103 org.omg.CORBA.Any __return = _orb().create_any();
104 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
105 r.result(__return);
106 }
107 break;
108 case 1: // org.omg.CosNaming.NamingContext.bind_context
109 {
110 org.omg.CORBA.NVList _list = _orb().create_list(0);
111 org.omg.CORBA.Any _n = _orb().create_any();
112 _n.type(org.omg.CosNaming.NameHelper.type());
113 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
114 org.omg.CORBA.Any _nc = _orb().create_any();
115 _nc.type(org.omg.CosNaming.NamingContextHelper.type());
116 _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value);
117 r.params(_list);
118 org.omg.CosNaming.NameComponent[] n;
119 n = org.omg.CosNaming.NameHelper.extract(_n);
120 org.omg.CosNaming.NamingContext nc;
121 nc = org.omg.CosNaming.NamingContextHelper.extract(_nc);
122 try {
123 this.bind_context(n, nc);
124 }
125 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
126 org.omg.CORBA.Any _except = _orb().create_any();
127 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
128 r.except(_except);
129 return;
130 }
131 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
132 org.omg.CORBA.Any _except = _orb().create_any();
133 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
134 r.except(_except);
135 return;
136 }
137 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
138 org.omg.CORBA.Any _except = _orb().create_any();
139 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
140 r.except(_except);
141 return;
142 }
143 catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) {
144 org.omg.CORBA.Any _except = _orb().create_any();
145 org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3);
146 r.except(_except);
147 return;
148 }
149 org.omg.CORBA.Any __return = _orb().create_any();
150 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
151 r.result(__return);
152 }
153 break;
154 case 2: // org.omg.CosNaming.NamingContext.rebind
155 {
156 org.omg.CORBA.NVList _list = _orb().create_list(0);
157 org.omg.CORBA.Any _n = _orb().create_any();
158 _n.type(org.omg.CosNaming.NameHelper.type());
159 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
160 org.omg.CORBA.Any _obj = _orb().create_any();
161 _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));
162 _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value);
163 r.params(_list);
164 org.omg.CosNaming.NameComponent[] n;
165 n = org.omg.CosNaming.NameHelper.extract(_n);
166 org.omg.CORBA.Object obj;
167 obj = _obj.extract_Object();
168 try {
169 this.rebind(n, obj);
170 }
171 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
172 org.omg.CORBA.Any _except = _orb().create_any();
173 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
174 r.except(_except);
175 return;
176 }
177 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
178 org.omg.CORBA.Any _except = _orb().create_any();
179 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
180 r.except(_except);
181 return;
182 }
183 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
184 org.omg.CORBA.Any _except = _orb().create_any();
185 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
186 r.except(_except);
187 return;
188 }
189 org.omg.CORBA.Any __return = _orb().create_any();
190 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
191 r.result(__return);
192 }
193 break;
194 case 3: // org.omg.CosNaming.NamingContext.rebind_context
195 {
196 org.omg.CORBA.NVList _list = _orb().create_list(0);
197 org.omg.CORBA.Any _n = _orb().create_any();
198 _n.type(org.omg.CosNaming.NameHelper.type());
199 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
200 org.omg.CORBA.Any _nc = _orb().create_any();
201 _nc.type(org.omg.CosNaming.NamingContextHelper.type());
202 _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value);
203 r.params(_list);
204 org.omg.CosNaming.NameComponent[] n;
205 n = org.omg.CosNaming.NameHelper.extract(_n);
206 org.omg.CosNaming.NamingContext nc;
207 nc = org.omg.CosNaming.NamingContextHelper.extract(_nc);
208 try {
209 this.rebind_context(n, nc);
210 }
211 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
212 org.omg.CORBA.Any _except = _orb().create_any();
213 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
214 r.except(_except);
215 return;
216 }
217 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
218 org.omg.CORBA.Any _except = _orb().create_any();
219 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
220 r.except(_except);
221 return;
222 }
223 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
224 org.omg.CORBA.Any _except = _orb().create_any();
225 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
226 r.except(_except);
227 return;
228 }
229 org.omg.CORBA.Any __return = _orb().create_any();
230 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
231 r.result(__return);
232 }
233 break;
234 case 4: // org.omg.CosNaming.NamingContext.resolve
235 {
236 org.omg.CORBA.NVList _list = _orb().create_list(0);
237 org.omg.CORBA.Any _n = _orb().create_any();
238 _n.type(org.omg.CosNaming.NameHelper.type());
239 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
240 r.params(_list);
241 org.omg.CosNaming.NameComponent[] n;
242 n = org.omg.CosNaming.NameHelper.extract(_n);
243 org.omg.CORBA.Object ___result;
244 try {
245 ___result = this.resolve(n);
246 }
247 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
248 org.omg.CORBA.Any _except = _orb().create_any();
249 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
250 r.except(_except);
251 return;
252 }
253 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
254 org.omg.CORBA.Any _except = _orb().create_any();
255 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
256 r.except(_except);
257 return;
258 }
259 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
260 org.omg.CORBA.Any _except = _orb().create_any();
261 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
262 r.except(_except);
263 return;
264 }
265 org.omg.CORBA.Any __result = _orb().create_any();
266 __result.insert_Object(___result);
267 r.result(__result);
268 }
269 break;
270 case 5: // org.omg.CosNaming.NamingContext.unbind
271 {
272 org.omg.CORBA.NVList _list = _orb().create_list(0);
273 org.omg.CORBA.Any _n = _orb().create_any();
274 _n.type(org.omg.CosNaming.NameHelper.type());
275 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
276 r.params(_list);
277 org.omg.CosNaming.NameComponent[] n;
278 n = org.omg.CosNaming.NameHelper.extract(_n);
279 try {
280 this.unbind(n);
281 }
282 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
283 org.omg.CORBA.Any _except = _orb().create_any();
284 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
285 r.except(_except);
286 return;
287 }
288 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
289 org.omg.CORBA.Any _except = _orb().create_any();
290 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
291 r.except(_except);
292 return;
293 }
294 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
295 org.omg.CORBA.Any _except = _orb().create_any();
296 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
297 r.except(_except);
298 return;
299 }
300 org.omg.CORBA.Any __return = _orb().create_any();
301 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
302 r.result(__return);
303 }
304 break;
305 case 6: // org.omg.CosNaming.NamingContext.list
306 {
307 org.omg.CORBA.NVList _list = _orb().create_list(0);
308 org.omg.CORBA.Any _how_many = _orb().create_any();
309 _how_many.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong));
310 _list.add_value("how_many", _how_many, org.omg.CORBA.ARG_IN.value);
311 org.omg.CORBA.Any _bl = _orb().create_any();
312 _bl.type(org.omg.CosNaming.BindingListHelper.type());
313 _list.add_value("bl", _bl, org.omg.CORBA.ARG_OUT.value);
314 org.omg.CORBA.Any _bi = _orb().create_any();
315 _bi.type(org.omg.CosNaming.BindingIteratorHelper.type());
316 _list.add_value("bi", _bi, org.omg.CORBA.ARG_OUT.value);
317 r.params(_list);
318 int how_many;
319 how_many = _how_many.extract_ulong();
320 org.omg.CosNaming.BindingListHolder bl;
321 bl = new org.omg.CosNaming.BindingListHolder();
322 org.omg.CosNaming.BindingIteratorHolder bi;
323 bi = new org.omg.CosNaming.BindingIteratorHolder();
324 this.list(how_many, bl, bi);
325 org.omg.CosNaming.BindingListHelper.insert(_bl, bl.value);
326 org.omg.CosNaming.BindingIteratorHelper.insert(_bi, bi.value);
327 org.omg.CORBA.Any __return = _orb().create_any();
328 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
329 r.result(__return);
330 }
331 break;
332 case 7: // org.omg.CosNaming.NamingContext.new_context
333 {
334 org.omg.CORBA.NVList _list = _orb().create_list(0);
335 r.params(_list);
336 org.omg.CosNaming.NamingContext ___result;
337 ___result = this.new_context();
338 org.omg.CORBA.Any __result = _orb().create_any();
339 org.omg.CosNaming.NamingContextHelper.insert(__result, ___result);
340 r.result(__result);
341 }
342 break;
343 case 8: // org.omg.CosNaming.NamingContext.bind_new_context
344 {
345 org.omg.CORBA.NVList _list = _orb().create_list(0);
346 org.omg.CORBA.Any _n = _orb().create_any();
347 _n.type(org.omg.CosNaming.NameHelper.type());
348 _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
349 r.params(_list);
350 org.omg.CosNaming.NameComponent[] n;
351 n = org.omg.CosNaming.NameHelper.extract(_n);
352 org.omg.CosNaming.NamingContext ___result;
353 try {
354 ___result = this.bind_new_context(n);
355 }
356 catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
357 org.omg.CORBA.Any _except = _orb().create_any();
358 org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
359 r.except(_except);
360 return;
361 }
362 catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e1) {
363 org.omg.CORBA.Any _except = _orb().create_any();
364 org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e1);
365 r.except(_except);
366 return;
367 }
368 catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e2) {
369 org.omg.CORBA.Any _except = _orb().create_any();
370 org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e2);
371 r.except(_except);
372 return;
373 }
374 catch (org.omg.CosNaming.NamingContextPackage.InvalidName e3) {
375 org.omg.CORBA.Any _except = _orb().create_any();
376 org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e3);
377 r.except(_except);
378 return;
379 }
380 org.omg.CORBA.Any __result = _orb().create_any();
381 org.omg.CosNaming.NamingContextHelper.insert(__result, ___result);
382 r.result(__result);
383 }
384 break;
385 case 9: // org.omg.CosNaming.NamingContext.destroy
386 {
387 org.omg.CORBA.NVList _list = _orb().create_list(0);
388 r.params(_list);
389 try {
390 this.destroy();
391 }
392 catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e0) {
393 org.omg.CORBA.Any _except = _orb().create_any();
394 org.omg.CosNaming.NamingContextPackage.NotEmptyHelper.insert(_except, e0);
395 r.except(_except);
396 return;
397 }
398 org.omg.CORBA.Any __return = _orb().create_any();
399 __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
400 r.result(__return);
401 }
402 break;
403 default:
404 throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
405 }
406 }
407 }