summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-11-13 21:28:02 +0100
committerStefan Metzmacher <metze@samba.org>2008-11-16 16:37:22 +0100
commit2cff27cefdd7f898349e8853f2c6307d1fb28855 (patch)
tree07489a487555c0fe605cb786479137f0e428fab9 /librpc/ndr
parent69af236e7772e85b7b8dc7045c6737d85f4b189a (diff)
downloadsamba-2cff27cefdd7f898349e8853f2c6307d1fb28855.tar.gz
samba-2cff27cefdd7f898349e8853f2c6307d1fb28855.tar.bz2
samba-2cff27cefdd7f898349e8853f2c6307d1fb28855.zip
librpc/ndr: add GUID_hexstring()
metze
Diffstat (limited to 'librpc/ndr')
-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,