summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/display_sec.c4
-rw-r--r--source3/lib/util_uuid.c44
2 files changed, 15 insertions, 33 deletions
diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c
index 8e92c84f3c..caa13a6a5e 100644
--- a/source3/lib/display_sec.c
+++ b/source3/lib/display_sec.c
@@ -97,12 +97,12 @@ static void disp_sec_ace_object(struct security_ace_object *object)
{
if (object->flags & SEC_ACE_OBJECT_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_PRESENT\n");
- printf("Object GUID: %s\n", smb_uuid_string_static(
+ printf("Object GUID: %s\n", smb_uuid_string(talloc_tos(),
object->type.type));
}
if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n");
- printf("Object GUID: %s\n", smb_uuid_string_static(
+ printf("Object GUID: %s\n", smb_uuid_string(talloc_tos(),
object->inherited_type.inherited_type));
}
}
diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c
index 606bfd2147..36c04e9b84 100644
--- a/source3/lib/util_uuid.c
+++ b/source3/lib/util_uuid.c
@@ -44,14 +44,6 @@ void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu)
memcpy(uu->node, in.info+10, 6);
}
-struct GUID smb_uuid_unpack_static(const UUID_FLAT in)
-{
- static struct GUID uu;
-
- smb_uuid_unpack(in, &uu);
- return uu;
-}
-
void smb_uuid_generate_random(struct GUID *uu)
{
UUID_FLAT tmp;
@@ -63,30 +55,20 @@ void smb_uuid_generate_random(struct GUID *uu)
uu->time_hi_and_version = (uu->time_hi_and_version & 0x0FFF) | 0x4000;
}
-char *smb_uuid_to_string(const struct GUID uu)
-{
- char *out;
-
- asprintf(&out, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- uu.time_low, uu.time_mid, uu.time_hi_and_version,
- uu.clock_seq[0], uu.clock_seq[1],
- uu.node[0], uu.node[1], uu.node[2],
- uu.node[3], uu.node[4], uu.node[5]);
-
- return out;
-}
-
-const char *smb_uuid_string_static(const struct GUID uu)
+const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu)
{
- static char out[37];
-
- slprintf(out, sizeof(out),
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- uu.time_low, uu.time_mid, uu.time_hi_and_version,
- uu.clock_seq[0], uu.clock_seq[1],
- uu.node[0], uu.node[1], uu.node[2],
- uu.node[3], uu.node[4], uu.node[5]);
- return out;
+ char *result;
+
+ result = talloc_asprintf(
+ mem_ctx,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ uu.time_low, uu.time_mid, uu.time_hi_and_version,
+ uu.clock_seq[0], uu.clock_seq[1],
+ uu.node[0], uu.node[1], uu.node[2],
+ uu.node[3], uu.node[4], uu.node[5]);
+
+ SMB_ASSERT(result != NULL);
+ return result;
}
bool smb_string_to_uuid(const char *in, struct GUID* uu)