mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
parent
9a1881598c
commit
5607259306
@ -476,12 +476,17 @@ NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli,
|
|||||||
|
|
||||||
NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
|
NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
|
||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
|
const char *devicename,
|
||||||
|
uint32_t *size,
|
||||||
|
uint32_t flags,
|
||||||
WERROR *werror)
|
WERROR *werror)
|
||||||
{
|
{
|
||||||
struct PNP_GetDeviceListSize r;
|
struct PNP_GetDeviceListSize r;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
/* In parameters */
|
/* In parameters */
|
||||||
|
r.in.devicename = devicename;
|
||||||
|
r.in.flags = flags;
|
||||||
|
|
||||||
if (DEBUGLEVEL >= 10) {
|
if (DEBUGLEVEL >= 10) {
|
||||||
NDR_PRINT_IN_DEBUG(PNP_GetDeviceListSize, &r);
|
NDR_PRINT_IN_DEBUG(PNP_GetDeviceListSize, &r);
|
||||||
@ -507,6 +512,7 @@ NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return variables */
|
/* Return variables */
|
||||||
|
*size = *r.out.size;
|
||||||
|
|
||||||
/* Return result */
|
/* Return result */
|
||||||
if (werror) {
|
if (werror) {
|
||||||
|
@ -39,6 +39,9 @@ NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli,
|
|||||||
WERROR *werror);
|
WERROR *werror);
|
||||||
NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
|
NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
|
||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
|
const char *devicename,
|
||||||
|
uint32_t *size,
|
||||||
|
uint32_t flags,
|
||||||
WERROR *werror);
|
WERROR *werror);
|
||||||
NTSTATUS rpccli_PNP_GetDepth(struct rpc_pipe_client *cli,
|
NTSTATUS rpccli_PNP_GetDepth(struct rpc_pipe_client *cli,
|
||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
|
@ -498,8 +498,20 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *nam
|
|||||||
static enum ndr_err_code ndr_push_PNP_GetDeviceListSize(struct ndr_push *ndr, int flags, const struct PNP_GetDeviceListSize *r)
|
static enum ndr_err_code ndr_push_PNP_GetDeviceListSize(struct ndr_push *ndr, int flags, const struct PNP_GetDeviceListSize *r)
|
||||||
{
|
{
|
||||||
if (flags & NDR_IN) {
|
if (flags & NDR_IN) {
|
||||||
|
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.devicename));
|
||||||
|
if (r->in.devicename) {
|
||||||
|
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicename, CH_UTF16)));
|
||||||
|
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
|
||||||
|
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicename, CH_UTF16)));
|
||||||
|
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.devicename, ndr_charset_length(r->in.devicename, CH_UTF16), sizeof(uint16_t), CH_UTF16));
|
||||||
|
}
|
||||||
|
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
|
||||||
}
|
}
|
||||||
if (flags & NDR_OUT) {
|
if (flags & NDR_OUT) {
|
||||||
|
if (r->out.size == NULL) {
|
||||||
|
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
|
||||||
|
}
|
||||||
|
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size));
|
||||||
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
|
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
|
||||||
}
|
}
|
||||||
return NDR_ERR_SUCCESS;
|
return NDR_ERR_SUCCESS;
|
||||||
@ -507,9 +519,42 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceListSize(struct ndr_push *ndr, in
|
|||||||
|
|
||||||
static enum ndr_err_code ndr_pull_PNP_GetDeviceListSize(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceListSize *r)
|
static enum ndr_err_code ndr_pull_PNP_GetDeviceListSize(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceListSize *r)
|
||||||
{
|
{
|
||||||
|
uint32_t _ptr_devicename;
|
||||||
|
TALLOC_CTX *_mem_save_devicename_0;
|
||||||
|
TALLOC_CTX *_mem_save_size_0;
|
||||||
if (flags & NDR_IN) {
|
if (flags & NDR_IN) {
|
||||||
|
ZERO_STRUCT(r->out);
|
||||||
|
|
||||||
|
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devicename));
|
||||||
|
if (_ptr_devicename) {
|
||||||
|
NDR_PULL_ALLOC(ndr, r->in.devicename);
|
||||||
|
} else {
|
||||||
|
r->in.devicename = NULL;
|
||||||
|
}
|
||||||
|
if (r->in.devicename) {
|
||||||
|
_mem_save_devicename_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
||||||
|
NDR_PULL_SET_MEM_CTX(ndr, r->in.devicename, 0);
|
||||||
|
NDR_CHECK(ndr_pull_array_size(ndr, &r->in.devicename));
|
||||||
|
NDR_CHECK(ndr_pull_array_length(ndr, &r->in.devicename));
|
||||||
|
if (ndr_get_array_length(ndr, &r->in.devicename) > ndr_get_array_size(ndr, &r->in.devicename)) {
|
||||||
|
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.devicename), ndr_get_array_length(ndr, &r->in.devicename));
|
||||||
|
}
|
||||||
|
NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.devicename), sizeof(uint16_t)));
|
||||||
|
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.devicename, ndr_get_array_length(ndr, &r->in.devicename), sizeof(uint16_t), CH_UTF16));
|
||||||
|
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devicename_0, 0);
|
||||||
|
}
|
||||||
|
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
|
||||||
|
NDR_PULL_ALLOC(ndr, r->out.size);
|
||||||
|
ZERO_STRUCTP(r->out.size);
|
||||||
}
|
}
|
||||||
if (flags & NDR_OUT) {
|
if (flags & NDR_OUT) {
|
||||||
|
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
|
||||||
|
NDR_PULL_ALLOC(ndr, r->out.size);
|
||||||
|
}
|
||||||
|
_mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
||||||
|
NDR_PULL_SET_MEM_CTX(ndr, r->out.size, LIBNDR_FLAG_REF_ALLOC);
|
||||||
|
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.size));
|
||||||
|
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, LIBNDR_FLAG_REF_ALLOC);
|
||||||
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
|
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
|
||||||
}
|
}
|
||||||
return NDR_ERR_SUCCESS;
|
return NDR_ERR_SUCCESS;
|
||||||
@ -525,11 +570,22 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceListSize(struct ndr_print *ndr, const char
|
|||||||
if (flags & NDR_IN) {
|
if (flags & NDR_IN) {
|
||||||
ndr_print_struct(ndr, "in", "PNP_GetDeviceListSize");
|
ndr_print_struct(ndr, "in", "PNP_GetDeviceListSize");
|
||||||
ndr->depth++;
|
ndr->depth++;
|
||||||
|
ndr_print_ptr(ndr, "devicename", r->in.devicename);
|
||||||
|
ndr->depth++;
|
||||||
|
if (r->in.devicename) {
|
||||||
|
ndr_print_string(ndr, "devicename", r->in.devicename);
|
||||||
|
}
|
||||||
|
ndr->depth--;
|
||||||
|
ndr_print_uint32(ndr, "flags", r->in.flags);
|
||||||
ndr->depth--;
|
ndr->depth--;
|
||||||
}
|
}
|
||||||
if (flags & NDR_OUT) {
|
if (flags & NDR_OUT) {
|
||||||
ndr_print_struct(ndr, "out", "PNP_GetDeviceListSize");
|
ndr_print_struct(ndr, "out", "PNP_GetDeviceListSize");
|
||||||
ndr->depth++;
|
ndr->depth++;
|
||||||
|
ndr_print_ptr(ndr, "size", r->out.size);
|
||||||
|
ndr->depth++;
|
||||||
|
ndr_print_uint32(ndr, "size", *r->out.size);
|
||||||
|
ndr->depth--;
|
||||||
ndr_print_WERROR(ndr, "result", r->out.result);
|
ndr_print_WERROR(ndr, "result", r->out.result);
|
||||||
ndr->depth--;
|
ndr->depth--;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,12 @@ struct PNP_GetDeviceList {
|
|||||||
|
|
||||||
struct PNP_GetDeviceListSize {
|
struct PNP_GetDeviceListSize {
|
||||||
struct {
|
struct {
|
||||||
|
const char *devicename;/* [unique,charset(UTF16)] */
|
||||||
|
uint32_t flags;
|
||||||
|
} in;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
uint32_t *size;/* [ref] */
|
||||||
WERROR result;
|
WERROR result;
|
||||||
} out;
|
} out;
|
||||||
|
|
||||||
|
@ -854,6 +854,13 @@ static bool api_PNP_GetDeviceListSize(pipes_struct *p)
|
|||||||
NDR_PRINT_IN_DEBUG(PNP_GetDeviceListSize, r);
|
NDR_PRINT_IN_DEBUG(PNP_GetDeviceListSize, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZERO_STRUCT(r->out);
|
||||||
|
r->out.size = talloc_zero(r, uint32_t);
|
||||||
|
if (r->out.size == NULL) {
|
||||||
|
talloc_free(r);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
r->out.result = _PNP_GetDeviceListSize(p, r);
|
r->out.result = _PNP_GetDeviceListSize(p, r);
|
||||||
|
|
||||||
if (p->rng_fault_state) {
|
if (p->rng_fault_state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user