[jcifs] jcifs/jarapac errors trying to get apolicy_handle/SCmanager connection

Marcus Crafter crafterm at managesoft.com
Sat Dec 4 13:22:27 GMT 2004

Hi Michael,

Thanks for your detailed response mate, much appreciated.

The problem turned out to be environmental in the end. Removing the 
problematic machine from the domain and re-adding it fixed the problem.

I have a suspicion that the machine booted before the domain controller 
and was in a funny state. Some of our other people have seen this 
behaviour in a pure windows environment before as well.

After doing the above (or making sure the DC was up before the client 
was) we could connect to the SC manager and retrieve a policy handle no 
problems. Our RPC calls then started working and we were happy campers 

Thanks for the link to the rpctools package too, that looks really useful.

Michael B Allen wrote:
> Unfortunately, you may be aware that the Jarapc/JCIFS MSRPC code is highly
> experimental. Currently we are just writing test programs and have not
> implemented most of the desired calls or decided how to actually expose
> the functionality in the form of a user friendly API. If you choose to use
> the code it will be necessary to become familiar with things that would
> likely answer the questions you have just asked (e.g. windows networking
> protocol fundamentals, midl, ndr, packet captures, etc).

Sure. This has been the fun part so far :)

> The easiest and simplest to do what you want (and probably the only way to
> do it right) you need to write a Win32 program using the SC manager calls
> necessary to perform the desired operation. Then take a packet capture of
> that. Then write your Jarapac/JCIFS MSRPC test program starting with the
> SC manager midl in jarapac/examples (I specifically explored those calls
> after Michael asked about this a few weeks ago). Then take a capture of
> that and open them side by side in Ethereal.

Yes. This is the plan we've followed the past few weeks to get the 
service related RPC calls Michael had submitted to work. As an aside we 
did try with the latest midl compiler and jarapac code last week but 
there seemed to be something preventing the generated code from 
compiling (m_sid variable or similar that didn't seem to be referenced 
anyware in the idl).

If you'd like more information about this I can send in what we have. 
Just thought I'd let you know.

> Finally, it is vitally important that you're using the latest combo if
> midlc, jarapac, and jcifs. Every release has fixed a critical problem or
> has been a major improvement.

Cool. I'll make sure we're doing that in the future.

> I think MIDLC, Jarapac, and jCIFS are up to the task now but if you run
> into a problem don't heasitate to ask. I might not have a good answer or I
> might just be busy but I might have a quick answer that could save you a
> lot of time. For example, I can look at a raw hexdump / MSDN API
> documentation / Samba4 IDL and determine the midl likel to generate the
> right NDR. So if you run into an encoding / decoding error that you're not
> sure about, post your midl input and a hexdump (or better send me a
> capture) and I'll try to decode it for you.

Great thanks for that Michael, we (and I reckon everyone else on the 
list) really appreciates your, and the other developers time and 
dedication to the project! :)
JCIFS, and the related libraries, have really helped us achieve a lot in 
our project.

Thanks again.



      ,,$$$$$$$$$,      Marcus Crafter
     ;$'      '$$$$:    Computer Systems Engineer
     $:         $$$$:   ManageSoft Corporation
      $       o_)$$$:   Frankfurt am Main, Germany
      ;$,    _/\ &&:'
        '     /( &&&

More information about the jcifs mailing list