<!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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT size=2>-------</FONT></DIV>
<DIV><FONT size=2><SPAN class="hl line">&nbsp;&nbsp; 33 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( 
ownerGOffset &gt; 0 ) {</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 34 
</SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex = start + ownerGOffset;</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 
35 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
owner_group = new SID ( buffer, bufferIndex );</SPAN><BR><SPAN 
class="hl line">&nbsp;&nbsp; 36 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex += 28; // ???</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 37 
</SPAN><SPAN class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 38 </SPAN><SPAN 
class="hl kwb">&gt; </SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 39 
</SPAN><SPAN class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if ( daclOffset &gt; 0 ) {</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 40 
</SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex++; // revision</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 41 
</SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex++;</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 42 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
int size = ServerMessageBlock.readInt2(buffer, bufferIndex);</SPAN><BR><SPAN 
class="hl line">&nbsp;&nbsp; 43 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex += 2;</SPAN><BR><SPAN class="hl line">&nbsp;&nbsp; 44 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
int numAces = ServerMessageBlock.readInt4(buffer, bufferIndex);</SPAN><BR><SPAN 
class="hl line">&nbsp;&nbsp; 45 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
bufferIndex += 4;</SPAN><BR></FONT></DIV>
<DIV><FONT size=2>-------</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>I think that it will be right as below. (Line 42: bufferIndex 
-&gt; daclOffset)</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2><SPAN class="hl line">&nbsp;&nbsp; 42 </SPAN><SPAN 
class="hl kwb">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
int size = ServerMessageBlock.readInt2(buffer, daclOffset);</SPAN></FONT></DIV>
<DIV><SPAN class="hl kwb"><FONT 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^^^^^^^^^^</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Best Regards from Denny.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV></BODY></HTML>