/* Required Headers */
+#include "replace.h"
#include "libwbclient.h"
-
+#include "../winbind_client.h"
/* Convert a binary SID to a character string */
wbcErr wbcSidToString(const struct wbcDomainSid *sid,
if (WBC_ERROR_IS_OK(wbc_status)) {
if (pdomain != NULL) {
*pdomain = domain;
+ } else {
+ TALLOC_FREE(domain);
}
if (pname != NULL) {
*pname = name;
+ } else {
+ TALLOC_FREE(name);
}
if (pname_type != NULL) {
*pname_type = name_type;
wbc_status = WBC_ERR_SUCCESS;
done:
- if (response.extra_data.data) {
- free(response.extra_data.data);
- }
+ winbindd_free_response(&response);
if (WBC_ERROR_IS_OK(wbc_status)) {
*pp_domain_name = domain_name;
wbc_status = WBC_ERR_SUCCESS;
done:
- if (response.extra_data.data) {
- free(response.extra_data.data);
- }
+ winbindd_free_response(&response);
if (sids) {
talloc_free(sids);
}
if (extra_data) {
talloc_free(extra_data);
}
- if (response.extra_data.data) {
- free(response.extra_data.data);
- }
+ winbindd_free_response(&response);
if (rids) {
talloc_free(rids);
}
wbc_status = WBC_ERR_SUCCESS;
done:
- if (response.extra_data.data) {
- free(response.extra_data.data);
- }
+ winbindd_free_response(&response);
if (users) {
talloc_free(users);
}
wbc_status = WBC_ERR_SUCCESS;
done:
- if (response.extra_data.data) {
- free(response.extra_data.data);
- }
+ winbindd_free_response(&response);
if (groups) {
talloc_free(groups);
}
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";
+ }
+}