summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-26 15:33:57 +0100
committerGünther Deschner <gd@samba.org>2009-02-26 22:02:18 +0100
commit0445c554d1e112f3721e28072406bd4f63b6aefe (patch)
treea5b66cb639e7ccfac436c083fa290df7cfbc9542 /source3/rpc_client
parent417f920e0784cb62ebe5bee02cd5e8eb44bf34c8 (diff)
downloadsamba-0445c554d1e112f3721e28072406bd4f63b6aefe.tar.gz
samba-0445c554d1e112f3721e28072406bd4f63b6aefe.tar.bz2
samba-0445c554d1e112f3721e28072406bd4f63b6aefe.zip
s3-spoolss: add rpccli_spoolss_getjob convenience wrapper.
Guenther
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_spoolss.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 4c1d57e063..8626627308 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -228,6 +228,58 @@ WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
return werror;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetJob
+**********************************************************************/
+
+WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ uint32_t job_id,
+ uint32_t level,
+ uint32_t offered,
+ 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_GetJob(cli, mem_ctx,
+ handle,
+ job_id,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ 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_GetJob(cli, mem_ctx,
+ handle,
+ job_id,
+ level,
+ &buffer,
+ offered,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
+
/*********************************************************************
Decode various spoolss rpc's and info levels
********************************************************************/