summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-27 14:05:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:09 -0500
commit4a361ffd7f0b62f05e552c6da926881cd1f756a0 (patch)
treeef082a0ef289af6017a146eeb28d7d67eebe103b /source3
parent847644bdac520a3cca7f30ffa50c0de3eeedf6d9 (diff)
downloadsamba-4a361ffd7f0b62f05e552c6da926881cd1f756a0.tar.gz
samba-4a361ffd7f0b62f05e552c6da926881cd1f756a0.tar.bz2
samba-4a361ffd7f0b62f05e552c6da926881cd1f756a0.zip
r19918: Convert winreg_CreateKey to use a ref ** instead of a unique *. W2k3 can still
create keys on Samba and vice versa. Jelmer, please check. Thanks, Volker (This used to be commit 1b460d6cdfe0cadd915a5299e6ca9bb359bf0075)
Diffstat (limited to 'source3')
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.c4
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.c73
-rw-r--r--source3/librpc/gen_ndr/srv_winreg.h2
-rw-r--r--source3/librpc/gen_ndr/winreg.h4
-rw-r--r--source3/librpc/idl/winreg.idl2
-rw-r--r--source3/rpc_server/srv_winreg_nt.c6
6 files changed, 50 insertions, 41 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c
index 7ace36ca52..544e4ac029 100644
--- a/source3/librpc/gen_ndr/cli_winreg.c
+++ b/source3/librpc/gen_ndr/cli_winreg.c
@@ -209,7 +209,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
r.in.options = options;
r.in.access_mask = access_mask;
r.in.secdesc = secdesc;
- r.in.action_taken = *action_taken;
+ r.in.action_taken = action_taken;
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r);
@@ -229,7 +229,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
/* Return variables */
*new_handle = *r.out.new_handle;
- *action_taken = r.out.action_taken;
+ *action_taken = *r.out.action_taken;
/* Return result */
return werror_to_ntstatus(r.out.result);
diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c
index bc931dafe8..9883fee784 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.c
+++ b/source3/librpc/gen_ndr/ndr_winreg.c
@@ -1019,18 +1019,18 @@ NTSTATUS ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct
if (r->in.secdesc) {
NDR_CHECK(ndr_push_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc));
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.action_taken));
- if (r->in.action_taken) {
- NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->in.action_taken));
- }
+ if (r->in.action_taken == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ if (*r->in.action_taken == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_ref_ptr(ndr));
+ NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, **r->in.action_taken));
}
if (flags & NDR_OUT) {
if (r->out.new_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.action_taken));
- if (r->out.action_taken) {
- NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->out.action_taken));
- }
+ if (r->out.action_taken == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ if (*r->out.action_taken == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_ref_ptr(ndr));
+ NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, **r->out.action_taken));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NT_STATUS_OK;
@@ -1044,6 +1044,7 @@ NTSTATUS ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winre
TALLOC_CTX *_mem_save_secdesc_0;
TALLOC_CTX *_mem_save_new_handle_0;
TALLOC_CTX *_mem_save_action_taken_0;
+ TALLOC_CTX *_mem_save_action_taken_1;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -1070,20 +1071,24 @@ NTSTATUS ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winre
NDR_CHECK(ndr_pull_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdesc_0, 0);
}
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken));
- if (_ptr_action_taken) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.action_taken);
- } else {
- r->in.action_taken = NULL;
}
- if (r->in.action_taken) {
- _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->in.action_taken, 0);
- NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->in.action_taken));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0);
+ _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.action_taken, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_action_taken));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, *r->in.action_taken);
}
+ _mem_save_action_taken_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, *r->in.action_taken, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, *r->in.action_taken));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_1, LIBNDR_FLAG_REF_ALLOC);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, LIBNDR_FLAG_REF_ALLOC);
NDR_PULL_ALLOC(ndr, r->out.new_handle);
ZERO_STRUCTP(r->out.new_handle);
+ NDR_PULL_ALLOC(ndr, r->out.action_taken);
+ *r->out.action_taken = *r->in.action_taken;
}
if (flags & NDR_OUT) {
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -1093,18 +1098,20 @@ NTSTATUS ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winre
NDR_PULL_SET_MEM_CTX(ndr, r->out.new_handle, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_handle_0, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken));
- if (_ptr_action_taken) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->out.action_taken);
- } else {
- r->out.action_taken = NULL;
}
- if (r->out.action_taken) {
- _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->out.action_taken, 0);
- NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->out.action_taken));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0);
+ _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.action_taken, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_action_taken));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, *r->out.action_taken);
}
+ _mem_save_action_taken_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, *r->out.action_taken, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, *r->out.action_taken));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_1, LIBNDR_FLAG_REF_ALLOC);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
return NT_STATUS_OK;
@@ -1136,9 +1143,10 @@ _PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name
ndr->depth--;
ndr_print_ptr(ndr, "action_taken", r->in.action_taken);
ndr->depth++;
- if (r->in.action_taken) {
- ndr_print_winreg_CreateAction(ndr, "action_taken", *r->in.action_taken);
- }
+ ndr_print_ptr(ndr, "action_taken", *r->in.action_taken);
+ ndr->depth++;
+ ndr_print_winreg_CreateAction(ndr, "action_taken", **r->in.action_taken);
+ ndr->depth--;
ndr->depth--;
ndr->depth--;
}
@@ -1151,9 +1159,10 @@ _PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name
ndr->depth--;
ndr_print_ptr(ndr, "action_taken", r->out.action_taken);
ndr->depth++;
- if (r->out.action_taken) {
- ndr_print_winreg_CreateAction(ndr, "action_taken", *r->out.action_taken);
- }
+ ndr_print_ptr(ndr, "action_taken", *r->out.action_taken);
+ ndr->depth++;
+ ndr_print_winreg_CreateAction(ndr, "action_taken", **r->out.action_taken);
+ ndr->depth--;
ndr->depth--;
ndr_print_WERROR(ndr, "result", r->out.result);
ndr->depth--;
diff --git a/source3/librpc/gen_ndr/srv_winreg.h b/source3/librpc/gen_ndr/srv_winreg.h
index dfa557f90c..2342b6107a 100644
--- a/source3/librpc/gen_ndr/srv_winreg.h
+++ b/source3/librpc/gen_ndr/srv_winreg.h
@@ -7,7 +7,7 @@ WERROR _winreg_OpenHKLM(pipes_struct *p, uint16_t *system_name, uint32_t access_
WERROR _winreg_OpenHKPD(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle);
WERROR _winreg_OpenHKU(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle);
WERROR _winreg_CloseKey(pipes_struct *p, struct policy_handle *handle);
-WERROR _winreg_CreateKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken);
+WERROR _winreg_CreateKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction **action_taken);
WERROR _winreg_DeleteKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String key);
WERROR _winreg_DeleteValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value);
WERROR _winreg_EnumKey(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time);
diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h
index 4703c3dc07..6b028633c2 100644
--- a/source3/librpc/gen_ndr/winreg.h
+++ b/source3/librpc/gen_ndr/winreg.h
@@ -164,12 +164,12 @@ struct winreg_CreateKey {
uint32_t options;
uint32_t access_mask;
struct winreg_SecBuf *secdesc;/* [unique] */
- enum winreg_CreateAction *action_taken;/* [unique] */
+ enum winreg_CreateAction **action_taken;/* [ref] */
} in;
struct {
struct policy_handle *new_handle;/* [ref] */
- enum winreg_CreateAction *action_taken;/* [unique] */
+ enum winreg_CreateAction **action_taken;/* [ref] */
WERROR result;
} out;
diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl
index c4907a199f..3d0a956a89 100644
--- a/source3/librpc/idl/winreg.idl
+++ b/source3/librpc/idl/winreg.idl
@@ -114,7 +114,7 @@ import "lsa.idl", "initshutdown.idl", "security.idl";
[in] winreg_AccessMask access_mask,
[in,unique] winreg_SecBuf *secdesc,
[out,ref] policy_handle *new_handle,
- [in,out,unique] winreg_CreateAction *action_taken
+ [in,out,ref] winreg_CreateAction **action_taken
);
/******************/
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c
index 623aab8523..2b7bd41a62 100644
--- a/source3/rpc_server/srv_winreg_nt.c
+++ b/source3/rpc_server/srv_winreg_nt.c
@@ -1196,7 +1196,7 @@ WERROR _winreg_CreateKey( pipes_struct *p, struct policy_handle *handle,
uint32_t options, uint32_t access_mask,
struct winreg_SecBuf *secdesc,
struct policy_handle *new_handle,
- enum winreg_CreateAction *action_taken )
+ enum winreg_CreateAction **action_taken )
{
struct regkey_info *parent = find_regkey_info_by_hnd(p, handle);
struct regkey_info *newparentinfo, *keyinfo;
@@ -1288,8 +1288,8 @@ WERROR _winreg_CreateKey( pipes_struct *p, struct policy_handle *handle,
/* FIXME: report the truth here */
- if ( action_taken ) {
- *action_taken = REG_CREATED_NEW_KEY;
+ if ( *action_taken ) {
+ **action_taken = REG_CREATED_NEW_KEY;
}
done: