db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: Grant/Revoke subtask - EXTERNAL SECURITY DEFINER | EXTERNAL SECURITY INVOKER
Date Fri, 24 Feb 2006 20:36:34 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Sounds right!... Minor comment, may be this should be changed:<br>
<br>
if (readMoreFromDisk == 1)<br>
<br>
to<br>
<br>
if (readMoreFromDisk <b>&gt; 0</b>)<br>
<br>
to support future versions. This approach does seem easier and
"cleaner" in this context.<br>
<br>
Satheesh<br>
<br>
Mamta Satoor wrote:<br>
<blockquote
 cite="midd9619e4a0602241223q58d702c3r11358cb9a5c4d246@mail.gmail.com"
 type="cite">
  <div>Actually, I think I figured it out. </div>
  <div>&nbsp;</div>
  <div>A pre-10.2 db,&nbsp;in it's on disk AliasInfo format,&nbsp;will have
an
unused value which is set to 0. </div>
  <div>&nbsp;</div>
  <div>10.2 release Derby&nbsp;will check if the on disk AliasInfo's
unused&nbsp;value is set to 0(which means it is dealing with&nbsp;pre-10.2
db)&nbsp;and if yes, then it will default the external security info to true
meaning use invoker's privileges. </div>
  <div>&nbsp;</div>
  <div>A&nbsp;10.2 db's on disk AliasInfo will have the unused value set to
1. This will be an indication that we are dealing with a 10.2 database
and we should go ahead and read the external security information from
the disk which could be true/false. </div>
  <div>&nbsp;</div>
  <div>Here is how I think the changed readExternal and writeExternal
should look like in 10.2 catalog.types.RoutineAliasInfo</div>
  <div>
  <p>&nbsp;public void readExternal( ObjectInput in )<br>
&nbsp;&nbsp; throws IOException, ClassNotFoundException<br>
&nbsp;{<br>
&nbsp;&nbsp;super.readExternal(in);<br>
&nbsp;&nbsp;specificName = (String) in.readObject();<br>
&nbsp;&nbsp;dynamicResultSets = in.readInt();<br>
&nbsp;&nbsp;parameterCount = in.readInt();<br>
&nbsp;&nbsp;parameterStyle = in.readShort();<br>
&nbsp;&nbsp;sqlAllowed = in.readShort();<br>
&nbsp;&nbsp;returnType = (TypeDescriptor) in.readObject();<br>
&nbsp;&nbsp;calledOnNullInput = in.readBoolean();<br>
&nbsp;&nbsp;int readMoreFromDisk = in.readInt(); //This will be 0 from pre-10.2 db</p>
  <p>&nbsp;&nbsp;if (parameterCount != 0) {<br>
&nbsp;&nbsp;&nbsp;parameterNames = new String[parameterCount];<br>
&nbsp;&nbsp;&nbsp;parameterTypes = new TypeDescriptor[parameterCount];</p>
  <p>&nbsp;&nbsp;&nbsp;ArrayUtil.readArrayItems(in, parameterNames);<br>
&nbsp;&nbsp;&nbsp;ArrayUtil.readArrayItems(in, parameterTypes);<br>
&nbsp;&nbsp;&nbsp;parameterModes = ArrayUtil.readIntArray(in);</p>
  <p>&nbsp;&nbsp;} else {<br>
&nbsp;&nbsp;&nbsp;parameterNames = null;<br>
&nbsp;&nbsp;&nbsp;parameterTypes = null;<br>
&nbsp;&nbsp;&nbsp;parameterModes = null;<br>
&nbsp;&nbsp;}</p>
  <p>&nbsp;&nbsp;if (readMoreFromDisk == 1)<br>
&nbsp;&nbsp;&nbsp;//If true, that means we are dealing with 10.2 db and hence<br>
&nbsp;&nbsp;&nbsp;//we should read external security info from the disk<br>
&nbsp;&nbsp;&nbsp;executeUsingPermissionsOfRoutineInvoker = in.readBoolean
();<br>
&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;//We are dealing with pre-10.2 db, which doesn't have external<br>
&nbsp;&nbsp;&nbsp;//security feature on routines and hence no information about<br>
&nbsp;&nbsp;&nbsp;//external security will be found on the disk <br>
&nbsp;&nbsp;&nbsp;executeUsingPermissionsOfRoutineInvoker = true;
  </p>
  <p>&nbsp;&nbsp;in.readInt(); //future expansion for post 10.2 release</p>
  <p>&nbsp;}</p>
  <p>&nbsp;/**<br>
&nbsp; * Write this object to a stream of stored objects.<br>
&nbsp; *<br>
&nbsp; * @param out write bytes here.<br>
&nbsp; *<br>
&nbsp; * @exception IOException&nbsp;&nbsp;thrown on error<br>
&nbsp; */<br>
&nbsp;public void writeExternal( ObjectOutput out )<br>
&nbsp;&nbsp; throws IOException<br>
&nbsp;{<br>
&nbsp;&nbsp;super.writeExternal(out);<br>
&nbsp;&nbsp;out.writeObject(specificName);<br>
&nbsp;&nbsp;out.writeInt(dynamicResultSets);<br>
&nbsp;&nbsp;out.writeInt(parameterCount);<br>
&nbsp;&nbsp;out.writeShort(parameterStyle);<br>
&nbsp;&nbsp;out.writeShort
(sqlAllowed);<br>
&nbsp;&nbsp;out.writeObject(returnType);<br>
&nbsp;&nbsp;out.writeBoolean(calledOnNullInput);<br>
&nbsp;&nbsp;out.writeInt(1); // 1 means we are dealing with 10.2 on disk format<br>
&nbsp;&nbsp;if (parameterCount != 0) {<br>
&nbsp;&nbsp;&nbsp;ArrayUtil.writeArrayItems
(out, parameterNames);<br>
&nbsp;&nbsp;&nbsp;ArrayUtil.writeArrayItems(out, parameterTypes);<br>
&nbsp;&nbsp;&nbsp;ArrayUtil.writeIntArray(out, parameterModes);<br>
&nbsp;&nbsp;}<br>
&nbsp;&nbsp;out.writeBoolean(executeUsingPermissionsOfRoutineInvoker);<br>
&nbsp;&nbsp;out.writeInt(0); //future expansion for post 10.2 releases<br>
&nbsp;}<br>
  </p>
  <br>
  <br>
&nbsp;</div>
  <div><span class="gmail_quote">On 2/24/06, <b
 class="gmail_sendername">Mamta Satoor</b> &lt;<a
 href="mailto:msatoor@gmail.com">msatoor@gmail.com</a>&gt; wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left:
1ex;">
    <div>Hi,</div>
    <div>&nbsp;</div>
    <div>Dan, could you expand a little more on</div>
    <div><span class="q">"The RoutineAliasInfo has the correct
structure to support expansion. It<br>
writes out an unused value, set at 0. This could be bumped to indicate<br>
that more data needs to be read, e.g. 1 means the external security
info <br>
    </span>flag is written to disk etc. etc"?</div>
    <div>&nbsp;</div>
    <div>What I am looking for is what happens during upgrade if I&nbsp;add
another field to RoutineAliasInfo(since this change will become part of
SYSALIASES AliasInfo field)? I am not sure if it is as easy as just
changing the RoutineAliasInfo class and everything will work fine,
especially during an upgrade. </div>
    <div>&nbsp;</div>
    <div>Also, looking at&nbsp;Derby-337 (dblook doesn't generate SQL
statements for SQL functions.), it seems like Army had encountered some
problems when he had to add a filed to RoutineAliasInfo. </div>
    <div>&nbsp;</div>
    <div>Any thoughts on this will be helpful,</div>
    <span class="sg">
    <div>Mamta<br>
    <br>
&nbsp;</div>
    </span>
    <div><span class="e" id="q_1099d5ba12ac3c33_4">
    <div><span class="gmail_quote">On 2/22/06, <b
 class="gmail_sendername">Daniel John Debrunner</b> &lt;<a
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:djd@apache.org" target="_blank">djd@apache.org</a> &gt;
wrote:</span>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left:
1ex;">Satheesh
Bandaram wrote:<br>
      <br>
&gt;<br>
&gt; Mamta Satoor wrote:<br>
&gt;<br>
&gt;&gt; Satheesh, I was looking through the code last night and saw
following <br>
&gt;&gt; comment, about external security info flag, in
CreateAliasNode.init<br>
&gt;&gt; line 195<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; // GrantRevoke TODO: Figure out how
to save external
security<br>
&gt;&gt; info. Putting this in<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; // RoutineAliasInfo may not be the
best long term solution
      <br>
&gt;&gt; It seems like RoutineAliasInfo will be the logical place to
keep this<br>
&gt;&gt; external security information, similar to the way we keep other<br>
&gt;&gt; information like called on null input, parameter count etc.
Did you <br>
&gt;&gt; have reservations about this approach because we want to move
away<br>
&gt;&gt; from using objects in the system tables (which in this case is<br>
&gt;&gt; AliasInfo in SYSALIASES table)?<br>
&gt;<br>
&gt; Here are some of my concerns about adding another field to <br>
&gt; RoutineAliasInfo.<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;1. It would become harder to extract this
info from
RoutineAliasInfo<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as it is a Java object
for any metadata processing... like in<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dblook or for other GUI
tools. We would have to document how
      <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RoutineAliasInfo gets
generated as a character type and
maintain<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; that format in the future.<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;2. Have to support existing RoutineAliasInfo
instances created
in<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; existing databases. You
would have to introduce a new <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RoutineAliasInfo version
or add a new mapping to another
java object.<br>
      <br>
The RoutineAliasInfo has the correct structure to support expansion. It<br>
writes out an unused value, set at 0. This could be bumped to indicate <br>
that more data needs to be read, e.g. 1 means the external security info<br>
flag is written to disk etc. etc.<br>
      <br>
Dan.<br>
      <br>
      <br>
    </blockquote>
    </div>
    <br>
    </span></div>
  </blockquote>
  </div>
  <br>
</blockquote>
</body>
</html>


Mime
View raw message