summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-06-23 15:00:06 +0200
committerGünther Deschner <gd@samba.org>2010-06-23 15:35:41 +0200
commitba40f3828180ba63debb4b3578c0e0faf16f6cbc (patch)
tree87a223a6cd011f92c9a7d6ff88424dc71d3a99ac /source4/torture
parent2dc50ec44c4e9af144733f028122970be83332ba (diff)
downloadsamba-ba40f3828180ba63debb4b3578c0e0faf16f6cbc.tar.gz
samba-ba40f3828180ba63debb4b3578c0e0faf16f6cbc.tar.bz2
samba-ba40f3828180ba63debb4b3578c0e0faf16f6cbc.zip
s4-smbtorture: test more valid key names in RPC-WINREG.
Guenther
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/winreg.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 968afc0ed3..f0510d879a 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -2136,6 +2136,65 @@ static bool test_SetValue_extended(struct dcerpc_binding_handle *b,
return true;
}
+static bool test_create_keynames(struct dcerpc_binding_handle *b,
+ struct torture_context *tctx,
+ struct policy_handle *handle)
+{
+ const char *keys[] = {
+ "torture_key",
+ "torture key",
+ "torture,key",
+ "torture/key",
+ "torture\\key",
+ };
+ int i;
+
+ for (i=0; i < ARRAY_SIZE(keys); i++) {
+
+ enum winreg_CreateAction action_taken;
+ struct policy_handle new_handle;
+ char *q, *tmp;
+
+ torture_assert(tctx,
+ test_CreateKey_opts(tctx, b, handle, keys[i], NULL,
+ REG_OPTION_NON_VOLATILE,
+ SEC_FLAG_MAXIMUM_ALLOWED,
+ NULL,
+ WERR_OK,
+ &action_taken,
+ &new_handle),
+ talloc_asprintf(tctx, "failed to create '%s' key", keys[i]));
+
+ torture_assert_int_equal(tctx, action_taken, REG_CREATED_NEW_KEY, "unexpected action");
+
+ torture_assert(tctx,
+ test_DeleteKey_opts(b, tctx, handle, keys[i], WERR_OK),
+ "failed to delete key");
+
+ torture_assert(tctx,
+ test_DeleteKey_opts(b, tctx, handle, keys[i], WERR_BADFILE),
+ "failed 2nd delete key");
+
+ tmp = talloc_strdup(tctx, keys[i]);
+
+ q = strchr(tmp, '\\');
+ if (q != NULL) {
+ *q = '\0';
+ q++;
+
+ torture_assert(tctx,
+ test_DeleteKey_opts(b, tctx, handle, tmp, WERR_OK),
+ "failed to delete key");
+
+ torture_assert(tctx,
+ test_DeleteKey_opts(b, tctx, handle, tmp, WERR_BADFILE),
+ "failed 2nd delete key");
+ }
+ }
+
+ return true;
+}
+
#define KEY_CURRENT_VERSION "SOFTWARE\\MICROSOFT\\WINDOWS NT\\CURRENTVERSION"
#define VALUE_CURRENT_VERSION "CurrentVersion"
@@ -2550,6 +2609,8 @@ static bool test_key_base(struct torture_context *tctx,
"values SetValue test failed");
torture_assert(tctx, test_SetValue_extended(b, tctx, &newhandle),
"extended SetValue test failed");
+ torture_assert(tctx, test_create_keynames(b, tctx, &newhandle),
+ "keyname CreateKey test failed");
} else {
torture_assert(tctx, test_CreateKey_keytypes(tctx, b, &newhandle, test_key1, hkey),
"keytype test failed");