summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/ndr/libndr.h1
-rw-r--r--librpc/ndr/uuid.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index ad94c59e90..eafaf688af 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -519,6 +519,7 @@ bool GUID_all_zero(const struct GUID *u);
int GUID_compare(const struct GUID *u1, const struct GUID *u2);
char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid);
+char *GUID_hexstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
struct GUID GUID_random(void);
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index bb8c49254d..aa24ac4494 100644
--- a/librpc/ndr/uuid.c
+++ b/librpc/ndr/uuid.c
@@ -251,6 +251,31 @@ _PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid)
return ret;
}
+_PUBLIC_ char *GUID_hexstring(TALLOC_CTX *mem_ctx, const struct GUID *guid)
+{
+ char *ret;
+ DATA_BLOB guid_blob;
+ enum ndr_err_code ndr_err;
+ TALLOC_CTX *tmp_mem;
+
+ tmp_mem = talloc_new(mem_ctx);
+ if (!tmp_mem) {
+ return NULL;
+ }
+ ndr_err = ndr_push_struct_blob(&guid_blob, tmp_mem,
+ NULL,
+ guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(tmp_mem);
+ return NULL;
+ }
+
+ ret = data_blob_hex_string(mem_ctx, &guid_blob);
+ talloc_free(tmp_mem);
+ return ret;
+}
+
_PUBLIC_ char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
{
return talloc_asprintf(mem_ctx,