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

Stefan (metze) Metzmacher metze at samba.org
Thu Aug 19 10:23:42 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tridge at samba.org schrieb:

| Metze,
|
|  > 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) \
| 	(NT_STATUS_IS_OK(status)?(r)->result: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)
| {
| 	if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
| 		return dcerpc_fault_errstr(p->last_fault_code);
| 	}
| 	return nt_errstr(status);
| }

Yes something like that...

- --
metze

Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBJH+um70gjA5TCD8RAgMfAJ9SxJ1s99XM6lvjuRaqi/JLxnvWUQCgoe7h
EPzOFxO7CR0MBVVvgxRbzkI=
=/7YB
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list