{
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));
}
}
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;
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)
{
if (object->flags & SEC_ACE_OBJECT_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_PRESENT\n");
- printf("Object GUID: %s (%s)\n", smb_uuid_string_static(
+ printf("Object GUID: %s (%s)\n", smb_uuid_string(mem_ctx,
object->type.type),
ads_interprete_guid_from_object(ads, mem_ctx,
&object->type.type));
}
if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n");
- printf("Object GUID: %s (%s)\n", smb_uuid_string_static(
+ printf("Object GUID: %s (%s)\n", smb_uuid_string(mem_ctx,
object->inherited_type.inherited_type),
ads_interprete_guid_from_object(ads, mem_ctx,
&object->inherited_type.inherited_type));
static void dump_guid(ADS_STRUCT *ads, const char *field, struct berval **values)
{
int i;
- UUID_FLAT guid;
for (i=0; values[i]; i++) {
+
+ UUID_FLAT guid;
+ struct GUID tmp;
+
memcpy(guid.info, values[i]->bv_val, sizeof(guid.info));
- printf("%s: %s\n", field,
- smb_uuid_string_static(smb_uuid_unpack_static(guid)));
+ smb_uuid_unpack(guid, &tmp);
+ printf("%s: %s\n", field, smb_uuid_string(talloc_tos(), tmp));
}
}
}
expr = talloc_asprintf(mem_ctx, "(rightsGuid=%s)",
- smb_uuid_string_static(*rights_guid));
+ smb_uuid_string(mem_ctx, *rights_guid));
if (!expr) {
goto done;
}
dc_address_type = ADS_NETBIOS_ADDRESS;
}
NT_STATUS_HAVE_NO_MEMORY(dc_address);
- dc_guid = smb_uuid_unpack_static(r.guid);
+ smb_uuid_unpack(r.guid, &dc_guid);
if (r.forest) {
dc_flags |= ADS_DNS_FOREST;
Vista to whine */
ZERO_STRUCT( unistr_guid );
- init_unistr2( &unistr_guid, smb_uuid_string_static(guid),
+
+ init_unistr2( &unistr_guid, smb_uuid_string(talloc_tos(), guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue(ctr, "objectGUID", REG_SZ,
memcpy( &guid, data_p, sizeof(struct GUID) );
- init_unistr2( &unistr_guid, smb_uuid_string_static(guid),
+ init_unistr2( &unistr_guid,
+ smb_uuid_string(talloc_tos(), guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue( printer_data->keys[key_index].values,
struct GUID guid;
if (is_printer_published(print_hnd, snum, &guid)) {
- asprintf(&guid_str, "{%s}", smb_uuid_string_static(guid));
+ asprintf(&guid_str, "{%s}",
+ smb_uuid_string(talloc_tos(), guid));
strupper_m(guid_str);
init_unistr(&printer->guid, guid_str);
printer->action = SPOOL_DS_PUBLISH;
d_printf("Domain DNS Name: %s\n", dns_dom_name);
d_printf("Domain Forest Name: %s\n", forest_name);
d_printf("Domain Sid: %s\n", sid_string_static(&d.dom_sid.sid));
- d_printf("Domain GUID: %s\n", smb_uuid_string_static(d.dom_guid));
+ d_printf("Domain GUID: %s\n", smb_uuid_string(talloc_tos(),
+ d.dom_guid));
}
{
char addr[INET6_ADDRSTRLEN];
struct cldap_netlogon_reply reply;
+ struct GUID tmp_guid;
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
if ( !ads_cldap_netlogon(addr, ads->server.realm, &reply ) ) {
d_printf("0x%x\n", reply.type);
break;
}
- d_printf("GUID: %s\n",
- smb_uuid_string_static(smb_uuid_unpack_static(reply.guid)));
+
+ smb_uuid_unpack(reply.guid, &tmp_guid);
+ d_printf("GUID: %s\n", smb_uuid_string(talloc_tos(), tmp_guid));
+
d_printf("Flags:\n"
"\tIs a PDC: %s\n"
"\tIs a GC of the forest: %s\n"