DCESRV stuff v3

Stefan Metzmacher metze at metzemix.de
Wed Jan 7 09:01:22 GMT 2004


Stefan Metzmacher wrote:

> tridge at samba.org wrote:
>  > Metze,
>  >
>  >  > I have a new patch :-)
>  >
>  > thanks!
>  >
>  > I like the approach in your patch, except for the remoteserver.pl
>  > code.
>  >
>  > I don't think we need a code generator at all for the remote rpc
>  > server backend (ie. we don't need any pidl changes at all). Instead I
>  > think we can write a fairly simple single C file that uses the table
>  > in librpc/gen_ndr/tables.c to do all of the remote rpc server. This
>  > should be easier to maintain. The reason this is possible is that we
>  > have the "struct_size" element in struct dcerpc_interface_call. That
>  > element allows us to allocate the buffer to hold the rpc structure for
>  > each call with the right size. See dcerpc_ndr_validate_in() for an
>  > example of how this can be done.
> 
> I need a to look at this a bit closer ... but seems to work too:-)
> 

Ok I got it. I have coded some bits, but we need to discuss some details before I'll provide a patch :-)

This is the function that will perform the remote call

static NTSTATUS remote_handle_call(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
{
	struct dcesrv_remote_private *private = dce_call->conn->private;
	NTSTATUS status;
	uint16 opnum = dce_call->pkt.u.request.opnum;
	ndr_push_flags_fn_t ndr_push_fn = dce_call->conn->iface->ndr->calls[opnum].ndr_push;
	ndr_pull_flags_fn_t ndr_pull_fn = dce_call->conn->iface->ndr->calls[opnum].ndr_pull;
	size_t struct_size = dce_call->conn->iface->ndr->calls[opnum].struct_size;

	status = dcerpc_ndr_request(private->c_pipe, opnum, mem_ctx,
				    (ndr_push_flags_fn_t) ndr_push_fn,
				    (ndr_pull_flags_fn_t) ndr_pull_fn,
				    r, struct_size);

	return status;
}

-- 

metze

-------------------------------------------
Stefan (metze) Metzmacher <metze at metzemix.de>


More information about the samba-technical mailing list