summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-07 22:22:42 +0100
committerGünther Deschner <gd@samba.org>2009-03-13 09:25:20 +0100
commit80284124ba6eca1ef70216dc9b4b3e4276208300 (patch)
tree5505b3153ca735fa4096af4a52dfc50d6bdc69fa /source3
parent427987d2bfae5bd0a259f87ff00e0d1f0a6e8802 (diff)
downloadsamba-80284124ba6eca1ef70216dc9b4b3e4276208300.tar.gz
samba-80284124ba6eca1ef70216dc9b4b3e4276208300.tar.bz2
samba-80284124ba6eca1ef70216dc9b4b3e4276208300.zip
s3-spoolss: add rpccli_spoolss_enumjobs convenience wrapper.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/rpc_client/cli_spoolss.c58
2 files changed, 67 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 40024c5194..eba3c14e71 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5506,6 +5506,15 @@ WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli,
uint32_t offered,
uint32_t *count,
union spoolss_MonitorInfo **info);
+WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ uint32_t firstjob,
+ uint32_t numjobs,
+ uint32_t level,
+ uint32_t offered,
+ uint32_t *count,
+ union spoolss_JobInfo **info);
WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
char *name, uint32 flags, uint32 level,
uint32 *num_printers, PRINTER_INFO_CTR *ctr);
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index a83b0c53c6..039b496b3e 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -540,6 +540,64 @@ WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli,
return werror;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_EnumJobs
+**********************************************************************/
+
+WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ uint32_t firstjob,
+ uint32_t numjobs,
+ uint32_t level,
+ uint32_t offered,
+ uint32_t *count,
+ union spoolss_JobInfo **info)
+{
+ NTSTATUS status;
+ WERROR werror;
+ uint32_t needed;
+ DATA_BLOB buffer;
+
+ if (offered > 0) {
+ buffer = data_blob_talloc_zero(mem_ctx, offered);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+ }
+
+ status = rpccli_spoolss_EnumJobs(cli, mem_ctx,
+ handle,
+ firstjob,
+ numjobs,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
+
+ if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
+ offered = needed;
+ buffer = data_blob_talloc_zero(mem_ctx, needed);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+
+ status = rpccli_spoolss_EnumJobs(cli, mem_ctx,
+ handle,
+ firstjob,
+ numjobs,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
+
/*********************************************************************
Decode various spoolss rpc's and info levels
********************************************************************/