s4-smbtorture: add NDR torture test for winreg_QueryMultipleValues2.
authorGünther Deschner <gd@samba.org>
Tue, 29 Jun 2010 10:26:24 +0000 (12:26 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 29 Jun 2010 10:27:08 +0000 (12:27 +0200)
Guenther

source4/torture/ndr/winreg.c

index 2bd28f0fb7b64057ba2d8c93040192060a3859bf..3b5766a495f4e52a2a20f275fa85229bedb89480 100644 (file)
@@ -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 );