[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Jun 29 04:28:15 MDT 2010


The branch, master has been updated
       via  1662e38... s4-smbtorture: add NDR torture test for winreg_QueryMultipleValues2.
       via  7ae7750... s4-smbtorture: add RPC torture test for winreg_QueryMultipleValues2.
       via  c02cbaa... winreg: fix winreg_QueryMultipleValues2 IDL.
      from  bf07bf2... winreg: fix winreg_QueryMultipleValues() IDL and torture tests.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1662e383dd890d48e0e1207a51d4b3f9fb12ab65
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 29 12:26:24 2010 +0200

    s4-smbtorture: add NDR torture test for winreg_QueryMultipleValues2.
    
    Guenther

commit 7ae7750c4085b2d95b46fa4433586e9a68d593ae
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 29 12:14:02 2010 +0200

    s4-smbtorture: add RPC torture test for winreg_QueryMultipleValues2.
    
    Guenther

commit c02cbaae34bd27826ba13f98fc40a396b0e1530d
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 29 12:04:56 2010 +0200

    winreg: fix winreg_QueryMultipleValues2 IDL.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 librpc/idl/winreg.idl        |    9 ++++---
 source4/torture/ndr/winreg.c |   47 ++++++++++++++++++++++++++++++++++++++++++
 source4/torture/rpc/winreg.c |   41 ++++++++++++++++++++++++++++++++++++
 3 files changed, 93 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
index 19f309b..784cb33 100644
--- a/librpc/idl/winreg.idl
+++ b/librpc/idl/winreg.idl
@@ -430,12 +430,13 @@ import "lsa.idl", "security.idl", "misc.idl";
 
 	/******************/
 	/* Function: 0x22 */
-	WERROR winreg_QueryMultipleValues2(
+	[public] WERROR winreg_QueryMultipleValues2(
 		[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(offered),length_is(offered)] uint8 *buffer,
-		[in] uint32 offered,
+		[in,out,unique,size_is(*offered),length_is(*offered)] uint8 *buffer,
+		[in,ref] uint32 *offered,
 		[out,ref] uint32 *needed
 	);
 
diff --git a/source4/torture/ndr/winreg.c b/source4/torture/ndr/winreg.c
index 2bd28f0..3b5766a 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 );
 
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 9deedbf..c039143 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1645,6 +1645,45 @@ static bool test_QueryMultipleValues(struct dcerpc_binding_handle *b,
 	return true;
 }
 
+static bool test_QueryMultipleValues2(struct dcerpc_binding_handle *b,
+				      struct torture_context *tctx,
+				      struct policy_handle *handle,
+				      const char *valuename)
+{
+	struct winreg_QueryMultipleValues2 r;
+	uint32_t offered = 0, needed;
+
+	ZERO_STRUCT(r);
+
+	r.in.key_handle = handle;
+	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.offered = &offered;
+	r.out.needed = &needed;
+
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_winreg_QueryMultipleValues2_r(b, tctx, &r),
+		"QueryMultipleValues2 failed");
+	if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+		*r.in.offered = *r.out.needed;
+		r.in.buffer = r.out.buffer = talloc_zero_array(tctx, uint8_t, *r.in.offered);
+
+		torture_assert_ntstatus_ok(tctx,
+			dcerpc_winreg_QueryMultipleValues2_r(b, tctx, &r),
+			"QueryMultipleValues2 failed");
+	}
+
+	torture_assert_werr_ok(tctx, r.out.result,
+		"QueryMultipleValues2 failed");
+
+	return true;
+}
+
 static bool test_QueryValue(struct dcerpc_binding_handle *b,
 			    struct torture_context *tctx,
 			    struct policy_handle *handle,
@@ -1813,6 +1852,8 @@ static bool test_EnumValue(struct dcerpc_binding_handle *b,
 					       r.out.name->name);
 			ret &= test_QueryMultipleValues(b, tctx, handle,
 							r.out.name->name);
+			ret &= test_QueryMultipleValues2(b, tctx, handle,
+							 r.out.name->name);
 		}
 
 		r.in.enum_index++;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list