about unification of error/return codes

Michael Adam ma at sernet.de
Tue Aug 15 13:34:07 GMT 2006


While working on handing over more meaningful return codes
through the function call layers (with the goal of producing
better error reporting at the top level of the net utility),
I came across the following problem:

There are several types of return codes in Samba functions.
ntstatus, krb5, gss, system (errno), ldap, dos, bool, and
possibly more. Dos and (in samba 4 also ldap) codes have
been integrated into the ntstatus error codes by making use
of the top byte of the ntstatus code as a type field. 
The NTSTATUS type is of cours omnipresent in samba code.

On the other hand, there is the type ADS_STATUS, which already
unifies ntstatus, system, gss, ldap and krb5 error types.
This type is mostly used in libads/.

I discussed with Volker how to best work towards an overall
uniform error type. Volker is inclined to use the NTSTATUS
type in the manner described above. This is no problem for
dos, system and ldap errors. 

For krb5, there is the problem, that all four bytes of the error
code are used by the kerbers error tables. But this is should be
no problem since there are not many krb5 error codes in total
(around 350); they could be mapped into the 3 free bytes of an

For gss-api, we might have a real problem, since there is
one major code and one minor code. The major code uses 
all four bytes but it seems to me as if it could easly be
compressed algorithmically to fit into the free part of NTSTATUS,
since lots of bits of this 4-byte code seem to be unused.
But the minor code that is handed up from the underlying
mechanism is a problem. I don't know if there is a way
to put this into NTSTATUS too, if we possibly do not even need
to map the full GSS_API return code. So this might give a halt
to the idea of completely changing over to NTSTATUS.

Any hints and opinions about these thougts are greatly appreciated!

Cheers, Michael

More information about the samba-technical mailing list