summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-02-03 03:27:19 +0100
committerVolker Lendecke <vl@samba.org>2012-02-06 09:15:32 +0100
commita0e44c30e21013f0136ddefc1bbbdc020413e749 (patch)
treebf5ffefbbefe58149e736bd3210ccdae75463cfd /source3
parent74ca6d1ddb1c5a4fbe9ddb29566878efe1761897 (diff)
downloadsamba-a0e44c30e21013f0136ddefc1bbbdc020413e749.tar.gz
samba-a0e44c30e21013f0136ddefc1bbbdc020413e749.tar.bz2
samba-a0e44c30e21013f0136ddefc1bbbdc020413e749.zip
lib/util: Add hex_encode_buf
Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Mon Feb 6 09:15:33 CET 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/selftest/tests.py1
-rw-r--r--source3/torture/torture.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 6a3ccb9877..ce6d964703 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -107,6 +107,7 @@ local_tests=[
"LOCAL-TEVENT-SELECT",
"LOCAL-CONVERT-STRING",
"LOCAL-CONV-AUTH-INFO",
+ "LOCAL-hex_encode_buf",
"LOCAL-sprintf_append"]
for t in local_tests:
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index e4ce91338f..b14f9ed873 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -8693,6 +8693,26 @@ fail:
return result;
}
+static bool run_local_hex_encode_buf(int dummy)
+{
+ char buf[17];
+ uint8_t src[8];
+ int i;
+
+ for (i=0; i<sizeof(src); i++) {
+ src[i] = i;
+ }
+ hex_encode_buf(buf, src, sizeof(src));
+ if (strcmp(buf, "0001020304050607") != 0) {
+ return false;
+ }
+ hex_encode_buf(buf, NULL, 0);
+ if (buf[0] != '\0') {
+ return false;
+ }
+ return true;
+}
+
static double create_procs(bool (*fn)(int), bool *result)
{
int i, status;
@@ -8895,6 +8915,7 @@ static struct {
{ "LOCAL-CONVERT-STRING", run_local_convert_string, 0},
{ "LOCAL-CONV-AUTH-INFO", run_local_conv_auth_info, 0},
{ "LOCAL-sprintf_append", run_local_sprintf_append, 0},
+ { "LOCAL-hex_encode_buf", run_local_hex_encode_buf, 0},
{NULL, NULL, 0}};