mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
parent
80c2446321
commit
1011b32678
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu)
|
||||
{
|
||||
char *out;
|
||||
char *result;
|
||||
|
||||
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]);
|
||||
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]);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const char *smb_uuid_string_static(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;
|
||||
SMB_ASSERT(result != NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool smb_string_to_uuid(const char *in, struct GUID* uu)
|
||||
|
@ -114,14 +114,14 @@ static void ads_disp_sec_ace_object(ADS_STRUCT *ads,
|
||||
{
|
||||
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));
|
||||
|
@ -1828,11 +1828,14 @@ static void dump_binary(ADS_STRUCT *ads, const char *field, struct berval **valu
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3429,7 +3432,7 @@ const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
|
||||
}
|
||||
|
||||
expr = talloc_asprintf(mem_ctx, "(rightsGuid=%s)",
|
||||
smb_uuid_string_static(*rights_guid));
|
||||
smb_uuid_string(mem_ctx, *rights_guid));
|
||||
if (!expr) {
|
||||
goto done;
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
|
||||
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;
|
||||
|
@ -3208,7 +3208,8 @@ static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2,
|
||||
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,
|
||||
@ -3821,7 +3822,8 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int bu
|
||||
|
||||
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,
|
||||
|
@ -4376,7 +4376,8 @@ static bool construct_printer_info_7(Printer_entry *print_hnd, PRINTER_INFO_7 *p
|
||||
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;
|
||||
|
@ -126,7 +126,8 @@ static void display_query_info_12(DOM_QUERY_12 d)
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ static int net_ads_cldap_netlogon(ADS_STRUCT *ads)
|
||||
{
|
||||
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 ) ) {
|
||||
@ -102,8 +103,10 @@ static int net_ads_cldap_netlogon(ADS_STRUCT *ads)
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user