[jcifs] Question about GetOwnerSid.patch

Michael B Allen ioplex at gmail.com
Wed Nov 17 09:16:27 MST 2010


Hi Denny,

Thanks. I have copied it into the patches directory (in my local copy).

Mike

On Fri, Nov 12, 2010 at 10:13 PM, zhangpeng <tudoudpg at 163.com> wrote:
> Hi Mike,
>
> I tried to update the patch to adapt jcifs_1.3.15.
> Hoping that it will be helpful to others, I'm sending it to you.
>
> - GetOwnerSid_1.3.15.patch
>
> Besides adapting to the latest version of JCIFS,
> fixed the ArrayIndexOutOfBoundsException problom by
> changing the position of "bufferIndex = start + daclOffset;".
>
> I'm a newcomer of JCIFS, if there is something wrong with it,
> please point it to me.
>
> Good Luck!
>
> Denny
>
>
> ----- Original Message -----
> From: Michael B Allen
> To: zhangpeng
> Cc: jcifs at lists.samba.org
> Sent: Saturday, November 13, 2010 6:48 AM
> Subject: Re: [jcifs] Question about GetOwnerSid.patch
> 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.
>>
>>



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


More information about the jCIFS mailing list