summaryrefslogtreecommitdiff
path: root/source4/rpc_server/winreg
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-24 08:31:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:29 -0500
commit649882d8d59f35cf51166bedd73c2eab4cea7e50 (patch)
tree529e7f87274b3a9ef49d34176e407fe1133f471c /source4/rpc_server/winreg
parentcfa981c65667fb63c2c2af8a48149dc6e89f461c (diff)
downloadsamba-649882d8d59f35cf51166bedd73c2eab4cea7e50.tar.gz
samba-649882d8d59f35cf51166bedd73c2eab4cea7e50.tar.bz2
samba-649882d8d59f35cf51166bedd73c2eab4cea7e50.zip
r9567: fixed the winreg IDL for CreateKey, including a security
descriptor. To keep it simple I just use normal IDL buffers for now, avoiding the complex methods metze used in spoolss. We might change that later Also added decoding of the security_descriptor in winreg_GetKeySecurity() in smbtorture (This used to be commit 439f34a9621e2e96329c30cfed8d78b8fdfbd8a2)
Diffstat (limited to 'source4/rpc_server/winreg')
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index e20d9aa6b6..f03ca2fa86 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -99,17 +99,34 @@ static WERROR winreg_CreateKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
{
struct dcesrv_handle *h, *newh;
WERROR error;
+ struct security_descriptor sd;
DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY);
- error = reg_key_add_name(newh, (struct registry_key *)h->data, r->in.key.name,
- r->in.access_mask,
- r->in.sec_desc?r->in.sec_desc->sd:NULL,
+ /* the security descriptor is optional */
+ if (r->in.secdesc != NULL) {
+ DATA_BLOB sdblob;
+ NTSTATUS status;
+ sdblob.data = r->in.secdesc->sd.data;
+ sdblob.length = r->in.secdesc->sd.len;
+ if (sdblob.data == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+ status = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NT_STATUS_IS_OK(status)) {
+ return WERR_INVALID_PARAM;
+ }
+ }
+
+ error = reg_key_add_name(newh, (struct registry_key *)h->data, r->in.name.name,
+ r->in.access_required,
+ r->in.secdesc?&sd:NULL,
(struct registry_key **)&newh->data);
if (W_ERROR_IS_OK(error)) {
- r->out.handle = &newh->wire_handle;
+ r->out.new_handle = &newh->wire_handle;
} else {
talloc_free(newh);
}