diff options
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.c | 9 | ||||
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.h | 6 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.c | 136 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.h | 1 | ||||
-rw-r--r-- | librpc/gen_ndr/spoolss.h | 7 | ||||
-rw-r--r-- | librpc/gen_ndr/srv_spoolss.c | 15 |
6 files changed, 164 insertions, 10 deletions
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index e63a78195f..c6bb8ed6ad 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -12207,7 +12207,8 @@ struct tevent_req *rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, struct policy_handle *_handle /* [in] [ref] */, const char *_key_name /* [in] [charset(UTF16)] */, - struct spoolss_StringArray2 *_key_buffer /* [out] [ref] */, + uint32_t *__ndr_size /* [out] [ref] */, + union spoolss_KeyNames *_key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */, uint32_t _offered /* [in] */, uint32_t *_needed /* [out] [ref] */) { @@ -12229,6 +12230,7 @@ struct tevent_req *rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx, state->orig.in.offered = _offered; /* Out parameters */ + state->orig.out._ndr_size = __ndr_size; state->orig.out.key_buffer = _key_buffer; state->orig.out.needed = _needed; @@ -12278,6 +12280,7 @@ static void rpccli_spoolss_EnumPrinterKey_done(struct tevent_req *subreq) } /* Copy out parameters */ + *state->orig.out._ndr_size = *state->tmp.out._ndr_size; *state->orig.out.key_buffer = *state->tmp.out.key_buffer; *state->orig.out.needed = *state->tmp.out.needed; @@ -12317,7 +12320,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - struct spoolss_StringArray2 *key_buffer /* [out] [ref] */, + uint32_t *_ndr_size /* [out] [ref] */, + union spoolss_KeyNames *key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */, uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, WERROR *werror) @@ -12345,6 +12349,7 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, } /* Return variables */ + *_ndr_size = *r.out._ndr_size; *key_buffer = *r.out.key_buffer; *needed = *r.out.needed; diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index f2c1353628..cae24be225 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -1262,7 +1262,8 @@ struct tevent_req *rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, struct policy_handle *_handle /* [in] [ref] */, const char *_key_name /* [in] [charset(UTF16)] */, - struct spoolss_StringArray2 *_key_buffer /* [out] [ref] */, + uint32_t *__ndr_size /* [out] [ref] */, + union spoolss_KeyNames *_key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */, uint32_t _offered /* [in] */, uint32_t *_needed /* [out] [ref] */); NTSTATUS rpccli_spoolss_EnumPrinterKey_recv(struct tevent_req *req, @@ -1272,7 +1273,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - struct spoolss_StringArray2 *key_buffer /* [out] [ref] */, + uint32_t *_ndr_size /* [out] [ref] */, + union spoolss_KeyNames *key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */, uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, WERROR *werror); diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 9a72dd3ec2..997d647468 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -19613,6 +19613,105 @@ _PUBLIC_ size_t ndr_size_spoolss_PrinterEnumValues(const struct spoolss_PrinterE return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterEnumValues, ic); } +static enum ndr_err_code ndr_push_spoolss_KeyNames(struct ndr_push *ndr, int ndr_flags, const union spoolss_KeyNames *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_union_align(ndr, 4)); + switch (level) { + case 0: { + break; } + + case 1: { + break; } + + default: { + { + uint32_t _flags_save_string_array = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->string_array)); + ndr->flags = _flags_save_string_array; + } + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 0: + break; + + case 1: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_spoolss_KeyNames(struct ndr_pull *ndr, int ndr_flags, union spoolss_KeyNames *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_union_align(ndr, 4)); + switch (level) { + case 0: { + break; } + + case 1: { + break; } + + default: { + { + uint32_t _flags_save_string_array = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->string_array)); + ndr->flags = _flags_save_string_array; + } + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 0: + break; + + case 1: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_KeyNames(struct ndr_print *ndr, const char *name, const union spoolss_KeyNames *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "spoolss_KeyNames"); + switch (level) { + case 0: + break; + + case 1: + break; + + default: + ndr_print_string_array(ndr, "string_array", r->string_array); + break; + + } +} + _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); @@ -28139,10 +28238,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); } if (flags & NDR_OUT) { + if (r->out._ndr_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out._ndr_size)); if (r->out.key_buffer == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_spoolss_StringArray2(ndr, NDR_SCALARS, r->out.key_buffer)); + { + struct ndr_push *_ndr_key_buffer; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_key_buffer, 0, *r->out._ndr_size * 2)); + NDR_CHECK(ndr_push_set_switch_value(_ndr_key_buffer, r->out.key_buffer, *r->out._ndr_size)); + NDR_CHECK(ndr_push_spoolss_KeyNames(_ndr_key_buffer, NDR_SCALARS|NDR_BUFFERS, r->out.key_buffer)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_key_buffer, 0, *r->out._ndr_size * 2)); + } if (r->out.needed == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -28155,6 +28264,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr, _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterKey *r) { TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save__ndr_size_0; TALLOC_CTX *_mem_save_key_buffer_0; TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { @@ -28175,6 +28285,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr, NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t))); NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.key_name, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); + NDR_PULL_ALLOC(ndr, r->out._ndr_size); + ZERO_STRUCTP(r->out._ndr_size); NDR_PULL_ALLOC(ndr, r->out.key_buffer); ZERO_STRUCTP(r->out.key_buffer); NDR_PULL_ALLOC(ndr, r->out.needed); @@ -28182,11 +28294,24 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr, } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out._ndr_size); + } + _mem_save__ndr_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out._ndr_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out._ndr_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save__ndr_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.key_buffer); } _mem_save_key_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.key_buffer, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_spoolss_StringArray2(ndr, NDR_SCALARS, r->out.key_buffer)); + { + struct ndr_pull *_ndr_key_buffer; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_key_buffer, 0, *r->out._ndr_size * 2)); + NDR_CHECK(ndr_pull_set_switch_value(_ndr_key_buffer, r->out.key_buffer, *r->out._ndr_size)); + NDR_CHECK(ndr_pull_spoolss_KeyNames(_ndr_key_buffer, NDR_SCALARS|NDR_BUFFERS, r->out.key_buffer)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_key_buffer, 0, *r->out._ndr_size * 2)); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_buffer_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.needed); @@ -28221,9 +28346,14 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterKey(struct ndr_print *ndr, const char if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_EnumPrinterKey"); ndr->depth++; + ndr_print_ptr(ndr, "_ndr_size", r->out._ndr_size); + ndr->depth++; + ndr_print_uint32(ndr, "_ndr_size", *r->out._ndr_size); + ndr->depth--; ndr_print_ptr(ndr, "key_buffer", r->out.key_buffer); ndr->depth++; - ndr_print_spoolss_StringArray2(ndr, "key_buffer", r->out.key_buffer); + ndr_print_set_switch_value(ndr, r->out.key_buffer, *r->out._ndr_size); + ndr_print_spoolss_KeyNames(ndr, "key_buffer", r->out.key_buffer); ndr->depth--; ndr_print_ptr(ndr, "needed", r->out.needed); ndr->depth++; diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h index 1c31a95ef4..d2f1c1142d 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -525,6 +525,7 @@ enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct ndr_push *ndr, int n enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *ndr, int ndr_flags, struct spoolss_PrinterEnumValues *r); void ndr_print_spoolss_PrinterEnumValues(struct ndr_print *ndr, const char *name, const struct spoolss_PrinterEnumValues *r); size_t ndr_size_spoolss_PrinterEnumValues(const struct spoolss_PrinterEnumValues *r, struct smb_iconv_convenience *ic, int flags); +void ndr_print_spoolss_KeyNames(struct ndr_print *ndr, const char *name, const union spoolss_KeyNames *r); enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); enum ndr_err_code ndr_pull_spoolss_DeleteDriverFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); void ndr_print_spoolss_DeleteDriverFlags(struct ndr_print *ndr, const char *name, uint32_t r); diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index 2f2e8f25d6..e7b78d01f7 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -2058,6 +2058,10 @@ struct spoolss_PrinterEnumValues { uint32_t data_length;/* [value(ndr_size_spoolss_PrinterData(data,type,ndr->iconv_convenience,ndr->flags))] */ }/* [relative_base,gensize,public] */; +union spoolss_KeyNames { + const char ** string_array;/* [default,flag(LIBNDR_FLAG_STR_NULLTERM)] */ +}/* [nodiscriminant] */; + /* bitmap spoolss_DeleteDriverFlags */ #define DPD_DELETE_UNUSED_FILES ( 0x00000001 ) #define DPD_DELETE_SPECIFIC_VERSION ( 0x00000002 ) @@ -3620,7 +3624,8 @@ struct spoolss_EnumPrinterKey { } in; struct { - struct spoolss_StringArray2 *key_buffer;/* [ref] */ + uint32_t *_ndr_size;/* [ref] */ + union spoolss_KeyNames *key_buffer;/* [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */ uint32_t *needed;/* [ref] */ WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index bc50c0bb5f..cc11d122be 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -6325,7 +6325,13 @@ static bool api_spoolss_EnumPrinterKey(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.key_buffer = talloc_zero(r, struct spoolss_StringArray2); + r->out._ndr_size = talloc_zero(r, uint32_t); + if (r->out._ndr_size == NULL) { + talloc_free(r); + return false; + } + + r->out.key_buffer = talloc_zero(r, union spoolss_KeyNames); if (r->out.key_buffer == NULL) { talloc_free(r); return false; @@ -9504,7 +9510,12 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_ENUMPRINTERKEY: { struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r; ZERO_STRUCT(r->out); - r->out.key_buffer = talloc_zero(mem_ctx, struct spoolss_StringArray2); + r->out._ndr_size = talloc_zero(mem_ctx, uint32_t); + if (r->out._ndr_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.key_buffer = talloc_zero(mem_ctx, union spoolss_KeyNames); if (r->out.key_buffer == NULL) { return NT_STATUS_NO_MEMORY; } |