<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.17092" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=宋体>Hi Mike,</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>I tried to update the patch to adapt
jcifs_1.3.15.</FONT></DIV>
<DIV><FONT face=宋体><FONT face=宋体>Hoping that it will be helpful to others,
I'm sending it to you.</FONT></FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>- GetOwnerSid_1.3.15.patch</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>Besides adapting to the latest version of JCIFS,
</FONT></DIV>
<DIV><FONT face=宋体>fixed the ArrayIndexOutOfBoundsException problom by
</FONT></DIV>
<DIV><FONT face=宋体>changing the position of "bufferIndex = start +
daclOffset;".</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>I'm a newcomer of JCIFS, if there is something wrong with it,
</FONT></DIV>
<DIV><FONT face=宋体>please point it to me.</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>Good Luck!</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>Denny</FONT></DIV>
<DIV><FONT face=宋体 size=2><FONT size=3></FONT> </DIV></FONT>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 9pt 宋体">----- Original Message ----- </DIV>
<DIV style="BACKGROUND: #e4e4e4; FONT: 9pt 宋体; font-color: black"><B>From:</B>
<A title=ioplex@gmail.com href="mailto:ioplex@gmail.com">Michael B Allen</A>
</DIV>
<DIV style="FONT: 9pt 宋体"><B>To:</B> <A title=tudoudpg@163.com
href="mailto:tudoudpg@163.com">zhangpeng</A> </DIV>
<DIV style="FONT: 9pt 宋体"><B>Cc:</B> <A title=jcifs@lists.samba.org
href="mailto:jcifs@lists.samba.org">jcifs@lists.samba.org</A> </DIV>
<DIV style="FONT: 9pt 宋体"><B>Sent:</B> Saturday, November 13, 2010 6:48
AM</DIV>
<DIV style="FONT: 9pt 宋体"><B>Subject:</B> Re: [jcifs] Question about
GetOwnerSid.patch</DIV>
<DIV><BR></DIV>Hi Denny,<BR><BR>I think that patch is quite old at this point.
You would have to go<BR>through it line-by-line and actually understand what
it's doing and<BR>apply the necessary changes to the latest version of JCIFS.
There<BR>currently are no plans to incorporate the GetOwnerSid patch. But
if<BR>you get it working, please post a new patch. It might help the
next<BR>person.<BR><BR>Mike<BR><BR>-- <BR>Michael B Allen<BR>Java Active
Directory Integration<BR><A
href="http://www.ioplex.com/">http://www.ioplex.com/</A><BR><BR>2010/11/10
zhangpeng <<A
href="mailto:tudoudpg@163.com">tudoudpg@163.com</A>>:<BR>>
Hi<BR>><BR>> I have a Java application which getting security
information and metadata of<BR>> a file in windows platform. And the
owner's SID of a file is also requried.<BR>><BR>> I found that jcifs has
a patch named GetOwnerSid.patch. So, I applied<BR>> GetOwnerSid.patch to
jcifs-1.2.24.jar.<BR>> It succeeded in getting the owner's SID, but another
problem is coming.<BR>><BR>> When I use SmbFile.getShareSecurity() to
get the information of a share<BR>> folder, ArrayIndexOutOfBoundsException
occurred.<BR>> Before applying the patch, this exception did not
occur.<BR>><BR>> It seems that there is some problem in
GetOwnerSid.patch.<BR>> As below, the "bufferIndex" is changed in line 36,
so the offset of "size"<BR>> and "numAces" (line 42, 44) become
wrong.<BR>><BR>> -------<BR>> 33 > if ( ownerGOffset > 0 )
{<BR>> 34 > bufferIndex = start + ownerGOffset;<BR>> 35 >
owner_group = new SID ( buffer, bufferIndex );<BR>> 36 > bufferIndex +=
28; // ???<BR>> 37 > }<BR>> 38 ><BR>> 39 > if ( daclOffset
> 0 ) {<BR>> 40 > bufferIndex++; // revision<BR>> 41 >
bufferIndex++;<BR>> 42 > int size =
ServerMessageBlock.readInt2(buffer,<BR>> bufferIndex);<BR>> 43 >
bufferIndex += 2;<BR>> 44 > int numAces =
ServerMessageBlock.readInt4(buffer,<BR>> bufferIndex);<BR>> 45 >
bufferIndex += 4;<BR>> -------<BR>><BR>> I think that it will be
right as below. (Line 42: bufferIndex -> daclOffset)<BR>><BR>> 42
> int size = ServerMessageBlock.readInt2(buffer,<BR>>
daclOffset);<BR>> ^^^^^^^^^^<BR>> I'm sorry I'm not sure about this
problem, could you help me to resolve it?<BR>><BR>> And I saw that this
patch has not been took to trunk, do you have a plan to<BR>> do
this?<BR>><BR>><BR>> Best Regards from
Denny.<BR>><BR>></BLOCKQUOTE></BODY></HTML>