diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-20 13:43:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:06 -0500 |
commit | 1052cadbae7bf71a0575b06e8ac7ff52c7fb95ee (patch) | |
tree | f4f5439a2e2d9efadabc96ae6c9b56e14acb8a17 /source3/librpc | |
parent | b45442e46d595337c17829aed2d846a8c8963e6e (diff) | |
download | samba-1052cadbae7bf71a0575b06e8ac7ff52c7fb95ee.tar.gz samba-1052cadbae7bf71a0575b06e8ac7ff52c7fb95ee.tar.bz2 samba-1052cadbae7bf71a0575b06e8ac7ff52c7fb95ee.zip |
r21462: Fix EnumValue (?)
(This used to be commit e73a418b5b0100936efb4c1133da3cfe3fcb61cd)
Diffstat (limited to 'source3/librpc')
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.c | 8 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.h | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_winreg.c | 163 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.c | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/winreg.h | 4 | ||||
-rw-r--r-- | source3/librpc/idl/winreg.idl | 2 |
6 files changed, 61 insertions, 120 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index c7eebe8ebf..9b25a6113b 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -340,7 +340,7 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t **data, uint32_t *size, uint32_t *length) +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length) { struct winreg_EnumValue r; NTSTATUS status; @@ -350,7 +350,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.enum_index = enum_index; r.in.name = name; r.in.type = type; - r.in.data = data; + r.in.value = value; r.in.size = size; r.in.length = length; @@ -375,8 +375,8 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct if ( type ) { *type = *r.out.type; } - if ( data ) { - *data = *r.out.data; + if ( value ) { + *value = *r.out.value; } if ( size ) { *size = *r.out.size; diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h index c269e38c2d..712f7cdfca 100644 --- a/source3/librpc/gen_ndr/cli_winreg.h +++ b/source3/librpc/gen_ndr/cli_winreg.h @@ -11,7 +11,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key); NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value); NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t **data, uint32_t *size, uint32_t *length); +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length); NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c index 7b500520f1..2168167de9 100644 --- a/source3/librpc/gen_ndr/ndr_winreg.c +++ b/source3/librpc/gen_ndr/ndr_winreg.c @@ -1468,7 +1468,6 @@ _PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *r) { - uint32_t cntr_data_1; if (flags & NDR_IN) { if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); @@ -1479,14 +1478,12 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct if (r->in.type) { NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data)); - if (r->in.data) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value)); + if (r->in.value) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); - for (cntr_data_1 = 0; cntr_data_1 < *r->in.length; cntr_data_1++) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data[cntr_data_1])); - } + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.value, *r->in.length)); } NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.size)); if (r->in.size) { @@ -1504,14 +1501,12 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct if (r->out.type) { NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data)); - if (r->out.data) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value)); + if (r->out.value) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); - for (cntr_data_1 = 0; cntr_data_1 < *r->out.length; cntr_data_1++) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data[cntr_data_1])); - } + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.value, *r->out.length)); } NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.size)); if (r->out.size) { @@ -1529,16 +1524,13 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r) { uint32_t _ptr_type; - uint32_t _ptr_data; - uint32_t cntr_data_1; + uint32_t _ptr_value; uint32_t _ptr_size; uint32_t _ptr_length; TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_name_0; TALLOC_CTX *_mem_save_type_0; - TALLOC_CTX *_mem_save_data_0; - TALLOC_CTX *_mem_save_data_1; - TALLOC_CTX *_mem_save_data_2; + TALLOC_CTX *_mem_save_value_0; TALLOC_CTX *_mem_save_size_0; TALLOC_CTX *_mem_save_length_0; if (flags & NDR_IN) { @@ -1571,33 +1563,23 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->in.data); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); + if (_ptr_value) { + NDR_PULL_ALLOC(ndr, r->in.value); } else { - r->in.data = NULL; - } - if (r->in.data) { - _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); - NDR_CHECK(ndr_pull_array_length(ndr, &r->in.data)); - if (ndr_get_array_length(ndr, &r->in.data) > ndr_get_array_size(ndr, &r->in.data)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.data), ndr_get_array_length(ndr, &r->in.data)); - } - NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); - _mem_save_data_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0); - for (cntr_data_1 = 0; cntr_data_1 < *r->in.length; cntr_data_1++) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->in.data[cntr_data_1]); - } else { - r->in.data[cntr_data_1] = NULL; - } + r->in.value = NULL; + } + if (r->in.value) { + _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.value, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.value)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.value)); + if (ndr_get_array_length(ndr, &r->in.value) > ndr_get_array_size(ndr, &r->in.value)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.value), ndr_get_array_length(ndr, &r->in.value)); } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, 0); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + NDR_PULL_ALLOC_N(ndr, r->in.value, ndr_get_array_size(ndr, &r->in.value)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.value, ndr_get_array_length(ndr, &r->in.value))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); } NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); if (_ptr_size) { @@ -1625,13 +1607,13 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre } NDR_PULL_ALLOC(ndr, r->out.name); *r->out.name = *r->in.name; - if (r->in.data) { + if (r->in.value) { if (r->in.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.size)); + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.value, *r->in.size)); } - if (r->in.data) { + if (r->in.value) { if (r->in.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.length)); + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.value, *r->in.length)); } } if (flags & NDR_OUT) { @@ -1654,33 +1636,23 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->out.data); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); + if (_ptr_value) { + NDR_PULL_ALLOC(ndr, r->out.value); } else { - r->out.data = NULL; - } - if (r->out.data) { - _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); - NDR_CHECK(ndr_pull_array_length(ndr, &r->out.data)); - if (ndr_get_array_length(ndr, &r->out.data) > ndr_get_array_size(ndr, &r->out.data)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.data), ndr_get_array_length(ndr, &r->out.data)); + r->out.value = NULL; + } + if (r->out.value) { + _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.value, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.value)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.value)); + if (ndr_get_array_length(ndr, &r->out.value) > ndr_get_array_size(ndr, &r->out.value)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.value), ndr_get_array_length(ndr, &r->out.value)); } - NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); - _mem_save_data_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0); - for (cntr_data_1 = 0; cntr_data_1 < *r->out.length; cntr_data_1++) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->out.data[cntr_data_1]); - } else { - r->out.data[cntr_data_1] = NULL; - } - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, 0); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + NDR_PULL_ALLOC_N(ndr, r->out.value, ndr_get_array_size(ndr, &r->out.value)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.value, ndr_get_array_length(ndr, &r->out.value))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); } NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); if (_ptr_size) { @@ -1707,13 +1679,13 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); } NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); - if (r->out.data) { + if (r->out.value) { if (r->out.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.size)); + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.value, *r->out.size)); } - if (r->out.data) { + if (r->out.value) { if (r->out.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.length)); + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.value, *r->out.length)); } } return NT_STATUS_OK; @@ -1721,7 +1693,6 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r) { - uint32_t cntr_data_1; ndr_print_struct(ndr, name, "winreg_EnumValue"); ndr->depth++; if (flags & NDR_SET_VALUES) { @@ -1745,26 +1716,11 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name ndr_print_winreg_Type(ndr, "type", *r->in.type); } ndr->depth--; - ndr_print_ptr(ndr, "data", r->in.data); + ndr_print_ptr(ndr, "value", r->in.value); ndr->depth++; - if (r->in.data) { + if (r->in.value) { if (r->in.length == NULL) return; - ndr->print(ndr, "%s: ARRAY(%d)", "data", *r->in.length); - ndr->depth++; - for (cntr_data_1=0;cntr_data_1<*r->in.length;cntr_data_1++) { - char *idx_1=NULL; - asprintf(&idx_1, "[%d]", cntr_data_1); - if (idx_1) { - ndr_print_ptr(ndr, "data", r->in.data[cntr_data_1]); - ndr->depth++; - if (r->in.data[cntr_data_1]) { - ndr_print_uint8(ndr, "data", *r->in.data[cntr_data_1]); - } - ndr->depth--; - free(idx_1); - } - } - ndr->depth--; + ndr_print_array_uint8(ndr, "value", r->in.value, *r->in.length); } ndr->depth--; ndr_print_ptr(ndr, "size", r->in.size); @@ -1794,26 +1750,11 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name ndr_print_winreg_Type(ndr, "type", *r->out.type); } ndr->depth--; - ndr_print_ptr(ndr, "data", r->out.data); + ndr_print_ptr(ndr, "value", r->out.value); ndr->depth++; - if (r->out.data) { + if (r->out.value) { if (r->out.length == NULL) return; - ndr->print(ndr, "%s: ARRAY(%d)", "data", *r->out.length); - ndr->depth++; - for (cntr_data_1=0;cntr_data_1<*r->out.length;cntr_data_1++) { - char *idx_1=NULL; - asprintf(&idx_1, "[%d]", cntr_data_1); - if (idx_1) { - ndr_print_ptr(ndr, "data", r->out.data[cntr_data_1]); - ndr->depth++; - if (r->out.data[cntr_data_1]) { - ndr_print_uint8(ndr, "data", *r->out.data[cntr_data_1]); - } - ndr->depth--; - free(idx_1); - } - } - ndr->depth--; + ndr_print_array_uint8(ndr, "value", r->out.value, *r->out.length); } ndr->depth--; ndr_print_ptr(ndr, "size", r->out.size); diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index ee0b110bd6..77b4c0ce58 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -728,7 +728,7 @@ static BOOL api_winreg_EnumValue(pipes_struct *p) ZERO_STRUCT(r.out); r.out.name = r.in.name; r.out.type = r.in.type; - r.out.data = r.in.data; + r.out.value = r.in.value; r.out.size = r.in.size; r.out.length = r.in.length; r.out.result = _winreg_EnumValue(p, &r); diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index 4420a60b12..0da4125b3a 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -260,7 +260,7 @@ struct winreg_EnumValue { uint32_t enum_index; struct winreg_ValNameBuf *name;/* [ref] */ enum winreg_Type *type;/* [unique] */ - uint8_t **data;/* [unique,length_is(*length),size_is(*size)] */ + uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */ uint32_t *size;/* [unique] */ uint32_t *length;/* [unique] */ } in; @@ -268,7 +268,7 @@ struct winreg_EnumValue { struct { struct winreg_ValNameBuf *name;/* [ref] */ enum winreg_Type *type;/* [unique] */ - uint8_t **data;/* [unique,length_is(*length),size_is(*size)] */ + uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */ uint32_t *size;/* [unique] */ uint32_t *length;/* [unique] */ WERROR result; diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl index 3fa7b7f601..a0d4323268 100644 --- a/source3/librpc/idl/winreg.idl +++ b/source3/librpc/idl/winreg.idl @@ -175,7 +175,7 @@ import "lsa.idl", "initshutdown.idl", "security.idl"; [in] uint32 enum_index, [in,out,ref] winreg_ValNameBuf *name, [in,out,unique] winreg_Type *type, - [in,out,unique,size_is(*size),length_is(*length)] uint8 **data, + [in,out,unique,size_is(*size),length_is(*length)] uint8 *value, [in,out,unique] uint32 *size, [in,out,unique] uint32 *length ); |