summaryrefslogtreecommitdiffstats
path: root/nsswitch/libwbclient/wbc_guid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-06 22:14:39 +0200
committerVolker Lendecke <vl@samba.org>2010-04-19 14:27:16 +0200
commit20011f4681754160c59725c066357d902e00102c (patch)
treed4a2c25afc05f2d5a598e66fcfef35ee8858abae /nsswitch/libwbclient/wbc_guid.c
parent769997786c62770873315363c5dc20661657fcbd (diff)
downloadsamba-20011f4681754160c59725c066357d902e00102c.tar.gz
samba-20011f4681754160c59725c066357d902e00102c.tar.xz
samba-20011f4681754160c59725c066357d902e00102c.zip
libwbclient: Make wbcGuidToString not use talloc
Diffstat (limited to 'nsswitch/libwbclient/wbc_guid.c')
-rw-r--r--nsswitch/libwbclient/wbc_guid.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/nsswitch/libwbclient/wbc_guid.c b/nsswitch/libwbclient/wbc_guid.c
index d55a1979736..52a64ca5801 100644
--- a/nsswitch/libwbclient/wbc_guid.c
+++ b/nsswitch/libwbclient/wbc_guid.c
@@ -29,28 +29,24 @@
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 */