<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.17092" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I have a Java application which getting security information
and metadata of a file in windows platform. And the owner's SID of a file is
also requried. </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I found that jcifs has a patch named GetOwnerSid.patch. So, I
applied GetOwnerSid.patch to jcifs-1.2.24.jar.</FONT></DIV>
<DIV><FONT size=2>It succeeded in getting the owner's SID, but another problem
is coming.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>When I use SmbFile.getShareSecurity() to get the information
of a share folder, ArrayIndexOutOfBoundsException occurred. </FONT></DIV>
<DIV><FONT size=2>Before applying the patch, this exception did not
occur.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>It seems that there is some problem in
GetOwnerSid.patch.</FONT></DIV>
<DIV><FONT size=2>As below, the "bufferIndex" is changed in line 36, so the
offset of "size" and "numAces" (line 42, 44) become wrong.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>-------</FONT></DIV>
<DIV><FONT size=2><SPAN class="hl line"> 33 </SPAN><SPAN
class="hl kwb">> if (
ownerGOffset > 0 ) {</SPAN><BR><SPAN class="hl line"> 34
</SPAN><SPAN
class="hl kwb">>
bufferIndex = start + ownerGOffset;</SPAN><BR><SPAN class="hl line">
35 </SPAN><SPAN
class="hl kwb">>
owner_group = new SID ( buffer, bufferIndex );</SPAN><BR><SPAN
class="hl line"> 36 </SPAN><SPAN
class="hl kwb">>
bufferIndex += 28; // ???</SPAN><BR><SPAN class="hl line"> 37
</SPAN><SPAN class="hl kwb">>
}</SPAN><BR><SPAN class="hl line"> 38 </SPAN><SPAN
class="hl kwb">> </SPAN><BR><SPAN class="hl line"> 39
</SPAN><SPAN class="hl kwb">>
if ( daclOffset > 0 ) {</SPAN><BR><SPAN class="hl line"> 40
</SPAN><SPAN
class="hl kwb">>
bufferIndex++; // revision</SPAN><BR><SPAN class="hl line"> 41
</SPAN><SPAN
class="hl kwb">>
bufferIndex++;</SPAN><BR><SPAN class="hl line"> 42 </SPAN><SPAN
class="hl kwb">>
int size = ServerMessageBlock.readInt2(buffer, bufferIndex);</SPAN><BR><SPAN
class="hl line"> 43 </SPAN><SPAN
class="hl kwb">>
bufferIndex += 2;</SPAN><BR><SPAN class="hl line"> 44 </SPAN><SPAN
class="hl kwb">>
int numAces = ServerMessageBlock.readInt4(buffer, bufferIndex);</SPAN><BR><SPAN
class="hl line"> 45 </SPAN><SPAN
class="hl kwb">>
bufferIndex += 4;</SPAN><BR></FONT></DIV>
<DIV><FONT size=2>-------</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I think that it will be right as below. (Line 42: bufferIndex
-> daclOffset)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><SPAN class="hl line"> 42 </SPAN><SPAN
class="hl kwb">>
int size = ServerMessageBlock.readInt2(buffer, daclOffset);</SPAN></FONT></DIV>
<DIV><SPAN class="hl kwb"><FONT
size=2> ^^^^^^^^^^</FONT></SPAN></DIV>
<DIV><SPAN class="hl kwb"></SPAN><BR><FONT size=2>I'm sorry I'm not sure about
this problem, could you help me to resolve it?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>And I saw that this patch has not been took to trunk, do you
have a plan to do this?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Best Regards from Denny.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV></BODY></HTML>