diff options
Diffstat (limited to 'librpc/gen_ndr')
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.c | 17 | ||||
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.h | 7 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.c | 119 | ||||
-rw-r--r-- | librpc/gen_ndr/spoolss.h | 14 | ||||
-rw-r--r-- | librpc/gen_ndr/srv_spoolss.c | 15 |
5 files changed, 172 insertions, 0 deletions
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index 3a6b53f6af..fbbbfd44f8 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -1190,12 +1190,21 @@ NTSTATUS rpccli_spoolss_EndDocPrinter(struct rpc_pipe_client *cli, NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + uint32_t level /* [in] */, + uint8_t *buffer /* [in,out] [unique,size_is(offered)] */, + uint32_t offered /* [in] */, + uint32_t *needed /* [out] [ref] */, WERROR *werror) { struct spoolss_AddJob r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.level = level; + r.in.buffer = buffer; + r.in.offered = offered; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(spoolss_AddJob, &r); @@ -1220,6 +1229,10 @@ NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli, } /* Return variables */ + if (buffer && r.out.buffer) { + memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer)); + } + *needed = *r.out.needed; /* Return result */ if (werror) { @@ -1231,12 +1244,16 @@ NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli, NTSTATUS rpccli_spoolss_ScheduleJob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + uint32_t jobid /* [in] */, WERROR *werror) { struct spoolss_ScheduleJob r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.jobid = jobid; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, &r); diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index 2447f18025..852f53d79f 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -167,9 +167,16 @@ NTSTATUS rpccli_spoolss_EndDocPrinter(struct rpc_pipe_client *cli, WERROR *werror); NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + uint32_t level /* [in] */, + uint8_t *buffer /* [in,out] [unique,size_is(offered)] */, + uint32_t offered /* [in] */, + uint32_t *needed /* [out] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_ScheduleJob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + uint32_t jobid /* [in] */, WERROR *werror); NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 8c23069be6..8cc99574c9 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -11665,8 +11665,28 @@ _PUBLIC_ void ndr_print_spoolss_EndDocPrinter(struct ndr_print *ndr, const char static enum ndr_err_code ndr_push_spoolss_AddJob(struct ndr_push *ndr, int flags, const struct spoolss_AddJob *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.buffer)); + if (r->in.buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.buffer, r->in.offered)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); } if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.buffer)); + if (r->out.buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, r->in.offered)); + } + if (r->out.needed == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.needed)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -11674,10 +11694,68 @@ static enum ndr_err_code ndr_push_spoolss_AddJob(struct ndr_push *ndr, int flags static enum ndr_err_code ndr_pull_spoolss_AddJob(struct ndr_pull *ndr, int flags, struct spoolss_AddJob *r) { + uint32_t _ptr_buffer; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_buffer_0; + TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->in.buffer); + } else { + r->in.buffer = NULL; + } + if (r->in.buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer)); + NDR_PULL_ALLOC_N(ndr, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); + NDR_PULL_ALLOC(ndr, r->out.needed); + ZERO_STRUCTP(r->out.needed); + if (r->in.buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.buffer, r->in.offered)); + } } if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->out.buffer); + } else { + r->out.buffer = NULL; + } + if (r->out.buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer)); + NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.needed); + } + _mem_save_needed_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.needed, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.needed)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, r->in.offered)); + } } return NDR_ERR_SUCCESS; } @@ -11692,11 +11770,33 @@ _PUBLIC_ void ndr_print_spoolss_AddJob(struct ndr_print *ndr, const char *name, if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "spoolss_AddJob"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "buffer", r->in.buffer); + ndr->depth++; + if (r->in.buffer) { + ndr_print_array_uint8(ndr, "buffer", r->in.buffer, r->in.offered); + } + ndr->depth--; + ndr_print_uint32(ndr, "offered", r->in.offered); ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_AddJob"); ndr->depth++; + ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr->depth++; + if (r->out.buffer) { + ndr_print_array_uint8(ndr, "buffer", r->out.buffer, r->in.offered); + } + ndr->depth--; + ndr_print_ptr(ndr, "needed", r->out.needed); + ndr->depth++; + ndr_print_uint32(ndr, "needed", *r->out.needed); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -11706,6 +11806,11 @@ _PUBLIC_ void ndr_print_spoolss_AddJob(struct ndr_print *ndr, const char *name, static enum ndr_err_code ndr_push_spoolss_ScheduleJob(struct ndr_push *ndr, int flags, const struct spoolss_ScheduleJob *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.jobid)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); @@ -11715,7 +11820,16 @@ static enum ndr_err_code ndr_push_spoolss_ScheduleJob(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_spoolss_ScheduleJob(struct ndr_pull *ndr, int flags, struct spoolss_ScheduleJob *r) { + TALLOC_CTX *_mem_save_handle_0; if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.jobid)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); @@ -11733,6 +11847,11 @@ _PUBLIC_ void ndr_print_spoolss_ScheduleJob(struct ndr_print *ndr, const char *n if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "spoolss_ScheduleJob"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_uint32(ndr, "jobid", r->in.jobid); ndr->depth--; } if (flags & NDR_OUT) { diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index 33f6042bd8..5934cfa033 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -1259,6 +1259,15 @@ struct spoolss_EndDocPrinter { struct spoolss_AddJob { struct { + struct policy_handle *handle;/* [ref] */ + uint32_t level; + uint32_t offered; + uint8_t *buffer;/* [unique,size_is(offered)] */ + } in; + + struct { + uint32_t *needed;/* [ref] */ + uint8_t *buffer;/* [unique,size_is(offered)] */ WERROR result; } out; @@ -1267,6 +1276,11 @@ struct spoolss_AddJob { struct spoolss_ScheduleJob { struct { + struct policy_handle *handle;/* [ref] */ + uint32_t jobid; + } in; + + struct { WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index 64af1c4a16..c6f5d62b32 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -1921,6 +1921,14 @@ static bool api_spoolss_AddJob(pipes_struct *p) NDR_PRINT_IN_DEBUG(spoolss_AddJob, r); } + ZERO_STRUCT(r->out); + r->out.buffer = r->in.buffer; + r->out.needed = talloc_zero(r, uint32_t); + if (r->out.needed == NULL) { + talloc_free(r); + return false; + } + r->out.result = _spoolss_AddJob(p, r); if (p->rng_fault_state) { @@ -7718,6 +7726,13 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_ADDJOB: { struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r; + ZERO_STRUCT(r->out); + r->out.buffer = r->in.buffer; + r->out.needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + r->out.result = _spoolss_AddJob(cli->pipes_struct, r); return NT_STATUS_OK; } |