winbindd: winbindd_ccache_ntlm_auth() -> bool_dispatch_table
[samba.git] / nsswitch / libwbclient / wbc_guid.c
index c343e24351fa07c0722337374844365b7e6ba867..52a64ca5801ce8daf87d135db2c68cb9f841d884 100644 (file)
 
 /* Required Headers */
 
+#include "replace.h"
 #include "libwbclient.h"
 
 /* Convert a binary GUID to a character string */
 wbcErr wbcGuidToString(const struct wbcGuid *guid,
                       char **guid_string)
 {
-       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       char *result;
 
-       if (!guid) {
-               wbc_status = WBC_ERR_INVALID_PARAM;
-               BAIL_ON_WBC_ERROR(wbc_status);
+       result = (char *)wbcAllocateMemory(37, 1, NULL);
+       if (result == NULL) {
+               return WBC_ERR_NO_MEMORY;
        }
-
-       *guid_string = talloc_asprintf(NULL,
-                                      "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                                      guid->time_low, guid->time_mid,
-                                      guid->time_hi_and_version,
-                                      guid->clock_seq[0],
-                                      guid->clock_seq[1],
-                                      guid->node[0], guid->node[1],
-                                      guid->node[2], guid->node[3],
-                                      guid->node[4], guid->node[5]);
-       BAIL_ON_PTR_ERROR((*guid_string), wbc_status);
-
-       wbc_status = WBC_ERR_SUCCESS;
-
-done:
-       return wbc_status;
+       snprintf(result, 37,
+                "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                guid->time_low, guid->time_mid,
+                guid->time_hi_and_version,
+                guid->clock_seq[0],
+                guid->clock_seq[1],
+                guid->node[0], guid->node[1],
+                guid->node[2], guid->node[3],
+                guid->node[4], guid->node[5]);
+       *guid_string = result;
+
+       return WBC_ERR_SUCCESS;
 }
 
 /* @brief Convert a character string to a binary GUID */