diff options
author | Kai Blin <kai@samba.org> | 2009-04-16 11:49:25 +0200 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2009-04-22 00:14:45 +0200 |
commit | 7a9be21916589f2c2956e8b264648b66d074bfcb (patch) | |
tree | 44c4b4a5df10b375ffdb485d55a035a97008f8b9 /source3/libsmb | |
parent | 57267a300f35e8555ece9015c46353aa73e8eb2e (diff) | |
download | samba-7a9be21916589f2c2956e8b264648b66d074bfcb.tar.gz samba-7a9be21916589f2c2956e8b264648b66d074bfcb.tar.bz2 samba-7a9be21916589f2c2956e8b264648b66d074bfcb.zip |
errormap: Add wbcErr to NTSTATUS mappings
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/errormap.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c index 4ec30f7e17..aea5718c5a 100644 --- a/source3/libsmb/errormap.c +++ b/source3/libsmb/errormap.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "nsswitch/libwbclient/wbclient.h" /* This map was extracted by the ERRMAPEXTRACT smbtorture command. The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member @@ -1503,6 +1504,46 @@ WERROR ntstatus_to_werror(NTSTATUS error) return W_ERROR(NT_STATUS_V(error) & 0xffff); } +/******************************************************************************* + Map between wbcErr and NT status. +*******************************************************************************/ + +static const struct { + wbcErr wbc_err; + NTSTATUS nt_status; +} wbcErr_ntstatus_map[] = { + { WBC_ERR_SUCCESS, NT_STATUS_OK }, + { WBC_ERR_NOT_IMPLEMENTED, NT_STATUS_NOT_IMPLEMENTED }, + { WBC_ERR_UNKNOWN_FAILURE, NT_STATUS_INTERNAL_ERROR }, + { WBC_ERR_NO_MEMORY, NT_STATUS_NO_MEMORY }, + { WBC_ERR_INVALID_SID, NT_STATUS_INVALID_SID }, + { WBC_ERR_INVALID_PARAM, NT_STATUS_INVALID_PARAMETER }, + { WBC_ERR_WINBIND_NOT_AVAILABLE, NT_STATUS_SERVER_DISABLED }, + { WBC_ERR_DOMAIN_NOT_FOUND, NT_STATUS_NO_SUCH_DOMAIN }, + { WBC_ERR_INVALID_RESPONSE, NT_STATUS_INVALID_NETWORK_RESPONSE }, + { WBC_ERR_NSS_ERROR, NT_STATUS_INTERNAL_ERROR }, + { WBC_ERR_AUTH_ERROR, NT_STATUS_LOGON_FAILURE }, + { WBC_ERR_UNKNOWN_USER, NT_STATUS_NO_SUCH_USER }, + { WBC_ERR_UNKNOWN_GROUP, NT_STATUS_NO_SUCH_GROUP }, + { WBC_ERR_PWD_CHANGE_FAILED, NT_STATUS_PASSWORD_RESTRICTION } +}; + +NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err) +{ + int i; + + /* Look through list */ + for (i=0;i<ARRAY_SIZE(wbcErr_ntstatus_map);i++) { + if (wbcErr_ntstatus_map[i].wbc_err == wbc_err) { + return wbcErr_ntstatus_map[i].nt_status; + } + } + + /* Default return */ + return NT_STATUS_UNSUCCESSFUL; +} + + #if defined(HAVE_GSSAPI) /******************************************************************************* Map between gssapi errors and NT status. I made these up :-(. JRA. |