From a7128709d208b9ef7f4e4e7038bf6102189c4518 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 12 Aug 2009 17:41:23 +0200 Subject: [PATCH] libwbclient: Add wbcSidTypeString function. --- nsswitch/libwbclient/wbc_sid.c | 17 +++++++++++++++++ nsswitch/libwbclient/wbclient.h | 12 +++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c index aa32e83cb33..b1ecba3f6d2 100644 --- a/nsswitch/libwbclient/wbc_sid.c +++ b/nsswitch/libwbclient/wbc_sid.c @@ -810,3 +810,20 @@ wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid, return wbc_status; } + +const char* wbcSidTypeString(enum wbcSidType type) +{ + switch (type) { + case WBC_SID_NAME_USE_NONE: return "SID_NONE"; + case WBC_SID_NAME_USER: return "SID_USER"; + case WBC_SID_NAME_DOM_GRP: return "SID_DOM_GROUP"; + case WBC_SID_NAME_DOMAIN: return "SID_DOMAIN"; + case WBC_SID_NAME_ALIAS: return "SID_ALIAS"; + case WBC_SID_NAME_WKN_GRP: return "SID_WKN_GROUP"; + case WBC_SID_NAME_DELETED: return "SID_DELETED"; + case WBC_SID_NAME_INVALID: return "SID_INVALID"; + case WBC_SID_NAME_UNKNOWN: return "SID_UNKNOWN"; + case WBC_SID_NAME_COMPUTER: return "SID_COMPUTER"; + default: return "Unknown type"; + } +} diff --git a/nsswitch/libwbclient/wbclient.h b/nsswitch/libwbclient/wbclient.h index d3c1b634f5e..a87cad3b219 100644 --- a/nsswitch/libwbclient/wbclient.h +++ b/nsswitch/libwbclient/wbclient.h @@ -62,9 +62,10 @@ const char *wbcErrorString(wbcErr error); * Added wbcRemoveGidMapping() * 0.3: Added wbcGetpwsid() * Added wbcGetSidAliases() + * 0.4: Added wbcSidTypeString() **/ #define WBCLIENT_MAJOR_VERSION 0 -#define WBCLIENT_MINOR_VERSION 3 +#define WBCLIENT_MINOR_VERSION 4 #define WBCLIENT_VENDOR_VERSION "Samba libwbclient" struct wbcLibraryDetails { uint16_t major_version; @@ -507,6 +508,15 @@ void wbcFreeMemory(void*); */ /** + * @brief Get a string representation of the SID type + * + * @param type type of the SID + * + * @return string representation of the SID type + */ +const char* wbcSidTypeString(enum wbcSidType type); + +/** * @brief Convert a binary SID to a character string * * @param sid Binary Security Identifier -- 2.11.4.GIT