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) 1999, 2001, 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 | package org.omg.CORBA; |
duke@1 | 26 | |
duke@1 | 27 | |
duke@1 | 28 | /** |
duke@1 | 29 | * The Stub for <tt>Policy</tt>. For more information on |
duke@1 | 30 | * Stub files, see <a href="doc-files/generatedfiles.html#stub"> |
duke@1 | 31 | * "Generated Files: Stubs"</a>.<P> |
duke@1 | 32 | * org/omg/CORBA/_PolicyStub.java |
duke@1 | 33 | * Generated by the IDL-to-Java compiler (portable), version "3.0" |
duke@1 | 34 | * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl. |
duke@1 | 35 | * Saturday, July 17, 1999 12:26:20 AM PDT |
duke@1 | 36 | */ |
duke@1 | 37 | |
duke@1 | 38 | public class _PolicyStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Policy |
duke@1 | 39 | { |
duke@1 | 40 | /** Constructors |
duke@1 | 41 | * NOTE: If the default constructor is used, the |
duke@1 | 42 | * object is useless until _set_delegate (...) |
duke@1 | 43 | * is called. |
duke@1 | 44 | */ |
duke@1 | 45 | public _PolicyStub () |
duke@1 | 46 | { |
duke@1 | 47 | super (); |
duke@1 | 48 | } |
duke@1 | 49 | |
duke@1 | 50 | /** Constructs a <code>_PolicyStub</code> object initialized |
duke@1 | 51 | * with the given <code>Delegate</code> object. |
duke@1 | 52 | * |
duke@1 | 53 | * @param delegate a Delegate Object |
duke@1 | 54 | */ |
duke@1 | 55 | public _PolicyStub (org.omg.CORBA.portable.Delegate delegate) |
duke@1 | 56 | { |
duke@1 | 57 | super (); |
duke@1 | 58 | _set_delegate (delegate); |
duke@1 | 59 | } |
duke@1 | 60 | |
duke@1 | 61 | |
duke@1 | 62 | /** Returns the constant value that corresponds to the |
duke@1 | 63 | * type of the policy object. The values of |
duke@1 | 64 | * the polivy objectys are allocated by the OMG. |
duke@1 | 65 | * New values for PolicyType should be obtained from the OMG by |
duke@1 | 66 | * sending mail to request@omg.org. In general the constant |
duke@1 | 67 | * values that are allocated are defined in conjunction with |
duke@1 | 68 | * the definition of the corresponding policy object. |
duke@1 | 69 | * @return the constant value that corresponds to the type of |
duke@1 | 70 | * the policy object. |
duke@1 | 71 | */ |
duke@1 | 72 | public int policy_type () |
duke@1 | 73 | { |
duke@1 | 74 | org.omg.CORBA.portable.InputStream _in = null; |
duke@1 | 75 | try { |
duke@1 | 76 | org.omg.CORBA.portable.OutputStream _out = _request ("_get_policy_type", true); |
duke@1 | 77 | _in = _invoke (_out); |
duke@1 | 78 | int __result = org.omg.CORBA.PolicyTypeHelper.read (_in); |
duke@1 | 79 | return __result; |
duke@1 | 80 | } catch (org.omg.CORBA.portable.ApplicationException _ex) { |
duke@1 | 81 | _in = _ex.getInputStream (); |
duke@1 | 82 | String _id = _ex.getId (); |
duke@1 | 83 | throw new org.omg.CORBA.MARSHAL (_id); |
duke@1 | 84 | } catch (org.omg.CORBA.portable.RemarshalException _rm) { |
duke@1 | 85 | return policy_type (); |
duke@1 | 86 | } finally { |
duke@1 | 87 | _releaseReply (_in); |
duke@1 | 88 | } |
duke@1 | 89 | } // policy_type |
duke@1 | 90 | |
duke@1 | 91 | |
duke@1 | 92 | /** Copies the policy object. The copy does not retain any |
duke@1 | 93 | * relationships that the policy had with any domain or object. |
duke@1 | 94 | * @return the copy of the policy object. |
duke@1 | 95 | */ |
duke@1 | 96 | public org.omg.CORBA.Policy copy () |
duke@1 | 97 | { |
duke@1 | 98 | org.omg.CORBA.portable.InputStream _in = null; |
duke@1 | 99 | try { |
duke@1 | 100 | org.omg.CORBA.portable.OutputStream _out = _request ("copy", true); |
duke@1 | 101 | _in = _invoke (_out); |
duke@1 | 102 | org.omg.CORBA.Policy __result = org.omg.CORBA.PolicyHelper.read (_in); |
duke@1 | 103 | return __result; |
duke@1 | 104 | } catch (org.omg.CORBA.portable.ApplicationException _ex) { |
duke@1 | 105 | _in = _ex.getInputStream (); |
duke@1 | 106 | String _id = _ex.getId (); |
duke@1 | 107 | throw new org.omg.CORBA.MARSHAL (_id); |
duke@1 | 108 | } catch (org.omg.CORBA.portable.RemarshalException _rm) { |
duke@1 | 109 | return copy (); |
duke@1 | 110 | } finally { |
duke@1 | 111 | _releaseReply (_in); |
duke@1 | 112 | } |
duke@1 | 113 | } // copy |
duke@1 | 114 | |
duke@1 | 115 | |
duke@1 | 116 | /** Destroys the policy object. It is the responsibility of |
duke@1 | 117 | * the policy object to determine whether it can be destroyed. |
duke@1 | 118 | */ |
duke@1 | 119 | public void destroy () |
duke@1 | 120 | { |
duke@1 | 121 | org.omg.CORBA.portable.InputStream _in = null; |
duke@1 | 122 | try { |
duke@1 | 123 | org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true); |
duke@1 | 124 | _in = _invoke (_out); |
duke@1 | 125 | } catch (org.omg.CORBA.portable.ApplicationException _ex) { |
duke@1 | 126 | _in = _ex.getInputStream (); |
duke@1 | 127 | String _id = _ex.getId (); |
duke@1 | 128 | throw new org.omg.CORBA.MARSHAL (_id); |
duke@1 | 129 | } catch (org.omg.CORBA.portable.RemarshalException _rm) { |
duke@1 | 130 | destroy (); |
duke@1 | 131 | } finally { |
duke@1 | 132 | _releaseReply (_in); |
duke@1 | 133 | } |
duke@1 | 134 | } // destroy |
duke@1 | 135 | |
duke@1 | 136 | // Type-specific CORBA::Object operations |
duke@1 | 137 | private static String[] __ids = { |
duke@1 | 138 | "IDL:omg.org/CORBA/Policy:1.0"}; |
duke@1 | 139 | |
duke@1 | 140 | public String[] _ids () |
duke@1 | 141 | { |
duke@1 | 142 | return (String[])__ids.clone (); |
duke@1 | 143 | } |
duke@1 | 144 | |
duke@1 | 145 | private void readObject (java.io.ObjectInputStream s) |
duke@1 | 146 | { |
duke@1 | 147 | try |
duke@1 | 148 | { |
duke@1 | 149 | String str = s.readUTF (); |
duke@1 | 150 | org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); |
duke@1 | 151 | org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); |
duke@1 | 152 | _set_delegate (delegate); |
duke@1 | 153 | } catch (java.io.IOException e) {} |
duke@1 | 154 | } |
duke@1 | 155 | |
duke@1 | 156 | private void writeObject (java.io.ObjectOutputStream s) |
duke@1 | 157 | { |
duke@1 | 158 | try |
duke@1 | 159 | { |
duke@1 | 160 | String str = org.omg.CORBA.ORB.init ().object_to_string (this); |
duke@1 | 161 | s.writeUTF (str); |
duke@1 | 162 | } catch (java.io.IOException e) {} |
duke@1 | 163 | } |
duke@1 | 164 | } // class _PolicyStub |