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

r21462: Fix EnumValue (?)

This commit is contained in:
Jelmer Vernooij 2007-02-20 13:43:41 +00:00 committed by Gerald (Jerry) Carter
parent e7e6b8b5e0
commit e73a418b5b
9 changed files with 63 additions and 124 deletions

View File

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

View File

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

View File

@ -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;
r->in.value = 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));
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_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;
}
}
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;
r->out.value = 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));
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);

View File

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

View File

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

View File

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

View File

@ -74,6 +74,3 @@ uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val )
return real_size;
}

View File

@ -444,7 +444,7 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r)
*r->out.type = val->type;
}
if (r->out.data != NULL) {
if (r->out.value != NULL) {
if ((r->out.size == NULL) || (r->out.length == NULL)) {
return WERR_INVALID_PARAM;
}
@ -453,7 +453,7 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r)
return WERR_MORE_DATA;
}
memcpy( r->out.data, value_blob.data, value_blob.length );
memcpy( r->out.value, value_blob.data, value_blob.length );
}
if (r->out.length != NULL) {

View File

@ -263,11 +263,12 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx,
name_buf.size = max_valnamelen + 2;
data_size = max_valbufsize;
data = TALLOC(mem_ctx, data_size);
value_length = 0;
status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, key_hnd,
i, &name_buf, &type,
&data, &data_size,
data, &data_size,
&value_length );
if ( W_ERROR_EQUAL(ntstatus_to_werror(status),