[jcifs] Question about GetOwnerSid.patch

zhangpeng tudoudpg at 163.com
Wed Nov 10 05:22:36 MST 2010


Hi

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. 

I found that jcifs has a patch named GetOwnerSid.patch. So, I applied GetOwnerSid.patch to jcifs-1.2.24.jar.
It succeeded in getting the owner's SID, but another problem is coming.

When I use SmbFile.getShareSecurity() to get the information of a share folder, ArrayIndexOutOfBoundsException occurred. 
Before applying the patch, this exception did not occur.

It seems that there is some problem in GetOwnerSid.patch.
As below, the "bufferIndex" is changed in line 36, so the offset of "size" and "numAces" (line 42, 44) become wrong.

-------
   33 >         if ( ownerGOffset > 0 ) {
   34 >           bufferIndex = start + ownerGOffset;
   35 >           owner_group = new SID ( buffer, bufferIndex );
   36 >           bufferIndex += 28; // ???
   37 >         }
   38 > 
   39 >         if ( daclOffset > 0 ) {
   40 >           bufferIndex++; // revision
   41 >           bufferIndex++;
   42 >           int size = ServerMessageBlock.readInt2(buffer, bufferIndex);
   43 >           bufferIndex += 2;
   44 >           int numAces = ServerMessageBlock.readInt4(buffer, bufferIndex);
   45 >           bufferIndex += 4;

-------

I think that it will be right as below. (Line 42: bufferIndex -> daclOffset)

   42 >           int size = ServerMessageBlock.readInt2(buffer, daclOffset);
                                                                 ^^^^^^^^^^

I'm sorry I'm not sure about this problem, could you help me to resolve it?

And I saw that this patch has not been took to trunk, do you have a plan to do this?


Best Regards from Denny.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20101110/02bc77f3/attachment.html>


More information about the jCIFS mailing list