summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-12-01 16:51:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:15 -0500
commit34b1367373aee57c2a21ec9a993e715c62c37620 (patch)
treeb5dbf3856547c2feee92165b931031d62c17ca23
parenta8a3fec528f6ee9a4a0171fb4186e8dcaba76518 (diff)
downloadsamba-34b1367373aee57c2a21ec9a993e715c62c37620.tar.gz
samba-34b1367373aee57c2a21ec9a993e715c62c37620.tar.bz2
samba-34b1367373aee57c2a21ec9a993e715c62c37620.zip
r4027: add a useful function for debugging
metze (This used to be commit 41b1ba53fc201b7b9f9d806dccef6258b2a1d157)
-rw-r--r--source4/lib/data_blob.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c
index c5f15f1271..a4506fee45 100644
--- a/source4/lib/data_blob.c
+++ b/source4/lib/data_blob.c
@@ -142,3 +142,21 @@ BOOL data_blob_equal(const DATA_BLOB *d1, const DATA_BLOB *d2)
return False;
}
+/*******************************************************************
+print the data_blob as hex string
+*******************************************************************/
+char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob)
+{
+ int i;
+ char *hex_string;
+
+ hex_string = talloc_array_p(mem_ctx, char, (blob->length*2)+1);
+ if (!hex_string) {
+ return NULL;
+ }
+
+ for (i = 0; i < blob->length; i++)
+ slprintf(&hex_string[i*2], 3, "%02X", blob->data[i]);
+
+ return hex_string;
+}