pidl:Samba4/Client: don't mix rpc and application NTSTATUS errors anymore for the new bindings

Stefan (metze) Metzmacher metze at
Tue Apr 6 04:03:03 MDT 2010

Andrew Bartlett schrieb:
> On Tue, 2010-04-06 at 10:42 +0200, Stefan (metze) Metzmacher wrote:
>> What about this:
>> If the function defined in IDL returns NTSTATUS, WERROR or some other
>> defined type, then we do something like this:
>> if (NT_STATUS_IS_OK(status) && !NT_STATUS_IS_OK(r.out.result)) {
>> }
>> So that returned NTSTATUS from a stub function will only return
>> NT_STATUS_OK, if both status codes are OK.
>> This way we would avoid magic mapping and still make sure callers only
>> have to check one variable, if they only care about success and failure.
> I think I understand - will that be the same error we currently use, or
> something else?  Also, can we we have the current mapping for these
> cases, or do you have some reason to avoid that?

Currently we do this in for NTSTATUS functions

if (NT_STATUS_IS_OK(status)) {
	status = r->out.result;
return status;

In s3 we do this for WERROR functions
if (NT_STATUS_IS_OK(status)) {
	status = werror_to_ntstatus(r.out.result);
return status;

Where the callers would only look for the return value instead of
r.out.result, because both have the application layer status.

While with the new approach the return value would only saw there's
something wrong at the application layer, but the caller needs to check
r.out.result for the exact reason. And that can be implemented also
for WERROR based functions.

>> Advanced callers would also be able to disable this behavior by setting
>> a flag on the dcerpc_binding_handle.
> Good.
>> Does that sound ok for you?
> This is exactly the kind of thing what I was hoping for. 

hmm, the only problem is that a lot of current caller's would need to
change, as they currently only expect NT_STATUS_OK as valid for the rpc
layer and they would bail out if they get NT_STATUS_RPC_NOT_RPC_ERROR.

I think I need to do a bit more research regarding which error type we
should return as RPC layer status. It seems that the uint32 value in the
Fault PDU can contain NCA_C_ codes, WERROR codes, HRESULT values
and also NTSTATUS codes, I'll ask doc-help a more detailed description
in [MS-RPCE] and [MS-ERREF].


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the samba-technical mailing list