summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.c2
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.h2
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.c125
-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
6 files changed, 84 insertions, 53 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c
index 5ef93d3a92..688737082c 100644
--- a/source3/librpc/gen_ndr/cli_winreg.c
+++ b/source3/librpc/gen_ndr/cli_winreg.c
@@ -512,7 +512,7 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem
return werror_to_ntstatus(r.out.result);
}
-NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length)
+NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t **data, uint32_t *size, uint32_t *length)
{
struct winreg_QueryValue r;
NTSTATUS status;
diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h
index 041efd2b91..3981a7fe53 100644
--- a/source3/librpc/gen_ndr/cli_winreg.h
+++ b/source3/librpc/gen_ndr/cli_winreg.h
@@ -18,7 +18,7 @@ NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2);
NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle);
NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
-NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length);
+NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t **data, uint32_t *size, uint32_t *length);
NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c
index ca007bb449..c85aa57f02 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.c
+++ b/source3/librpc/gen_ndr/ndr_winreg.c
@@ -2272,6 +2272,7 @@ _PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *n
NTSTATUS ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *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));
@@ -2280,12 +2281,13 @@ NTSTATUS ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struc
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_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));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.length));
+ if (r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ 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++) {
+ if (r->in.data[cntr_data_1] == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_ref_ptr(ndr));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.size));
if (r->in.size) {
@@ -2301,12 +2303,13 @@ NTSTATUS ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struc
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_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));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.length));
+ if (r->out.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ 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++) {
+ if (r->out.data[cntr_data_1] == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_ref_ptr(ndr));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.size));
if (r->out.size) {
@@ -2325,11 +2328,13 @@ NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winr
{
uint32_t _ptr_type;
uint32_t _ptr_data;
+ uint32_t cntr_data_1;
uint32_t _ptr_size;
uint32_t _ptr_length;
TALLOC_CTX *_mem_save_handle_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_size_0;
TALLOC_CTX *_mem_save_length_0;
if (flags & NDR_IN) {
@@ -2355,24 +2360,24 @@ NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winr
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);
- } else {
- r->in.data = NULL;
+ 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));
}
- 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));
- }
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data));
- NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_length(ndr, &r->in.data)));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
}
+ memcpy(r->out.data,r->in.data,ndr_get_array_size(ndr, &r->in.data) * sizeof(*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_ref_ptr(ndr, &_ptr_data));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.data[cntr_data_1]);
+ }
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, 0);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size));
if (_ptr_size) {
NDR_PULL_ALLOC(ndr, r->in.size);
@@ -2397,6 +2402,9 @@ NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winr
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0);
}
+ if (r->in.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_PULL_ALLOC_N(ndr, r->out.data, *r->in.size);
+ memcpy(r->out.data, r->in.data, *r->in.size * sizeof(*r->in.data));
if (r->in.data) {
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));
@@ -2419,24 +2427,24 @@ NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winr
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);
- } else {
- r->out.data = NULL;
+ 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));
}
- 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));
- }
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data));
- NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_length(ndr, &r->out.data)));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
}
+ memcpy(r->out.data,r->in.data,ndr_get_array_size(ndr, &r->out.data) * sizeof(*r->in.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_ref_ptr(ndr, &_ptr_data));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.data[cntr_data_1]);
+ }
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, 0);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size));
if (_ptr_size) {
NDR_PULL_ALLOC(ndr, r->out.size);
@@ -2476,6 +2484,7 @@ NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winr
_PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r)
{
+ uint32_t cntr_data_1;
ndr_print_struct(ndr, name, "winreg_QueryValue");
ndr->depth++;
if (flags & NDR_SET_VALUES) {
@@ -2497,10 +2506,21 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr->depth--;
ndr_print_ptr(ndr, "data", r->in.data);
ndr->depth++;
- if (r->in.data) {
- ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.length);
+ 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++;
+ ndr_print_uint8(ndr, "data", *r->in.data[cntr_data_1]);
+ ndr->depth--;
+ free(idx_1);
+ }
}
ndr->depth--;
+ ndr->depth--;
ndr_print_ptr(ndr, "size", r->in.size);
ndr->depth++;
if (r->in.size) {
@@ -2526,10 +2546,21 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr->depth--;
ndr_print_ptr(ndr, "data", r->out.data);
ndr->depth++;
- if (r->out.data) {
- ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.length);
+ 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++;
+ ndr_print_uint8(ndr, "data", *r->out.data[cntr_data_1]);
+ ndr->depth--;
+ free(idx_1);
+ }
}
ndr->depth--;
+ ndr->depth--;
ndr_print_ptr(ndr, "size", r->out.size);
ndr->depth++;
if (r->out.size) {
diff --git a/source3/librpc/gen_ndr/srv_winreg.h b/source3/librpc/gen_ndr/srv_winreg.h
index 7fd3bfedd1..10a4b6e438 100644
--- a/source3/librpc/gen_ndr/srv_winreg.h
+++ b/source3/librpc/gen_ndr/srv_winreg.h
@@ -18,7 +18,7 @@ WERROR _winreg_LoadKey(pipes_struct *p, struct policy_handle *handle, struct win
WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2);
WERROR _winreg_OpenKey(pipes_struct *p, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle);
WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
-WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length);
+WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t **data, uint32_t *size, uint32_t *length);
WERROR _winreg_ReplaceKey(pipes_struct *p);
WERROR _winreg_RestoreKey(pipes_struct *p);
WERROR _winreg_SaveKey(pipes_struct *p);
diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h
index d895845243..a170dcd3c4 100644
--- a/source3/librpc/gen_ndr/winreg.h
+++ b/source3/librpc/gen_ndr/winreg.h
@@ -334,14 +334,14 @@ struct winreg_QueryValue {
struct policy_handle *handle;/* [ref] */
struct winreg_String value_name;
enum winreg_Type *type;/* [unique] */
- uint8_t *data;/* [unique,length_is(*length),size_is(*size)] */
+ uint8_t **data;/* [ref,length_is(*length),size_is(*size)] */
uint32_t *size;/* [unique] */
uint32_t *length;/* [unique] */
} in;
struct {
enum winreg_Type *type;/* [unique] */
- uint8_t *data;/* [unique,length_is(*length),size_is(*size)] */
+ uint8_t **data;/* [ref,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 03b034b38f..9c758b7c9d 100644
--- a/source3/librpc/idl/winreg.idl
+++ b/source3/librpc/idl/winreg.idl
@@ -226,7 +226,7 @@
[in,ref] policy_handle *handle,
[in] winreg_String value_name,
[in,out] winreg_Type *type,
- [in,out,size_is(*size),length_is(*length)] uint8 *data,
+ [in,out,ref,size_is(*size),length_is(*length)] uint8 **data,
[in,out] uint32 *size,
[in,out] uint32 *length
);