summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-19 12:09:08 +0100
committerGünther Deschner <gd@samba.org>2007-12-21 15:29:11 +0100
commitaf08d8be3063ada42637a4ae7437499b03457de2 (patch)
tree6069f35cc6fd8a9171e6d060cda9e824aff8931c
parent75276ac2e3cb2d92e17231c906128bf98eea5d50 (diff)
downloadsamba-af08d8be3063ada42637a4ae7437499b03457de2.tar.gz
samba-af08d8be3063ada42637a4ae7437499b03457de2.tar.bz2
samba-af08d8be3063ada42637a4ae7437499b03457de2.zip
Add libnetapi_errstr().
Guenther (This used to be commit 465e61a3599a277366ada6ecda3a1e6ddb1f2490)
-rw-r--r--source3/lib/netapi/netapi.c50
-rw-r--r--source3/lib/netapi/netapi.h1
2 files changed, 51 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 853ac55f8a..70d7e654a7 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -148,3 +148,53 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
}
return W_ERROR_V(WERR_OK);
}
+
+const char *libnetapi_errstr(struct libnetapi_ctx *ctx,
+ NET_API_STATUS status)
+{
+ const char *err_str = NULL;
+
+ switch (status) {
+ case 0:
+ err_str = "Success";
+ break;
+ case 0x00000057: /* WERR_INVALID_PARAM */
+ err_str = "Invalid parameter";
+ break;
+ case 0x0000052E: /* WERR_LOGON_FAILURE */
+ err_str = "Invalid logon credentials";
+ break;
+ case 0x00000995: /* WERR_DOMAIN_CONTROLLER_NOT_FOUND */
+ err_str = "A domain controller could not be found";
+ break;
+ case 0x00000a84: /* WERR_SETUP_NOT_JOINED */
+ err_str = "Join failed";
+ break;
+ case 0x00000a83: /* WERR_SETUP_ALREADY_JOINED */
+ err_str = "Machine is already joined";
+ break;
+ case 0x00000a85: /* WERR_SETUP_DOMAIN_CONTROLLER */
+ err_str = "Machine is a Domain Controller";
+ break;
+ case 0x00000032: /* WERR_NOT_SUPPORTED */
+ err_str = "Not supported";
+ break;
+ case 0x0000051f: /* WERR_NO_LOGON_SERVERS */
+ err_str = "No logon servers found";
+ break;
+ case 0x00000056: /* WERR_BAD_PASSWORD */
+ err_str = "A bad password was supplied";
+ break;
+ case 0x00000520: /* WERR_NO_SUCH_LOGON_SESSION */
+ err_str = "No such logon session";
+ break;
+ default:
+ err_str = talloc_asprintf(ctx, "0x%08x", status);
+ if (!err_str) {
+ return NULL;
+ }
+ break;
+ }
+
+ return err_str;
+}
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index 0b25c93d5b..232d9c154f 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -37,6 +37,7 @@ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **
NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
+const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status);
#include "joindomain.h"