summaryrefslogtreecommitdiff
path: root/source4/libcli/util/errormap.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-04-23 15:12:35 +0200
committerAndrew Bartlett <abartlet@samba.org>2009-04-23 15:12:35 +0200
commit53d491c9a4011a7d9ad69db52fb91d163f3f990a (patch)
tree9d0ed3130f35142da50c2e20e8addfe8909f459f /source4/libcli/util/errormap.c
parentaf6298a84dffb400551861c6dc34591f1473830c (diff)
parent1722859abd169f2949b5822f97c810f2b8d162da (diff)
downloadsamba-53d491c9a4011a7d9ad69db52fb91d163f3f990a.tar.gz
samba-53d491c9a4011a7d9ad69db52fb91d163f3f990a.tar.bz2
samba-53d491c9a4011a7d9ad69db52fb91d163f3f990a.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into abartlet-devel
Diffstat (limited to 'source4/libcli/util/errormap.c')
-rw-r--r--source4/libcli/util/errormap.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 930e45b214..22bf6121c9 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "librpc/ndr/libndr.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
@@ -1406,3 +1407,39 @@ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
/* we should map all error codes to different status codes */
return NT_STATUS_INVALID_PARAMETER;
}
+
+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_UNSUCCESSFUL },
+ { 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;
+}
+