Author: gd Date: 2007-10-10 13:56:47 +0000 (Wed, 10 Oct 2007) New Revision: 25612
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25612 Log: Add test_SetKeySecurity() call. Guenther 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-10-10 13:50:21 UTC (rev 25611) +++ branches/SAMBA_4_0/source/torture/rpc/winreg.c 2007-10-10 13:56:47 UTC (rev 25612) @@ -220,6 +220,44 @@ 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 @@ 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 @@ 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;