[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Tue Mar 9 16:47:07 MST 2010
The branch, master has been updated
via ae79d8c... s4-smbtorture: on HKLM hive test the well known CurrentVersion value.
via 722daf4... s4-smbtorture: add full coverage test for winreg QueryValue calls.
via 62b41e6... s4-smbtorture: rework test_winreg_QueryValue in RPC-SPOOLSS-PRINTER once again.
via 6d10645... s4-smbtorture: add tests for set and delete value in RPC-WINREG.
from f7f67e9... Fix typo and convert spaces to tabs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ae79d8ce02921e9a5c82433527909c7f707051e3
Author: Günther Deschner <gd at samba.org>
Date: Wed Mar 10 00:43:57 2010 +0100
s4-smbtorture: on HKLM hive test the well known CurrentVersion value.
Guenther
commit 722daf43d0ef3a7951d8ee6b4aea97fd3e056719
Author: Günther Deschner <gd at samba.org>
Date: Wed Mar 10 00:17:59 2010 +0100
s4-smbtorture: add full coverage test for winreg QueryValue calls.
Guenther
commit 62b41e684286ec04dfb0c03b42d0d028212084c9
Author: Günther Deschner <gd at samba.org>
Date: Wed Mar 10 00:16:46 2010 +0100
s4-smbtorture: rework test_winreg_QueryValue in RPC-SPOOLSS-PRINTER once again.
Guenther
commit 6d10645bcae39f1377c1e3bfd01578519586289d
Author: Günther Deschner <gd at samba.org>
Date: Wed Mar 10 00:06:52 2010 +0100
s4-smbtorture: add tests for set and delete value in RPC-WINREG.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source4/torture/rpc/spoolss.c | 11 ++-
source4/torture/rpc/winreg.c | 170 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index f83d3b5..84e73c3 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3345,17 +3345,20 @@ static bool test_winreg_QueryValue(struct torture_context *tctx,
uint32_t data_size = 0;
uint32_t data_length = 0;
struct winreg_String valuename;
+ uint8_t *data = NULL;
init_winreg_String(&valuename, value_name);
+ data = talloc_zero_array(tctx, uint8_t, 0);
+
r.in.handle = handle;
r.in.value_name = &valuename;
r.in.type = &type;
r.in.data_size = &data_size;
r.in.data_length = &data_length;
- r.in.data = talloc_zero_array(tctx, uint8_t, *r.in.data_size);
+ r.in.data = data;
r.out.type = &type;
- r.out.data = talloc_zero_array(tctx, uint8_t, *r.in.data_size);
+ r.out.data = data;
r.out.data_size = &data_size;
r.out.data_length = &data_length;
@@ -3364,7 +3367,9 @@ static bool test_winreg_QueryValue(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r), "QueryValue failed");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
*r.in.data_size = *r.out.data_size;
- r.out.data = talloc_zero_array(tctx, uint8_t, *r.in.data_size);
+ data = talloc_zero_array(tctx, uint8_t, *r.in.data_size);
+ r.in.data = data;
+ r.out.data = data;
torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r), "QueryValue failed");
}
torture_assert_werr_ok(tctx, r.out.result, "QueryValue failed");
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 5f1a66b..e4de39e 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1429,6 +1429,58 @@ static bool test_QueryInfoKey(struct dcerpc_pipe *p,
return true;
}
+static bool test_SetValue(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *handle,
+ const char *value_name,
+ enum winreg_Type type,
+ uint8_t *data,
+ uint32_t size)
+{
+ struct winreg_SetValue r;
+ struct winreg_String name;
+
+ torture_comment(tctx, "Testing SetValue(%s)\n", value_name);
+
+ init_winreg_String(&name, value_name);
+
+ r.in.handle = handle;
+ r.in.name = name;
+ r.in.type = type;
+ r.in.data = data;
+ r.in.size = size;
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_SetValue(p, tctx, &r),
+ "winreg_SetValue failed");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "winreg_SetValue failed");
+
+ return true;
+}
+
+static bool test_DeleteValue(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *handle,
+ const char *value_name)
+{
+ struct winreg_DeleteValue r;
+ struct winreg_String value;
+
+ torture_comment(tctx, "Testing DeleteValue(%s)\n", value_name);
+
+ init_winreg_String(&value, value_name);
+
+ r.in.handle = handle;
+ r.in.value = value;
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_DeleteValue(p, tctx, &r),
+ "winreg_DeleteValue failed");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "winreg_DeleteValue failed");
+
+ return true;
+}
+
static bool test_key(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle, int depth,
bool test_security);
@@ -1558,6 +1610,107 @@ static bool test_QueryValue(struct dcerpc_pipe *p,
return true;
}
+static bool test_QueryValue_full(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *handle,
+ const char *valuename,
+ bool existing_value)
+{
+ struct winreg_QueryValue r;
+ struct winreg_String value_name;
+ enum winreg_Type type = REG_NONE;
+ uint32_t data_size = 0;
+ uint32_t real_data_size = 0;
+ uint32_t data_length = 0;
+ uint8_t *data = NULL;
+ WERROR expected_error = WERR_BADFILE;
+
+ if (valuename == NULL) {
+ expected_error = WERR_INVALID_PARAM;
+ }
+
+ ZERO_STRUCT(r);
+
+ init_winreg_String(&value_name, NULL);
+
+ torture_comment(tctx, "Testing QueryValue(%s)\n", valuename);
+
+ r.in.handle = handle;
+ r.in.value_name = &value_name;
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r), "QueryValue failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
+ "expected WERR_INVALID_PARAM for NULL winreg_String.name");
+
+ init_winreg_String(&value_name, valuename);
+ r.in.value_name = &value_name;
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
+ "QueryValue failed");
+
+ r.in.type = &type;
+ r.out.type = &type;
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
+ "QueryValue failed");
+
+ r.in.data_length = &data_length;
+ r.out.data_length = &data_length;
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM,
+ "QueryValue failed");
+
+ r.in.data_size = &data_size;
+ r.out.data_size = &data_size;
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ if (existing_value) {
+ torture_assert_werr_ok(tctx, r.out.result,
+ "QueryValue failed");
+ } else {
+ torture_assert_werr_equal(tctx, r.out.result, expected_error,
+ "QueryValue failed");
+ }
+
+ real_data_size = *r.out.data_size;
+
+ data = talloc_zero_array(tctx, uint8_t, 0);
+ r.in.data = data;
+ r.out.data = data;
+ *r.in.data_size = 0;
+ *r.out.data_size = 0;
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ if (existing_value) {
+ torture_assert_werr_equal(tctx, r.out.result, WERR_MORE_DATA,
+ "QueryValue failed");
+ } else {
+ torture_assert_werr_equal(tctx, r.out.result, expected_error,
+ "QueryValue failed");
+ }
+
+ data = talloc_zero_array(tctx, uint8_t, real_data_size);
+ r.in.data = data;
+ r.out.data = data;
+ r.in.data_size = &real_data_size;
+ r.out.data_size = &real_data_size;
+ torture_assert_ntstatus_ok(tctx, dcerpc_winreg_QueryValue(p, tctx, &r),
+ "QueryValue failed");
+ if (existing_value) {
+ torture_assert_werr_ok(tctx, r.out.result,
+ "QueryValue failed");
+ } else {
+ torture_assert_werr_equal(tctx, r.out.result, expected_error,
+ "QueryValue failed");
+ }
+
+ return true;
+}
+
static bool test_EnumValue(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *handle, int max_valnamelen,
int max_valbufsize)
@@ -1776,6 +1929,9 @@ static bool test_Open_Security(struct torture_context *tctx,
return ret;
}
+#define KEY_CURRENT_VERSION "SOFTWARE\\MICROSOFT\\WINDOWS NT\\CURRENTVERSION"
+#define VALUE_CURRENT_VERSION "CurrentVersion"
+
static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p,
void *userdata)
{
@@ -1794,6 +1950,20 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p,
torture_assert_ntstatus_ok(tctx, open_fn(p, tctx, &r),
"open");
+ if (open_fn == (void *)dcerpc_winreg_OpenHKLM) {
+#if 0
+ torture_assert(tctx, test_OpenKey(p, tctx, &handle, KEY_CURRENT_VERSION, &newhandle),
+ "failed to open current version key");
+#else
+ torture_assert(tctx, _test_OpenKey(p, tctx, &handle, KEY_CURRENT_VERSION, KEY_QUERY_VALUE, &newhandle, WERR_OK, NULL),
+ "failed to open current version key");
+#endif
+ torture_assert(tctx, test_QueryValue_full(p, tctx, &newhandle, VALUE_CURRENT_VERSION, true),
+ "failed to query current version");
+ torture_assert(tctx, test_CloseKey(p, tctx, &newhandle),
+ "failed to close current version key");
+ }
+
test_Cleanup(p, tctx, &handle, TEST_KEY_BASE);
if (!test_CreateKey(p, tctx, &handle, TEST_KEY_BASE, NULL)) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list