[jcifs] Question about GetOwnerSid.patch

Michael B Allen ioplex at gmail.com
Fri Nov 12 15:48:38 MST 2010


Hi Denny,

I think that patch is quite old at this point. You would have to go
through it line-by-line and actually understand what it's doing and
apply the necessary changes to the latest version of JCIFS. There
currently are no plans to incorporate the GetOwnerSid patch. But if
you get it working, please post a new patch. It might help the next
person.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

2010/11/10 zhangpeng <tudoudpg at 163.com>:
> 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.
>
>


More information about the jCIFS mailing list