summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-04-05 13:50:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:50:40 -0500
commit2542ed0ac75d545eef3571bfb19fb39a5b71beb3 (patch)
tree7f05c90fae7fe25864a4c2b9ca28b980f1ed9ca4 /source4/torture/rpc
parent381a903d00ccbc3e80e8eca533d304fed6c13870 (diff)
downloadsamba-2542ed0ac75d545eef3571bfb19fb39a5b71beb3.tar.gz
samba-2542ed0ac75d545eef3571bfb19fb39a5b71beb3.tar.bz2
samba-2542ed0ac75d545eef3571bfb19fb39a5b71beb3.zip
r46: Add CreateKey function (still working on it)
(This used to be commit 9f13b7c60cc7e6edd095eee96625ee02cd0dd73b)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/winreg.c55
1 files changed, 49 insertions, 6 deletions
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 9b90d30d5c..23e3d2e779 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -53,6 +53,36 @@ static BOOL test_GetVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+static BOOL test_CreateKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle, const char *name, const char *class)
+{
+ struct winreg_CreateKey r;
+ struct policy_handle newhandle;
+ NTSTATUS status;
+
+ printf("\ntesting CreateKey\n");
+
+ r.in.handle = handle;
+ r.out.handle = &newhandle;
+ init_winreg_String(&r.in.key, name);
+ init_winreg_String(&r.in.class, class);
+ r.in.reserved = 0x0;
+ r.in.reserved2 = 0x0;
+ r.in.access_mask = 0x02000000;
+ r.out.reserved = 0x0;
+ r.in.sec_info = 0x0;
+ r.in.data = 0;
+
+ status = dcerpc_winreg_CreateKey(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("CreateKey failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
+
static BOOL test_CloseKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -384,6 +414,7 @@ typedef BOOL winreg_open_fn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static BOOL test_Open(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, void *fn)
{
struct policy_handle handle;
+ BOOL ret = True;
winreg_open_fn *open_fn = (winreg_open_fn *)fn;
if (!open_fn(p, mem_ctx, &handle))
@@ -391,25 +422,37 @@ static BOOL test_Open(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, void *fn)
if (!test_GetVersion(p, mem_ctx, &handle)) {
printf("GetVersion failed\n");
- return False;
+ ret = False;
}
if (!test_FlushKey(p, mem_ctx, &handle)) {
printf("FlushKey failed\n");
- return False;
+ ret = False;
+ }
+
+ if (!test_CreateKey(p, mem_ctx, &handle, "spottyfoot", "foo")) {
+ printf("CreateKey failed\n");
+ ret = False;
}
if (!test_DeleteKey(p, mem_ctx, &handle, "spottyfoot")) {
printf("DeleteKey failed\n");
- return False;
+ ret = False;
}
/* The HKCR hive has a very large fanout */
- if (open_fn == test_OpenHKCR)
- return test_key(p, mem_ctx, &handle, MAX_DEPTH - 1);
+ if (open_fn == test_OpenHKCR) {
+ if(!test_key(p, mem_ctx, &handle, MAX_DEPTH - 1)) {
+ ret = False;
+ }
+ }
- return test_key(p, mem_ctx, &handle, 0);
+ if(!test_key(p, mem_ctx, &handle, 0)) {
+ ret = False;
+ }
+
+ return ret;
}
BOOL torture_rpc_winreg(int dummy)