diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-11 16:29:28 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-11 17:57:05 +0100 |
commit | f47b518940f67ba6be40cae7eb8e8ba556b5f404 (patch) | |
tree | 9f4a44e109f67d069cd5174ccabb6633a7170717 /source3/nsswitch | |
parent | 0e4088e62630e6d0d75025db16ff97f5744194a0 (diff) | |
download | samba-f47b518940f67ba6be40cae7eb8e8ba556b5f404.tar.gz samba-f47b518940f67ba6be40cae7eb8e8ba556b5f404.tar.bz2 samba-f47b518940f67ba6be40cae7eb8e8ba556b5f404.zip |
libwbclient: implement wbcErrorString()
metze
(This used to be commit 97a8069075d820c43c17e761b1186d4f0b3c785d)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/libwbclient/wbclient.c | 34 | ||||
-rw-r--r-- | source3/nsswitch/libwbclient/wbclient.h | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/source3/nsswitch/libwbclient/wbclient.c b/source3/nsswitch/libwbclient/wbclient.c index 2f76f76635..5aad378ad0 100644 --- a/source3/nsswitch/libwbclient/wbclient.c +++ b/source3/nsswitch/libwbclient/wbclient.c @@ -81,6 +81,40 @@ wbcErr wbcRequestResponse(int cmd, return wbc_status; } +/** @brief Translate an error value into a string + * + * @param error + * + * @return a pointer to a static string + **/ +const char *wbcErrorString(wbcErr error) +{ + switch (error) { + case WBC_ERR_SUCCESS: + return "WBC_ERR_SUCCESS"; + case WBC_ERR_NOT_IMPLEMENTED: + return "WBC_ERR_NOT_IMPLEMENTED"; + case WBC_ERR_UNKNOWN_FAILURE: + return "WBC_ERR_UNKNOWN_FAILURE"; + case WBC_ERR_NO_MEMORY: + return "WBC_ERR_NO_MEMORY"; + case WBC_ERR_INVALID_SID: + return "WBC_ERR_INVALID_SID"; + case WBC_ERR_INVALID_PARAM: + return "WBC_ERR_INVALID_PARAM"; + case WBC_ERR_WINBIND_NOT_AVAILABLE: + return "WBC_ERR_WINBIND_NOT_AVAILABLE"; + case WBC_ERR_DOMAIN_NOT_FOUND: + return "WBC_ERR_DOMAIN_NOT_FOUND"; + case WBC_INVALID_RESPONSE: + return "WBC_INVALID_RESPONSE"; + case WBC_ERR_NSS_ERROR: + return "WBC_ERR_NSS_ERROR"; + } + + return "unknown wbcErr value"; +}; + /** @brief Free library allocated memory * * @param *p Pointer to free diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h index 0b256d343f..ef9e3557da 100644 --- a/source3/nsswitch/libwbclient/wbclient.h +++ b/source3/nsswitch/libwbclient/wbclient.h @@ -48,7 +48,7 @@ typedef enum _wbcErrType wbcErr; #define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS) -char *wbcErrorString(wbcErr error); +const char *wbcErrorString(wbcErr error); /* * Data types used by the Winbind Client API |