[jcifs] lookupnames/setsecdesc in jcifs

Michael B Allen ioplex at gmail.com
Fri Nov 13 16:30:35 MST 2009


On Fri, Nov 13, 2009 at 10:42 AM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Fri, Nov 13, 2009 at 04:06:59PM +0100, Volker Lendecke wrote:
>> As a little task I would like to implement
>> SetSecurityDescriptor in jcifs. That call itself seems
>> pretty simple to do, the more difficult question is to get
>> the LsaLookupNames right.
>>
>> Question: How did you generate lsarpc.java from lsarpc.idl?
>
> Ignore me, found midlc.

Hi Volker,

Yeah, I just run midlc manually whenever a stub changes or if I add an RPC.

Regarding LsarLookupNames, I think the IDL from the new MS docs should
work as long as you adjust the type names to match the rest of the idl
and remove all the excessive typedeffing. Midlc syntax and behavior is
identical to midl for the subset of functionality that it implements.
Although midlc does implement *one* extension - the "op" attribute.

So I think LsarLookupNames would be something like this:

    [op(0x0e)]
    int LsarLookupNames([in] policy_handle *policy_handle,
            [in] uint32_t count,
            [in,size_is(count)] unicode_string *names,
            [out,unique] LsarRefDomainList *referenced_domains,
            [in,out] LsarTransSidArray *translated_sids,
            [in] uint32_t lookup_level,
            [in,out] uint32_t *mapped_count);

Note that all of the referenced types are already in lsarpc.idl so
this should be all you need to update in the idl.

For a good example of how to fire an RPC in JCIFS, look at
jcifs/smb/SID.getServerSid(). That's a nice little self-contained
call. Also you'll want to create an Msrpc* class that maps caller
friendly parameters and sets up the RPC properly. See
jcifs/dcerpc/msrpc/MsrpcLookupSids.java for an example that will
probably be like what you'll need.

Mike

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


More information about the jCIFS mailing list