diff options
author | Günther Deschner <gd@samba.org> | 2010-03-17 00:05:52 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-17 11:48:51 +0100 |
commit | f07572063dcc84d0f91284ecbf03b4319fe37a60 (patch) | |
tree | 49d7d8d1ebd49e471ab2d4874493b6842559d946 | |
parent | 8fd4375803c4cdebd7e68053c8b62e78b887eec8 (diff) | |
download | samba-f07572063dcc84d0f91284ecbf03b4319fe37a60.tar.gz samba-f07572063dcc84d0f91284ecbf03b4319fe37a60.tar.bz2 samba-f07572063dcc84d0f91284ecbf03b4319fe37a60.zip |
s4-smbtorture: put HKLM current_version test into an own function.
Guenther
-rw-r--r-- | source4/torture/rpc/winreg.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 9ea1ae8fc2..b0ed61261a 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -2107,6 +2107,36 @@ static bool test_SetValue_extended(struct dcerpc_binding_handle *b, #define KEY_CURRENT_VERSION "SOFTWARE\\MICROSOFT\\WINDOWS NT\\CURRENTVERSION" #define VALUE_CURRENT_VERSION "CurrentVersion" +static bool test_HKLM_wellknown(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle) +{ + struct policy_handle newhandle; + + /* FIXME: s3 does not support SEC_FLAG_MAXIMUM_ALLOWED yet */ + if (torture_setting_bool(tctx, "samba3", false)) { + torture_assert(tctx, _test_OpenKey(b, tctx, handle, KEY_CURRENT_VERSION, KEY_QUERY_VALUE, &newhandle, WERR_OK, NULL), + "failed to open current version key"); + } else { + torture_assert(tctx, test_OpenKey(b, tctx, handle, KEY_CURRENT_VERSION, &newhandle), + "failed to open current version key"); + } + + torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, VALUE_CURRENT_VERSION, true), + "failed to query current version"); + torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, "IDoNotExist", false), + "failed to query current version"); + torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, NULL, false), + "test_QueryValue_full for NULL value failed"); + torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, "", false), + "test_QueryValue_full for \"\" value failed"); + + torture_assert(tctx, test_CloseKey(b, tctx, &newhandle), + "failed to close current version key"); + + return true; +} + static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p, void *userdata) { @@ -2127,24 +2157,9 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p, "open"); if (open_fn == (void *)dcerpc_winreg_OpenHKLM_r) { -#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(b, 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(b, tctx, &newhandle, VALUE_CURRENT_VERSION, true), - "failed to query current version"); - torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, "IDoNotExist", false), - "failed to query current version"); - torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, NULL, false), - "test_QueryValue_full for NULL value failed"); - torture_assert(tctx, test_QueryValue_full(b, tctx, &newhandle, "", false), - "test_QueryValue_full for \"\" value failed"); - - torture_assert(tctx, test_CloseKey(b, tctx, &newhandle), - "failed to close current version key"); + torture_assert(tctx, + test_HKLM_wellknown(tctx, b, &handle), + "failed to test HKLM wellknown keys"); } test_Cleanup(b, tctx, &handle, TEST_KEY_BASE); |