svn commit: samba r1845 - in branches/SAMBA_4_0/source: build/pidl librpc/rpc

tridge at tridge at
Wed Aug 18 15:03:20 GMT 2004


 > I would propose the following patch, and the calling function should always look at
 > r.out.result .

That would certainly give the most consistent interface. 

Maybe we could provide macros similar to NT_STATUS_IS_OK() and
NT_STATUS_EQUAL() like this:

#define RPC_STATUS_IS_OK(r, status) \
	(NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK((r)->result))

#define RPC_STATUS_EQUAL(r, status, status2) \
	(NT_STATUS_IS_OK(status) && NT_STATUS_EQUAL((r)->result, status2))

#define RPC_STATUS(r, status) \

so we would have client code like this:

	status = dcerpc_samr_Close(p, mem_ctx, &r);
	if (!RPC_STATUS_IS_OK(&r, status)) {
		printf("Close handle failed - %s\n", rpc_errstr(p, r->result));

where rpc_errstr() would be something like this:

const char *rpc_errstr(struct dcerpc_pipe *p, NTSTATUS status)
		return dcerpc_fault_errstr(p->last_fault_code);
	return nt_errstr(status);

More information about the samba-technical mailing list