summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/display_sec.c8
-rw-r--r--source3/lib/util_uuid.c67
-rw-r--r--source3/libads/disp_sec.c8
-rw-r--r--source3/libads/ldap.c4
-rw-r--r--source3/printing/nt_printing.c6
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c2
-rw-r--r--source3/rpcclient/cmd_lsarpc.c4
-rw-r--r--source3/utils/net_ads.c2
9 files changed, 17 insertions, 86 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8ccf987a6d..480b3eb4d9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1763,8 +1763,6 @@ int islower_ascii(int c);
void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
void smb_uuid_generate_random(struct GUID *uu);
-const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu);
-bool smb_string_to_uuid(const char *in, struct GUID* uu);
char *guid_binstring(const struct GUID *guid);
/* The following definitions come from lib/version.c */
diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c
index 5427a8173e..a0d93d6fe7 100644
--- a/source3/lib/display_sec.c
+++ b/source3/lib/display_sec.c
@@ -157,13 +157,13 @@ 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(talloc_tos(),
- object->type.type));
+ printf("Object GUID: %s\n", GUID_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(talloc_tos(),
- object->inherited_type.inherited_type));
+ printf("Object GUID: %s\n", GUID_string(talloc_tos(),
+ &object->inherited_type.inherited_type));
}
}
diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c
index 3a8f7b3f4f..7e67d791e3 100644
--- a/source3/lib/util_uuid.c
+++ b/source3/lib/util_uuid.c
@@ -20,12 +20,6 @@
#include "includes.h"
-/*
- * Offset between 15-Oct-1582 and 1-Jan-70
- */
-#define TIME_OFFSET_HIGH 0x01B21DD2
-#define TIME_OFFSET_LOW 0x13814000
-
void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr)
{
SIVAL(ptr->info, 0, uu.time_low);
@@ -55,67 +49,6 @@ void smb_uuid_generate_random(struct GUID *uu)
uu->time_hi_and_version = (uu->time_hi_and_version & 0x0FFF) | 0x4000;
}
-const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu)
-{
- 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)
-{
- bool ret = False;
- const char *ptr = in;
- char *end = (char *)in;
- int i;
- unsigned v1, v2;
-
- if (!in || !uu) goto out;
-
- uu->time_low = strtoul(ptr, &end, 16);
- if ((end - ptr) != 8 || *end != '-') goto out;
- ptr = (end + 1);
-
- uu->time_mid = strtoul(ptr, &end, 16);
- if ((end - ptr) != 4 || *end != '-') goto out;
- ptr = (end + 1);
-
- uu->time_hi_and_version = strtoul(ptr, &end, 16);
- if ((end - ptr) != 4 || *end != '-') goto out;
- ptr = (end + 1);
-
- if (sscanf(ptr, "%02x%02x", &v1, &v2) != 2) {
- goto out;
- }
- uu->clock_seq[0] = v1;
- uu->clock_seq[1] = v2;
- ptr += 4;
-
- if (*ptr != '-') goto out;
- ptr++;
-
- for (i = 0; i < 6; i++) {
- if (sscanf(ptr, "%02x", &v1) != 1) {
- goto out;
- }
- uu->node[i] = v1;
- ptr += 2;
- }
-
- ret = True;
-out:
- return ret;
-}
-
/*****************************************************************
Return the binary string representation of a GUID.
Caller must free.
diff --git a/source3/libads/disp_sec.c b/source3/libads/disp_sec.c
index f4c68638df..a5e04a4a6c 100644
--- a/source3/libads/disp_sec.c
+++ b/source3/libads/disp_sec.c
@@ -114,15 +114,15 @@ 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(mem_ctx,
- object->type.type),
+ printf("Object GUID: %s (%s)\n", GUID_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(mem_ctx,
- object->inherited_type.inherited_type),
+ printf("Object GUID: %s (%s)\n", GUID_string(mem_ctx,
+ &object->inherited_type.inherited_type),
ads_interprete_guid_from_object(ads, mem_ctx,
&object->inherited_type.inherited_type));
}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index fbbe1a546b..2dcd1fd6ae 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2062,7 +2062,7 @@ static void dump_guid(ADS_STRUCT *ads, const char *field, struct berval **values
memcpy(guid.info, values[i]->bv_val, sizeof(guid.info));
smb_uuid_unpack(guid, &tmp);
- printf("%s: %s\n", field, smb_uuid_string(talloc_tos(), tmp));
+ printf("%s: %s\n", field, GUID_string(talloc_tos(), &tmp));
}
}
@@ -3748,7 +3748,7 @@ const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
}
expr = talloc_asprintf(mem_ctx, "(rightsGuid=%s)",
- smb_uuid_string(mem_ctx, *rights_guid));
+ GUID_string(mem_ctx, rights_guid));
if (!expr) {
goto done;
}
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 85f42feb91..c0e62eac19 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3221,7 +3221,7 @@ static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2,
ZERO_STRUCT( unistr_guid );
- init_unistr2( &unistr_guid, smb_uuid_string(talloc_tos(), guid),
+ init_unistr2( &unistr_guid, GUID_string(talloc_tos(), &guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue(ctr, "objectGUID", REG_SZ,
@@ -3536,7 +3536,7 @@ bool is_printer_published(Printer_entry *print_hnd, int snum,
case REG_SZ:
rpcstr_pull( guid_str, regval_data_p(guid_val),
sizeof(guid_str)-1, -1, STR_TERMINATE );
- ret = smb_string_to_uuid( guid_str, guid );
+ ret = NT_STATUS_IS_OK(GUID_from_string( guid_str, guid ));
break;
case REG_BINARY:
if ( regval_size(guid_val) != sizeof(struct GUID) ) {
@@ -3841,7 +3841,7 @@ 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(talloc_tos(), guid),
+ GUID_string(talloc_tos(), &guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue( printer_data->keys[key_index].values,
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 52cb02b109..af9246c49f 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4373,7 +4373,7 @@ static bool construct_printer_info_7(Printer_entry *print_hnd, PRINTER_INFO_7 *p
if (is_printer_published(print_hnd, snum, &guid)) {
if (asprintf(&guid_str, "{%s}",
- smb_uuid_string(talloc_tos(), guid)) == -1) {
+ GUID_string(talloc_tos(), &guid)) == -1) {
return false;
}
strupper_m(guid_str);
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 5b5b4ff78c..746fc25d7d 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -112,8 +112,8 @@ static void display_query_info_12(struct lsa_DnsDomainInfo *r)
d_printf("Domain DNS Name: %s\n", r->dns_domain.string);
d_printf("Domain Forest Name: %s\n", r->dns_forest.string);
d_printf("Domain Sid: %s\n", sid_string_tos(r->sid));
- d_printf("Domain GUID: %s\n", smb_uuid_string(talloc_tos(),
- r->domain_guid));
+ d_printf("Domain GUID: %s\n", GUID_string(talloc_tos(),
+ &r->domain_guid));
}
static void display_lsa_query_info(union lsa_PolicyInformation *info,
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 30c47ddd34..8e8dd7e767 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -67,7 +67,7 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
break;
}
- d_printf("GUID: %s\n", smb_uuid_string(talloc_tos(), reply.domain_uuid));
+ d_printf("GUID: %s\n", GUID_string(talloc_tos(), &reply.domain_uuid));
d_printf("Flags:\n"
"\tIs a PDC: %s\n"