[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-300-g3969f65

Volker Lendecke vlendec at samba.org
Fri Jul 10 16:17:14 GMT 2009


The branch, master has been updated
       via  3969f65aaa1c0e5d3158f089a2fe496af6dd60b0 (commit)
       via  0a0bff353e3cd8287166c7ed907a50a8599b0e03 (commit)
      from  67c7b7f90bd1bad265e892bb00abf649b22345b6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3969f65aaa1c0e5d3158f089a2fe496af6dd60b0
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 10 17:36:18 2009 +0200

    Fix&Run local-gencache

commit 0a0bff353e3cd8287166c7ed907a50a8599b0e03
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 10 17:29:22 2009 +0200

    Fix our base64 implementation for blobs of length 4....
    
    The additional length check bit us exactly at 4, removing it. The
    torture test survives valgrind up to 2000 bytes :-)

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/util_str.c                     |    2 +-
 source3/script/tests/test_smbtorture_s3.sh |    1 +
 source3/torture/torture.c                  |   38 +++++++++++++++++++++++++--
 3 files changed, 37 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index cdd7d0a..0aff943 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1932,7 +1932,7 @@ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
 	result = TALLOC_ARRAY(mem_ctx, char, output_len); /* get us plenty of space */
 	SMB_ASSERT(result != NULL);
 
-	while (len-- && out_cnt < (data.length * 2) - 5) {
+	while (len--) {
 		int c = (unsigned char) *(data.data++);
 		bits += c;
 		char_count++;
diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh
index c577ed1..2894d7e 100755
--- a/source3/script/tests/test_smbtorture_s3.sh
+++ b/source3/script/tests/test_smbtorture_s3.sh
@@ -29,6 +29,7 @@ tests="$tests DIR DIR1 TCON TCONDEV RW1 RW2 RW3"
 tests="$tests OPEN XCOPY RENAME DELETE PROPERTIES W2K"
 tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE CHAIN1"
 tests="$tests GETADDRINFO POSIX UID-REGRESSION-TEST SHORTNAME-TEST"
+tests="$tests LOCAL-BASE64 LOCAL-GENCACHE"
 
 skipped1="RANDOMIPC NEGNOWAIT NBENCH ERRMAPEXTRACT TRANS2SCAN NTTRANSSCAN"
 skipped2="DENY1 DENY2 OPENATTR CASETABLE EATEST"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index aa7e83b..8e38093 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5749,6 +5749,39 @@ static bool run_local_substitute(int dummy)
 	return ok;
 }
 
+static bool run_local_base64(int dummy)
+{
+	int i;
+	bool ret = true;
+
+	for (i=1; i<2000; i++) {
+		DATA_BLOB blob1, blob2;
+		char *b64;
+
+		blob1.data = talloc_array(talloc_tos(), uint8_t, i);
+		blob1.length = i;
+		generate_random_buffer(blob1.data, blob1.length);
+
+		b64 = base64_encode_data_blob(talloc_tos(), blob1);
+		if (b64 == NULL) {
+			d_fprintf(stderr, "base64_encode_data_blob failed "
+				  "for %d bytes\n", i);
+			ret = false;
+		}
+		blob2 = base64_decode_data_blob(b64);
+		TALLOC_FREE(b64);
+
+		if (data_blob_cmp(&blob1, &blob2)) {
+			d_fprintf(stderr, "data_blob_cmp failed for %d "
+				  "bytes\n", i);
+			ret = false;
+		}
+		TALLOC_FREE(blob1.data);
+		data_blob_free(&blob2);
+	}
+	return ret;
+}
+
 static bool run_local_gencache(int dummy)
 {
 	char *val;
@@ -5796,15 +5829,13 @@ static bool run_local_gencache(int dummy)
 	}
 
 	blob = data_blob_string_const_null("bar");
-	tm = time(NULL);
+	tm = time(NULL) + 60;
 
 	if (!gencache_set_data_blob("foo", &blob, tm)) {
 		d_printf("%s: gencache_set_data_blob() failed\n", __location__);
 		return False;
 	}
 
-	data_blob_free(&blob);
-
 	if (!gencache_get_data_blob("foo", &blob, NULL)) {
 		d_printf("%s: gencache_get_data_blob() failed\n", __location__);
 		return False;
@@ -6487,6 +6518,7 @@ static struct {
 	{ "STREAMERROR", run_streamerror },
 	{ "LOCAL-SUBSTITUTE", run_local_substitute, 0},
 	{ "LOCAL-GENCACHE", run_local_gencache, 0},
+	{ "LOCAL-BASE64", run_local_base64, 0},
 	{ "LOCAL-RBTREE", run_local_rbtree, 0},
 	{ "LOCAL-MEMCACHE", run_local_memcache, 0},
 	{ "LOCAL-STREAM-NAME", run_local_stream_name, 0},


-- 
Samba Shared Repository


More information about the samba-cvs mailing list