diff options
author | Günther Deschner <gd@samba.org> | 2007-10-10 13:56:47 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:42:53 +0100 |
commit | bdf71f5dc676aaf9558d595abeece9c1b36eb28c (patch) | |
tree | 707b8810119cc734df1e7e5e68483fbaf69bd1e7 /source4 | |
parent | 89f6f464eab10ae41b022a77dbfa01cdfde23c4e (diff) | |
download | samba-bdf71f5dc676aaf9558d595abeece9c1b36eb28c.tar.gz samba-bdf71f5dc676aaf9558d595abeece9c1b36eb28c.tar.bz2 samba-bdf71f5dc676aaf9558d595abeece9c1b36eb28c.zip |
r25612: Add test_SetKeySecurity() call.
Guenther
(This used to be commit a5e4d13eef9f20fdd304bff7279e56e09aa070f2)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/winreg.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 0a1c0a7bad..d9514ad9bb 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -220,6 +220,44 @@ static bool test_GetKeySecurity(struct dcerpc_pipe *p, return true; } +static bool test_SetKeySecurity(struct dcerpc_pipe *p, + struct torture_context *tctx, + struct policy_handle *handle, + struct security_descriptor *sd) +{ + struct winreg_SetKeySecurity r; + struct KeySecurityData *sdata = NULL; + DATA_BLOB sdblob; + + ZERO_STRUCT(r); + + if (p->conn->flags & DCERPC_DEBUG_PRINT_OUT) { + NDR_PRINT_DEBUG(security_descriptor, sd); + } + + torture_assert_ntstatus_ok(tctx, + ndr_push_struct_blob(&sdblob, tctx, sd, + (ndr_push_flags_fn_t)ndr_push_security_descriptor), + "push_security_descriptor failed"); + + sdata = talloc_zero(tctx, struct KeySecurityData); + sdata->data = sdblob.data; + sdata->size = sdblob.length; + sdata->len = sdblob.length; + + r.in.handle = handle; + r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + r.in.sd = sdata; + + torture_assert_ntstatus_ok(tctx, + dcerpc_winreg_SetKeySecurity(p, tctx, &r), + "SetKeySecurity failed"); + + torture_assert_werr_ok(tctx, r.out.result, "SetKeySecurity failed"); + + return true; +} + static bool test_CloseKey(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *handle) { @@ -625,6 +663,7 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p, bool ret = true, created = false, created2 = false, deleted = false; bool created3 = false, created_subkey = false; struct winreg_OpenHKLM r; + struct security_descriptor *sd = NULL; winreg_open_fn open_fn = userdata; @@ -686,11 +725,16 @@ static bool test_Open(struct torture_context *tctx, struct dcerpc_pipe *p, created2 = true; } - if (created2 && !test_GetKeySecurity(p, tctx, &newhandle, NULL)) { + if (created2 && !test_GetKeySecurity(p, tctx, &newhandle, &sd)) { printf("GetKeySecurity failed\n"); ret = false; } + if (created2 && sd && !test_SetKeySecurity(p, tctx, &newhandle, sd)) { + printf("SetKeySecurity failed\n"); + ret = false; + } + if (created2 && !test_CloseKey(p, tctx, &newhandle)) { printf("CloseKey failed\n"); ret = false; |