From d419464d87127c9464d1a00976a36774835d196d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 28 Nov 2003 05:02:32 +0000 Subject: Added EnumJobs, GetJob, SetJob RPCs. (This used to be commit a06cbbbf1fa1e873bb13bc86d14694b2af791e22) --- source4/librpc/idl/spoolss.idl | 47 +++++++++++- source4/librpc/ndr/ndr_spoolss_buf.c | 17 +++++ source4/torture/rpc/spoolss.c | 137 +++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 3 deletions(-) diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl index 2d703721258..f8afdfd84e6 100644 --- a/source4/librpc/idl/spoolss.idl +++ b/source4/librpc/idl/spoolss.idl @@ -151,14 +151,55 @@ /******************/ /* Function: 0x02 */ - WERROR spoolss_02( + WERROR spoolss_SetJob( + [in,ref] policy_handle *handle, + [in] uint32 job_id, + [in] uint32 level, + [in] uint32 command ); /******************/ /* Function: 0x03 */ - WERROR spoolss_03( + WERROR spoolss_GetJob( + [in,ref] policy_handle *handle, + [in] uint32 job_id, + [in] uint32 level, + [in] DATA_BLOB *buffer, + [out,subcontext(4),switch_is(level)] spoolss_JobInfo *info, + [in,out,ref] uint32 *buf_size ); + typedef struct { + uint16 year; + uint16 month; + uint16 day_of_week; + uint16 day; + uint16 hour; + uint16 minute; + uint16 second; + uint16 millisecond; + } spoolss_Time; + + typedef struct { + uint32 job_id; + [relative] nstring printer_name; + [relative] nstring server_name; + [relative] nstring user_name; + [relative] nstring document_name; + [relative] nstring data_type; + [relative] nstring text_status; + uint32 status; + uint32 priority; + uint32 position; + uint32 total_pages; + uint32 pages_printed; + spoolss_Time time; + } spoolss_JobInfo1; + + typedef [nodiscriminant,public] union { + [case(1)] spoolss_JobInfo1 info1; + } spoolss_JobInfo; + /******************/ /* Function: 0x04 */ WERROR spoolss_EnumJobs( @@ -168,7 +209,7 @@ [in] uint32 level, [in,out] DATA_BLOB *buffer, [in,out,ref] uint32 *buf_size, - [out] uint32 numjobs + [out] uint32 count ); /******************/ diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c index 6c12ab2ae57..cd251112c0c 100644 --- a/source4/librpc/ndr/ndr_spoolss_buf.c +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -57,3 +57,20 @@ NTSTATUS pull_spoolss_FormInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, } return NT_STATUS_OK; } + +NTSTATUS pull_spoolss_JobInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + uint32 level, uint32 count, + union spoolss_JobInfo **info) +{ + int i; + struct ndr_pull *ndr; + ndr = ndr_pull_init_blob(blob, mem_ctx); + if (!ndr) { + return NT_STATUS_NO_MEMORY; + } + NDR_ALLOC_N(ndr, *info, count); + for (i=0;i