1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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 1b460d6cdf)
This commit is contained in:
Volker Lendecke 2006-11-27 14:05:28 +00:00 committed by Gerald (Jerry) Carter
parent 847644bdac
commit 4a361ffd7f
6 changed files with 50 additions and 41 deletions

View File

@ -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);

View File

@ -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--;

View File

@ -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);

View File

@ -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;

View File

@ -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
);
/******************/

View File

@ -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: