diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-11-27 14:29:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:10 -0500 |
commit | 8e8821b1dae2c32ecc9a7900fd0f30ec0a32ba4e (patch) | |
tree | 6d315b559bce00eb71e1289a497469bcd53c2fa9 | |
parent | 4a361ffd7f0b62f05e552c6da926881cd1f756a0 (diff) | |
download | samba-8e8821b1dae2c32ecc9a7900fd0f30ec0a32ba4e.tar.gz samba-8e8821b1dae2c32ecc9a7900fd0f30ec0a32ba4e.tar.bz2 samba-8e8821b1dae2c32ecc9a7900fd0f30ec0a32ba4e.zip |
r19919: Convert winreg_EnumKey to use ref ** instead of a unique *.
Volker
(This used to be commit b714b51884af0d79de8568410676d4889f23ffb6)
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.c | 8 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_winreg.c | 146 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.h | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/winreg.h | 8 | ||||
-rw-r--r-- | source3/librpc/idl/winreg.idl | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_winreg_nt.c | 13 |
6 files changed, 102 insertions, 79 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index 544e4ac029..b11000bd7e 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -306,8 +306,8 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.handle = handle; r.in.enum_index = enum_index; r.in.name = name; - r.in.keyclass = *keyclass; - r.in.last_changed_time = *last_changed_time; + r.in.keyclass = keyclass; + r.in.last_changed_time = last_changed_time; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r); @@ -327,8 +327,8 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* Return variables */ *name = *r.out.name; - *keyclass = r.out.keyclass; - *last_changed_time = r.out.last_changed_time; + *keyclass = *r.out.keyclass; + *last_changed_time = *r.out.last_changed_time; /* 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 9883fee784..8aaa571c3f 100644 --- a/source3/librpc/gen_ndr/ndr_winreg.c +++ b/source3/librpc/gen_ndr/ndr_winreg.c @@ -1294,26 +1294,26 @@ NTSTATUS ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct w NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index)); if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyclass)); - if (r->in.keyclass) { - NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass)); - } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.last_changed_time)); - if (r->in.last_changed_time) { - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->in.last_changed_time)); - } + if (r->in.keyclass == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->in.keyclass == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.keyclass)); + if (r->in.last_changed_time == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->in.last_changed_time == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, **r->in.last_changed_time)); } if (flags & NDR_OUT) { if (r->out.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.keyclass)); - if (r->out.keyclass) { - NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass)); - } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.last_changed_time)); - if (r->out.last_changed_time) { - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time)); - } + if (r->out.keyclass == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->out.keyclass == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.keyclass)); + if (r->out.last_changed_time == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->out.last_changed_time == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, **r->out.last_changed_time)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NT_STATUS_OK; @@ -1326,7 +1326,9 @@ NTSTATUS ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_ TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_name_0; TALLOC_CTX *_mem_save_keyclass_0; + TALLOC_CTX *_mem_save_keyclass_1; TALLOC_CTX *_mem_save_last_changed_time_0; + TALLOC_CTX *_mem_save_last_changed_time_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -1345,32 +1347,40 @@ NTSTATUS ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_ NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass)); - if (_ptr_keyclass) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.keyclass); - } else { - r->in.keyclass = NULL; } - if (r->in.keyclass) { - _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.keyclass, 0); - NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0); + _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.keyclass, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_keyclass)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->in.keyclass); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time)); - if (_ptr_last_changed_time) { + _mem_save_keyclass_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.keyclass, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.keyclass)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.last_changed_time); - } else { - r->in.last_changed_time = NULL; } - if (r->in.last_changed_time) { - _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.last_changed_time, 0); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->in.last_changed_time)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0); + _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.last_changed_time, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_last_changed_time)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->in.last_changed_time); } + _mem_save_last_changed_time_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.last_changed_time, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, *r->in.last_changed_time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_ALLOC(ndr, r->out.name); *r->out.name = *r->in.name; + NDR_PULL_ALLOC(ndr, r->out.keyclass); + *r->out.keyclass = *r->in.keyclass; + NDR_PULL_ALLOC(ndr, r->out.last_changed_time); + *r->out.last_changed_time = *r->in.last_changed_time; } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { @@ -1380,30 +1390,34 @@ NTSTATUS ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_ NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass)); - if (_ptr_keyclass) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.keyclass); - } else { - r->out.keyclass = NULL; } - if (r->out.keyclass) { - _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.keyclass, 0); - NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0); + _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.keyclass, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_keyclass)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.keyclass); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time)); - if (_ptr_last_changed_time) { + _mem_save_keyclass_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.keyclass, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.keyclass)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.last_changed_time); - } else { - r->out.last_changed_time = NULL; } - if (r->out.last_changed_time) { - _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, 0); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->out.last_changed_time)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0); + _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_last_changed_time)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.last_changed_time); } + _mem_save_last_changed_time_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.last_changed_time, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NT_STATUS_OK; @@ -1430,15 +1444,17 @@ _PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, ndr->depth--; ndr_print_ptr(ndr, "keyclass", r->in.keyclass); ndr->depth++; - if (r->in.keyclass) { - ndr_print_winreg_StringBuf(ndr, "keyclass", r->in.keyclass); - } + ndr_print_ptr(ndr, "keyclass", *r->in.keyclass); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "keyclass", *r->in.keyclass); + ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "last_changed_time", r->in.last_changed_time); ndr->depth++; - if (r->in.last_changed_time) { - ndr_print_NTTIME(ndr, "last_changed_time", *r->in.last_changed_time); - } + ndr_print_ptr(ndr, "last_changed_time", *r->in.last_changed_time); + ndr->depth++; + ndr_print_NTTIME(ndr, "last_changed_time", **r->in.last_changed_time); + ndr->depth--; ndr->depth--; ndr->depth--; } @@ -1451,15 +1467,17 @@ _PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, ndr->depth--; ndr_print_ptr(ndr, "keyclass", r->out.keyclass); ndr->depth++; - if (r->out.keyclass) { - ndr_print_winreg_StringBuf(ndr, "keyclass", r->out.keyclass); - } + ndr_print_ptr(ndr, "keyclass", *r->out.keyclass); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "keyclass", *r->out.keyclass); + ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "last_changed_time", r->out.last_changed_time); ndr->depth++; - if (r->out.last_changed_time) { - ndr_print_NTTIME(ndr, "last_changed_time", *r->out.last_changed_time); - } + ndr_print_ptr(ndr, "last_changed_time", *r->out.last_changed_time); + ndr->depth++; + ndr_print_NTTIME(ndr, "last_changed_time", **r->out.last_changed_time); + 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 2342b6107a..f972e09d26 100644 --- a/source3/librpc/gen_ndr/srv_winreg.h +++ b/source3/librpc/gen_ndr/srv_winreg.h @@ -10,7 +10,7 @@ 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_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); +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); WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); WERROR _winreg_FlushKey(pipes_struct *p, struct policy_handle *handle); WERROR _winreg_GetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index 6b028633c2..0a8833acb5 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -207,14 +207,14 @@ struct winreg_EnumKey { struct policy_handle *handle;/* [ref] */ uint32_t enum_index; struct winreg_StringBuf *name;/* [ref] */ - struct winreg_StringBuf *keyclass;/* [unique] */ - NTTIME *last_changed_time;/* [unique] */ + struct winreg_StringBuf **keyclass;/* [ref] */ + NTTIME **last_changed_time;/* [ref] */ } in; struct { struct winreg_StringBuf *name;/* [ref] */ - struct winreg_StringBuf *keyclass;/* [unique] */ - NTTIME *last_changed_time;/* [unique] */ + struct winreg_StringBuf **keyclass;/* [ref] */ + NTTIME **last_changed_time;/* [ref] */ WERROR result; } out; diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl index 3d0a956a89..51476fe75d 100644 --- a/source3/librpc/idl/winreg.idl +++ b/source3/librpc/idl/winreg.idl @@ -146,8 +146,8 @@ import "lsa.idl", "initshutdown.idl", "security.idl"; [in,ref] policy_handle *handle, [in] uint32 enum_index, [in,out,ref] winreg_StringBuf *name, - [in,out,unique] winreg_StringBuf *keyclass, - [in,out,unique] NTTIME *last_changed_time + [in,out,ref] winreg_StringBuf **keyclass, + [in,out,ref] NTTIME **last_changed_time ); typedef struct { diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index 2b7bd41a62..4138d1f1fc 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -574,7 +574,10 @@ WERROR _winreg_GetVersion(pipes_struct *p, struct policy_handle *handle, uint32_ Implementation of REG_ENUM_KEY ****************************************************************************/ -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) +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) { WERROR status = WERR_OK; struct regkey_info *info = find_regkey_info_by_hnd( p, handle ); @@ -613,10 +616,12 @@ WERROR _winreg_EnumKey(pipes_struct *p, struct policy_handle *handle, uint32_t e p->mem_ctx, info->subkey_cache->subkeys[enum_index]))) { status = WERR_NOMEM; } - if ( last_changed_time ) { - *last_changed_time = 0; + if ( *last_changed_time ) { + **last_changed_time = 0; + } + if ( *keyclass ) { + (*keyclass)->name = ""; } - keyclass->name = ""; return status; } |