From 1662e383dd890d48e0e1207a51d4b3f9fb12ab65 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Jun 2010 12:26:24 +0200 Subject: s4-smbtorture: add NDR torture test for winreg_QueryMultipleValues2. Guenther --- source4/torture/ndr/winreg.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source4/torture/ndr/winreg.c') diff --git a/source4/torture/ndr/winreg.c b/source4/torture/ndr/winreg.c index 2bd28f0fb7..3b5766a495 100644 --- a/source4/torture/ndr/winreg.c +++ b/source4/torture/ndr/winreg.c @@ -286,6 +286,48 @@ static bool querymultiplevalues_out_check(struct torture_context *tctx, return true; } +const uint8_t querymultiplevalues2_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x98, 0xe4, 0xdf, 0x3c, 0x70, 0xde, 0x69, 0x4a, + 0x90, 0xb4, 0x85, 0x36, 0x33, 0x79, 0x89, 0x32, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x54, 0x00, 0x45, 0x00, + 0x4d, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static bool querymultiplevalues2_in_check(struct torture_context *tctx, + struct winreg_QueryMultipleValues2 *r) +{ + torture_assert_mem_equal(tctx, r->in.key_handle, querymultiplevalues2_in_data, sizeof(struct policy_handle), "key handle"); + torture_assert_int_equal(tctx, r->in.num_values, 1, "num values"); + torture_assert_str_equal(tctx, r->in.values_in[0].ve_valuename->name, "TEMP", "name"); + torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->length, 10, "name len"); + torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->size, 10, "name size"); + torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuelen, 0, "length"); + torture_assert(tctx, (r->in.values_in[0].ve_valueptr == NULL), "ve_valueptr"); + torture_assert_int_equal(tctx, r->in.values_in[0].ve_type, 0, "type"); + torture_assert_int_equal(tctx, *r->in.offered, 0, "buffer size"); + + return true; +} + +const uint8_t querymultiplevalues2_out_data[] = { + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x54, 0x00, 0x45, 0x00, 0x4d, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00 +}; + +static bool querymultiplevalues2_out_check(struct torture_context *tctx, + struct winreg_QueryMultipleValues2 *r) +{ + return true; +} + static const uint8_t flushkey_in_data[] = { 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a, 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3 @@ -546,6 +588,11 @@ struct torture_suite *ndr_winreg_suite(TALLOC_CTX *ctx) * r->in.num_values */ /* torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues, querymultiplevalues_out_data, NDR_OUT, querymultiplevalues_out_check ); */ + torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues2, querymultiplevalues2_in_data, NDR_IN, querymultiplevalues2_in_check ); + /* we cannot do this as long we don't have the ability to bring in + * r->in.num_values */ +/* torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues2, querymultiplevalues2_out_data, NDR_OUT, querymultiplevalues2_out_check ); */ + torture_suite_add_ndr_pull_fn_test(suite, winreg_FlushKey, flushkey_in_data, NDR_IN, flushkey_in_check ); torture_suite_add_ndr_pull_fn_test(suite, winreg_FlushKey, flushkey_out_data, NDR_OUT, flushkey_out_check ); -- cgit