diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-08-27 17:24:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:54 -0500 |
commit | 4bbb995e8dab284b4deaa2e2ee38eb329305d1c2 (patch) | |
tree | b360dbcf98c92e7b73d4c2bc592efc5fd34850bc /source3/include | |
parent | 5d4a189d4e1ddc7ba19c585811f2fb45b9534cc7 (diff) | |
download | samba-4bbb995e8dab284b4deaa2e2ee38eb329305d1c2.tar.gz samba-4bbb995e8dab284b4deaa2e2ee38eb329305d1c2.tar.bz2 samba-4bbb995e8dab284b4deaa2e2ee38eb329305d1c2.zip |
r17854: Steal the LDAP in NTSTATUS trick from Samba4
Thanks to Michael Adam <ma@sernet.de>
Volker
(This used to be commit 91878f9b6fbe5187fb7d0464008ea0abe7f11a73)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/nt_status.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source3/include/nt_status.h b/source3/include/nt_status.h index c48beafb6e..2b681101db 100644 --- a/source3/include/nt_status.h +++ b/source3/include/nt_status.h @@ -66,12 +66,34 @@ typedef uint32 WERROR; }\ } while (0) + +/* The top byte in an NTSTATUS code is used as a type field. + * Windows only uses value 0xC0 as an indicator for an NT error + * and 0x00 for success. + * So we can use the type field to store other types of error codes + * inside the three lower bytes. + * NB: The system error codes (errno) are not integrated via a type of + * their own but are mapped to genuine NT error codes via + * map_nt_error_from_unix() */ + +#define NT_STATUS_TYPE(status) ((NT_STATUS_V(status) & 0xFF000000) >> 24) + +#define NT_STATUS_TYPE_DOS 0xF1 +#define NT_STATUS_TYPE_LDAP 0xF2 + /* this defines special NTSTATUS codes to represent DOS errors. I have chosen this macro to produce status codes in the invalid NTSTATUS range */ -#define NT_STATUS_DOS(class, code) NT_STATUS(0xF1000000 | ((class)<<16) | code) -#define NT_STATUS_IS_DOS(status) ((NT_STATUS_V(status) & 0xFF000000) == 0xF1000000) +#define NT_STATUS_DOS_MASK (NT_STATUS_TYPE_DOS << 24) +#define NT_STATUS_DOS(class, code) NT_STATUS(NT_STATUS_DOS_MASK | ((class)<<16) | code) +#define NT_STATUS_IS_DOS(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_DOS_MASK) #define NT_STATUS_DOS_CLASS(status) ((NT_STATUS_V(status) >> 16) & 0xFF) #define NT_STATUS_DOS_CODE(status) (NT_STATUS_V(status) & 0xFFFF) +/* define ldap error codes as NTSTATUS codes */ +#define NT_STATUS_LDAP_MASK (NT_STATUS_TYPE_LDAP << 24) +#define NT_STATUS_LDAP(code) NT_STATUS(NT_STATUS_LDAP_MASK | code) +#define NT_STATUS_IS_LDAP(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_LDAP_MASK) +#define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) + #endif |