ndr_pull_flags_fn_t pull_fn;
ndr_push_flags_fn_t push_fn;
int ndr_flags;
+ int flags;
};
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;
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
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);
DATA_BLOB db,
size_t struct_size,
int ndr_flags,
+ int flags,
bool (*check_fn) (struct torture_context *ctx, void *data))
{
struct torture_test *test;
data = talloc(test, struct ndr_pull_test_data);
data->data = db;
data->ndr_flags = ndr_flags;
+ data->flags = flags;
data->struct_size = struct_size;
data->pull_fn = pull_fn;
data->push_fn = push_fn;
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 */
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);
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);
torture_suite_add_suite(suite, ndr_netlogon_suite(suite));
torture_suite_add_suite(suite, ndr_drsuapi_suite(suite));
torture_suite_add_suite(suite, ndr_spoolss_suite(suite));
+ torture_suite_add_suite(suite, ndr_ntprinting_suite(suite));
torture_suite_add_suite(suite, ndr_samr_suite(suite));
torture_suite_add_suite(suite, ndr_drsblobs_suite(suite));
torture_suite_add_suite(suite, ndr_nbt_suite(suite));
torture_suite_add_suite(suite, ndr_ntlmssp_suite(suite));
-#ifdef AD_DC_BUILD_IS_ENABLED /* Add Heimdal-specific KDC test */
torture_suite_add_suite(suite, ndr_backupkey_suite(suite));
-#endif
torture_suite_add_suite(suite, ndr_string_suite(suite));
torture_suite_add_simple_test(suite, "string terminator",