svn commit: samba r23821 - in
branches/SAMBA_4_0/source/torture/rpc: .
obnox at samba.org
obnox at samba.org
Tue Jul 10 21:35:21 GMT 2007
Author: obnox
Date: 2007-07-10 21:35:20 +0000 (Tue, 10 Jul 2007)
New Revision: 23821
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23821
Log:
Extend the winreg test by a test for DeleteKey on a
key that has subkeys. This should return WERR_ACCESS_DENIED.
Michael
Modified:
branches/SAMBA_4_0/source/torture/rpc/winreg.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/winreg.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/winreg.c 2007-07-10 21:04:57 UTC (rev 23820)
+++ branches/SAMBA_4_0/source/torture/rpc/winreg.c 2007-07-10 21:35:20 UTC (rev 23821)
@@ -29,6 +29,8 @@
#define TEST_KEY_BASE "smbtorture test"
#define TEST_KEY1 TEST_KEY_BASE "\\spottyfoot"
#define TEST_KEY2 TEST_KEY_BASE "\\with a SD (#1)"
+#define TEST_KEY3 TEST_KEY_BASE "\\with a subkey"
+#define TEST_SUBKEY TEST_KEY3 "\\subkey"
static void init_initshutdown_String(TALLOC_CTX *mem_ctx, struct initshutdown_String *name, const char *s)
{
@@ -368,6 +370,35 @@
return true;
}
+/* DeleteKey on a key with subkey(s) should
+ * return WERR_ACCESS_DENIED. */
+static bool test_DeleteKeyWithSubkey(struct dcerpc_pipe *p,
+ TALLOC_CTX* mem_ctx,
+ struct policy_handle *handle, const char *key)
+{
+ NTSTATUS status;
+ struct winreg_DeleteKey r;
+
+ printf("\ntesting DeleteKeyWithSubkey\n");
+
+ r.in.handle = handle;
+ init_winreg_String(&r.in.key, key);
+
+ status = dcerpc_winreg_DeleteKey(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("DeleteKeyWithSubkey failed - %s\n", nt_errstr(status));
+ return false;
+ }
+
+ if (!W_ERROR_EQUAL(r.out.result, WERR_ACCESS_DENIED)) {
+ printf("DeleteKeyWithSubkey failed - %s\n", win_errstr(r.out.result));
+ return false;
+ }
+
+ return true;
+}
+
static bool test_QueryInfoKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, char *class)
{
@@ -709,6 +740,7 @@
{
struct policy_handle handle, newhandle;
bool ret = true, created = false, created2 = false, deleted = false;
+ bool created3 = false, created_subkey = false;
struct winreg_OpenHKLM r;
NTSTATUS status;
@@ -725,6 +757,8 @@
test_Cleanup(p, mem_ctx, &handle, TEST_KEY1);
test_Cleanup(p, mem_ctx, &handle, TEST_KEY2);
+ test_Cleanup(p, mem_ctx, &handle, TEST_SUBKEY);
+ test_Cleanup(p, mem_ctx, &handle, TEST_KEY3);
test_Cleanup(p, mem_ctx, &handle, TEST_KEY_BASE);
if (!test_CreateKey(p, mem_ctx, &handle, TEST_KEY1, NULL)) {
@@ -786,6 +820,38 @@
ret = false;
}
+ if (created && test_CreateKey(p, mem_ctx, &handle, TEST_KEY3, NULL)) {
+ created3 = true;
+ }
+
+ if (created3 &&
+ test_CreateKey(p, mem_ctx, &handle, TEST_SUBKEY, NULL))
+ {
+ created_subkey = true;
+ }
+
+ if (created_subkey &&
+ !test_DeleteKeyWithSubkey(p, mem_ctx, &handle, TEST_KEY3))
+ {
+ printf("DeleteKeyWithSubkey failed "
+ "(DeleteKey didn't return ACCESS_DENIED)\n");
+ ret = false;
+ }
+
+ if (created_subkey &&
+ !test_DeleteKey(p, mem_ctx, &handle, TEST_SUBKEY))
+ {
+ printf("DeleteKey failed\n");
+ ret = false;
+ }
+
+ if (created3 &&
+ !test_DeleteKey(p, mem_ctx, &handle, TEST_KEY3))
+ {
+ printf("DeleteKey failed\n");
+ ret = false;
+ }
+
/* The HKCR hive has a very large fanout */
if (open_fn == (void *)dcerpc_winreg_OpenHKCR) {
More information about the samba-cvs
mailing list