[jcifs] Creating DCE/RPC Requests

Michael B Allen ioplex at gmail.com
Thu Jan 5 01:17:28 MST 2012


On Wed, Jan 4, 2012 at 2:04 AM, christofer.dutz at c-ware.de
<christofer.dutz at c-ware.de> wrote:
> Hi,
>
>
>
> I am currently digging into using the DCE/RPC parts of JCIFS. Unfortunately
> I am running into problems.
>
> Iused midlc (Version 0.6.1) To generate a JCIFS compatible stub for the
> svcctl Service and am now trying to call it. Unfortunately I am getting
> “jcifs.dcerpc.DcerpcException: DCERPC_FAULT_PROTO_ERROR”
>
>
>
> Here comes my code:
>
>
>
>             rpc.policy_handle scHandle = new rpc.policy_handle();
>
>             SvcCtl.OpenSCManager openSCManagerRpc = new
> SvcCtl.OpenSCManager(host, null, 0x0001 | 0x0002, scHandle);
>
>
>
>             // Connection-oriented DCE/RPC over SMB named pipes.
>
>             DcerpcHandle handle = DcerpcHandle.getHandle("ncacn_np:" + host
> + "[\\PIPE\\svcctl]",
>
>
> ConcurrentNtlmAuthenticator.getInstance().getNtlmPasswordAuthentication());
>
>             try {
>
>                 handle.sendrecv(openSCManagerRpc);           ßThe Exception
> is thrown when executing this line.
>
>                 if (openSCManagerRpc.retval != 0) {
>
>                     throw new SmbException(openSCManagerRpc.retval, true);
>
>                 }
>
>             } catch(Exception e) {
>
>                 e.printStackTrace();
>
>             } finally {
>
>                 try {
>
>                     handle.close();
>
>                 } catch(IOException ioe) {
>
>                     ioe.printStackTrace();
>
>                 }
>
>             }
>
>
>
> So what am I doing wrong? I would be really glad if you could help me get
> started, as Googling doesn’t seem to get me very far (There seems to be
> almost no information on this available)

Hi Chris,

The IDL is probably wrong. Look at Samba IDL. There is a lot of IDL
available in Microsoft documentation now too. Note that midlc only
understands a small critical subset of MIDL. In practice you really
need to get two captures and compare them side-by-side to verify that
the NDR segments are encoded in an identical way. This is true even if
you get it to actually work.

Mike

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


More information about the jCIFS mailing list