summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2013-02-01 17:45:02 +0100
committerGünther Deschner <gd@samba.org>2013-02-01 19:38:07 +0100
commit3c31fe7600145662f8bdba98c8f13cbaac58685e (patch)
treed904790128c4dc5e17c35bbc7c3fec21ea328479 /source4/torture
parent732e8ab64d3c082dd142e4cbf07ebaec54549216 (diff)
downloadsamba-3c31fe7600145662f8bdba98c8f13cbaac58685e.tar.gz
samba-3c31fe7600145662f8bdba98c8f13cbaac58685e.tar.bz2
samba-3c31fe7600145662f8bdba98c8f13cbaac58685e.zip
s4-torture: make sure to deal with the highest relative pointer offset correctly.
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/ndr/ndr.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 30cd46ac58..9e63ff71d7 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -43,6 +43,7 @@ static bool wrap_ndr_pullpush_test(struct torture_context *tctx,
struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx);
void *ds = talloc_zero_size(ndr, data->struct_size);
bool ret;
+ uint32_t highest_ofs;
ndr->flags |= data->flags;
@@ -51,9 +52,15 @@ static bool wrap_ndr_pullpush_test(struct torture_context *tctx,
torture_assert_ndr_success(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
"pulling");
- torture_assert(tctx, ndr->offset == ndr->data_size,
+ if (ndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = ndr->offset;
+ } else {
+ highest_ofs = ndr->relative_highest_offset;
+ }
+
+ torture_assert(tctx, highest_ofs == ndr->data_size,
talloc_asprintf(tctx,
- "%d unread bytes", ndr->data_size - ndr->offset));
+ "%d unread bytes", ndr->data_size - highest_ofs));
if (check_fn != NULL) {
ret = check_fn(tctx, ds);
@@ -120,6 +127,7 @@ static bool wrap_ndr_inout_pull_test(struct torture_context *tctx,
const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data;
void *ds = talloc_zero_size(tctx, data->struct_size);
struct ndr_pull *ndr;
+ uint32_t highest_ofs;
/* handle NDR_IN context */
@@ -132,8 +140,14 @@ static bool wrap_ndr_inout_pull_test(struct torture_context *tctx,
data->pull_fn(ndr, NDR_IN, ds),
"ndr pull of context failed");
- torture_assert(tctx, ndr->offset == ndr->data_size,
- talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - ndr->offset));
+ if (ndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = ndr->offset;
+ } else {
+ highest_ofs = ndr->relative_highest_offset;
+ }
+
+ torture_assert(tctx, highest_ofs == ndr->data_size,
+ talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - highest_ofs));
talloc_free(ndr);
@@ -148,8 +162,14 @@ static bool wrap_ndr_inout_pull_test(struct torture_context *tctx,
data->pull_fn(ndr, NDR_OUT, ds),
"ndr pull failed");
- torture_assert(tctx, ndr->offset == ndr->data_size,
- talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - ndr->offset));
+ if (ndr->offset > ndr->relative_highest_offset) {
+ highest_ofs = ndr->offset;
+ } else {
+ highest_ofs = ndr->relative_highest_offset;
+ }
+
+ torture_assert(tctx, highest_ofs == ndr->data_size,
+ talloc_asprintf(tctx, "%d unread bytes", ndr->data_size - highest_ofs));
talloc_free(ndr);