[jcifs] jarapac status?

Michael B Allen ioplex at gmail.com
Wed Apr 7 10:05:37 MDT 2010


On Wed, Apr 7, 2010 at 11:20 AM, Jason Herr <Jason.Herr at raritan.com> wrote:
> Greetings,
>
> I'm trying to figure out how to recreate the smb "net rpc shutdown" command
> in Java without resorting to commandline or native code.  It looks like
> jarapac would have been the right solution, but it doesn't compile (ndr.old
> is still being referenced by code within the project) and the cvs repo is
> toast.

Hi Jason,

Jarapac is dead.

>  It looks like j-interop has replaced jarapacs functionality (and
> forked jarapac into j-interop).  While j-interop can do this with a COM
> request, I'm trying to avoid using COM.

Last I checked, j-interop does not have an IDL compiler so you have to
write stubs by hand. That is borderline insanity. Anything remotely
complex will quickly become totally incomprehensible.

>  I'd rather just use straight RPC
> (required to I should say).  Search hasn't gotten me on the right track, so
> I'm asking something that's obvious to anyone who has been working with
> jcifs/j-interop/jarapacs for a while, but I'm not getting it.  Are there
> more jarapac docs somewhere?

JCIFS has an IDL compiler and ncacn_np transport that can be used to
do exactly what you want without much code.

Do the following:

1. Get a packet capture of "net rpc shutdown".

2. Look at the capture with WireShark and determine the interface
being used, the operation number and find the corresponding IDL. If
you figure out the function name used by MS, that would probably be
enough to find the IDL just using Google. Resources are the Samba
source, Microsoft's website and elsewhere.

3. Write an IDL file (or copy and add the desired function to JCIFS
.idl file if it already has that interface) and compile it with our
midlc C program available in our download area. Note that you'll need
to get the types right as we use a relatively small subset of types
compared to what you'll find in MS IDL. Also note that Samba's IDL
uses a lot of extensions and things that midl and thus mildc will not
understand. Fortunately the shutdown command is probably trivial.

4. Create a class and method that calls the function. Look at
jcifs.smb.SID.getServerSid(). That is a nice self contained example of
how to fire a DCERPC command.

Mike

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


More information about the jCIFS mailing list