summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_spoolss.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-14 03:07:01 +0100
committerGünther Deschner <gd@samba.org>2009-02-25 11:16:28 +0100
commit6366084c4a7aa4845816cef6f1782e9d1c1f138c (patch)
tree4f09a84f6916c50af583c7b52187bddc42e709bf /source3/rpc_client/cli_spoolss.c
parent9e3178e8387cd85858a145bb4918073f91127d20 (diff)
downloadsamba-6366084c4a7aa4845816cef6f1782e9d1c1f138c.tar.gz
samba-6366084c4a7aa4845816cef6f1782e9d1c1f138c.tar.bz2
samba-6366084c4a7aa4845816cef6f1782e9d1c1f138c.zip
s3-spoolss: add rpccli_spoolss_getprinter convenience wrapper.
Guenther
Diffstat (limited to 'source3/rpc_client/cli_spoolss.c')
-rw-r--r--source3/rpc_client/cli_spoolss.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 20599d12b6..4fe05a5ff4 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -179,6 +179,55 @@ WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
return result;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetPrinter
+**********************************************************************/
+
+WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ uint32_t level,
+ uint32_t offered,
+ union spoolss_PrinterInfo *info)
+{
+ NTSTATUS status;
+ WERROR werror;
+ DATA_BLOB buffer;
+ uint32_t needed;
+
+ if (offered > 0) {
+ buffer = data_blob_talloc_zero(mem_ctx, offered);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+ }
+
+ status = rpccli_spoolss_GetPrinter(cli, mem_ctx,
+ handle,
+ 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, offered);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+
+ status = rpccli_spoolss_GetPrinter(cli, mem_ctx,
+ handle,
+ level,
+ &buffer,
+ offered,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
/*********************************************************************
Decode various spoolss rpc's and info levels
********************************************************************/
@@ -1401,5 +1450,4 @@ WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *me
return out.status;
}
-
/** @} **/