summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-06-29 11:40:24 +0200
committerGünther Deschner <gd@samba.org>2010-06-29 11:48:53 +0200
commitbf07bf2857517b0972f47f5e9b46b7bde80c041b (patch)
tree4262cb828f9dfc4366ec0e529114f6f5cc440e98
parentee01fe8c5bd450c82db3f7a7e8c783ac32b0812d (diff)
downloadsamba-bf07bf2857517b0972f47f5e9b46b7bde80c041b.tar.gz
samba-bf07bf2857517b0972f47f5e9b46b7bde80c041b.tar.bz2
samba-bf07bf2857517b0972f47f5e9b46b7bde80c041b.zip
winreg: fix winreg_QueryMultipleValues() IDL and torture tests.
Guenther
-rw-r--r--librpc/idl/winreg.idl13
-rw-r--r--source4/torture/ndr/winreg.c34
-rw-r--r--source4/torture/rpc/winreg.c12
3 files changed, 30 insertions, 29 deletions
diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
index ce00b8eed6..19f309b47b 100644
--- a/librpc/idl/winreg.idl
+++ b/librpc/idl/winreg.idl
@@ -371,17 +371,18 @@ import "lsa.idl", "security.idl", "misc.idl";
);
typedef struct {
- winreg_String *name;
- winreg_Type type;
- uint32 offset;
- uint32 length;
+ winreg_ValNameBuf *ve_valuename;
+ uint32 ve_valuelen;
+ uint32 *ve_valueptr;
+ winreg_Type ve_type;
} QueryMultipleValue;
-
+
/******************/
/* Function: 0x1d */
[public] WERROR winreg_QueryMultipleValues(
[in,ref] policy_handle *key_handle,
- [in,out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values,
+ [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
+ [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
[in] uint32 num_values,
[in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
[in,out,ref] uint32 *buffer_size
diff --git a/source4/torture/ndr/winreg.c b/source4/torture/ndr/winreg.c
index 14ee84484a..2bd28f0fb7 100644
--- a/source4/torture/ndr/winreg.c
+++ b/source4/torture/ndr/winreg.c
@@ -242,14 +242,16 @@ static const uint8_t querymultiplevalues_in_data[] = {
static bool querymultiplevalues_in_check(struct torture_context *tctx,
struct winreg_QueryMultipleValues *r)
{
+ torture_assert_mem_equal(tctx, r->in.key_handle, querymultiplevalues_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[0].name->name, "HOMEPATH",
- "name");
-
- torture_assert_int_equal(tctx, r->in.values[0].type, 0, "type");
- torture_assert_int_equal(tctx, r->in.values[0].offset, 0, "offset");
- torture_assert_int_equal(tctx, r->in.values[0].length, 0, "length");
- torture_assert_int_equal(tctx, *r->in.buffer_size, 76, "buffer size");
+ torture_assert_str_equal(tctx, r->in.values_in[0].ve_valuename->name, "HOMEPATH", "name");
+ torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->length, 18, "name len");
+ torture_assert_int_equal(tctx, r->in.values_in[0].ve_valuename->size, 18, "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_mem_equal(tctx, r->in.buffer, querymultiplevalues_in_data+0x6C, *r->in.buffer_size, "buffer");
+ torture_assert_int_equal(tctx, *r->in.buffer_size, 32, "buffer size");
return true;
}
@@ -274,16 +276,12 @@ static const uint8_t querymultiplevalues_out_data[] = {
static bool querymultiplevalues_out_check(struct torture_context *tctx,
struct winreg_QueryMultipleValues *r)
{
- torture_assert_str_equal(tctx, r->out.values[0].name->name, "HOMEPATH",
- "name");
-
- torture_assert_int_equal(tctx, r->out.values[0].type, 0, "type");
- torture_assert_int_equal(tctx, r->out.values[0].offset, 0, "offset");
- torture_assert_int_equal(tctx, r->out.values[0].length, 0, "length");
+ torture_assert_str_equal(tctx, r->out.values_out[0].ve_valuename->name, "HOMEPATH", "name");
+ torture_assert_int_equal(tctx, r->out.values_out[0].ve_type, 0, "type");
+ torture_assert_int_equal(tctx, r->out.values_out[0].ve_valuelen, 0, "length");
/* FIXME: r->out.buffer */
torture_assert_int_equal(tctx, *r->out.buffer_size, 76, "buffer size");
- torture_assert_werr_equal(tctx, r->out.result, WERR_MORE_DATA,
- "return code");
+ torture_assert_werr_equal(tctx, r->out.result, WERR_MORE_DATA, "return code");
return true;
}
@@ -543,8 +541,10 @@ struct torture_suite *ndr_winreg_suite(TALLOC_CTX *ctx)
torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryValue, queryvalue_in_data, NDR_IN, queryvalue_in_check );
torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryValue, queryvalue_out_data, NDR_OUT, queryvalue_out_check );
- /*torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues, querymultiplevalues_in_data, NDR_IN, querymultiplevalues_in_check );
- 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_QueryMultipleValues, querymultiplevalues_in_data, NDR_IN, querymultiplevalues_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_QueryMultipleValues, querymultiplevalues_out_data, NDR_OUT, querymultiplevalues_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 );
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index f0510d879a..9deedbf46f 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1616,13 +1616,13 @@ static bool test_QueryMultipleValues(struct dcerpc_binding_handle *b,
uint32_t bufsize=0;
ZERO_STRUCT(r);
+
r.in.key_handle = handle;
- r.in.values = r.out.values = talloc_array(tctx, struct QueryMultipleValue, 1);
- r.in.values[0].name = talloc(tctx, struct winreg_String);
- r.in.values[0].name->name = valuename;
- r.in.values[0].offset = 0;
- r.in.values[0].length = 0;
- r.in.values[0].type = 0;
+ r.in.values_in = r.out.values_out = talloc_zero_array(tctx, struct QueryMultipleValue, 1);
+ r.in.values_in[0].ve_valuename = talloc(tctx, struct winreg_ValNameBuf);
+ r.in.values_in[0].ve_valuename->name = valuename;
+ /* size needs to be set manually for winreg_ValNameBuf */
+ r.in.values_in[0].ve_valuename->size = strlen_m_term(valuename)*2;
r.in.num_values = 1;
r.in.buffer_size = r.out.buffer_size = talloc(tctx, uint32_t);