summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);