[jcifs] OSF DCE Server side implementation in Java

Michael B Allen ioplex at gmail.com
Tue May 5 04:34:13 GMT 2009


On Mon, May 4, 2009 at 10:26 PM, Rajeev Angal <Rajeev.Angal at sun.com> wrote:
> Hi,
>
>
> I have looked at both jarapac and jcifs for server side OSF/DCE RPC Java
> implementation. I have been able to get to client side code only.
> My need is to implement a OSF/DCE server in java for remote compliant
> clients to
> access.
>
> Any pointers to how I can go about implement my server highly appeciated.
> Eg : presumably jcifs has all the necessary protocol and
> marshalingdemarshalling
> code - what would it take to factor a server? Any sample code ? Other
> opensource
> projects etc.

Hi Rajeev,

There's no server-side ncacn_np or server-side anything in JCIFS and
it would be really painful to implement that. But it would probably be
not too hard to implement an ncacn_tcp_ip server and that's probably
what you want anyway. The DCERPC code in JCIFS is also really geared
toward a client and moreover for doing MSRPC. But you definitely want
to look at it. It would probably help you in one way or another.
There's not much too it.

However, the most difficult part of all of this is generating stubs
that emit and parse NDR (this is the marshalling / demarshalling part
you referred to). It took me a few months to write the midlc
"compiler" that we use to read Microsoft style IDL and emit .java
stubs. Unfortunately the midlc code itself is not pretty and there's
no validation so I'm not sure it can be provided to devs as part of a
real toolchain. Also it emits inlined stubs as opposed to stubs that
use format strings like MS' so they're usually pretty big. But
otherwise midlc actually works pretty well and it will do the server
marshalling equally well as the client marshalling (a client
demarshalling a response is not much different from a server
demarshalling a request). I had to manually hack a stub once but it
was a two line fix. And the stub code itself is clean and solid which
is all that really matters.

Regarding Jarapac. It was designed to be an OpenGroup style
implementation but it is very incomplete (when the author released it,
he gave it a version number of 0.0.0). Also it required hand-written
stubs so the whole marshalling layer was unusable. I made one pass at
it with midlc but abandoned it for the more concise DCERPC minimalist
code we use in JCIFS now. The bottom line is that Jarapac will
probably not be of much use to you.

So overall, I don't think you'll be surprised to hear we're using a
fairly non-generic solution: it's client oriented, Microsoft oriented
and the tool chain is not suitable for a professional product.

I would recommend creating a stand-alone ncacn_tcp_ip server with code
derived from JCIFS's DCERPC stuff [1] and use midlc to generate the
stubs. But nothing you do is going to be something that will make it
back into JCIFS.

Mike

[1] Or write it from scratch if you don't want to be bound by the
LGPL. Note that even though midlc is GPL, the stubs generated by it
can be licensed however you like.

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


More information about the jcifs mailing list