summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_spoolss.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-06 22:09:47 +0100
committerGünther Deschner <gd@samba.org>2009-03-07 00:43:13 +0100
commitb73411d650d4d4bed99b75ffb36a1ab0dad9d4a8 (patch)
tree636009dbe0c462a8d44291db7fe2f34a58f46f87 /source3/rpc_client/cli_spoolss.c
parent066a47b9940b9ecc6a5c6d022444a17effac4855 (diff)
downloadsamba-b73411d650d4d4bed99b75ffb36a1ab0dad9d4a8.tar.gz
samba-b73411d650d4d4bed99b75ffb36a1ab0dad9d4a8.tar.bz2
samba-b73411d650d4d4bed99b75ffb36a1ab0dad9d4a8.zip
s3-spoolss: add rpccli_spoolss_enumprintprocessors convenience wrapper.
Guenther
Diffstat (limited to 'source3/rpc_client/cli_spoolss.c')
-rw-r--r--source3/rpc_client/cli_spoolss.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 5e09787a9c..664220ac19 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -330,6 +330,59 @@ WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli,
return werror;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_EnumPrintProcessors
+**********************************************************************/
+
+WERROR rpccli_spoolss_enumprintprocessors(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *servername,
+ const char *environment,
+ uint32_t level,
+ uint32_t offered,
+ uint32_t *count,
+ union spoolss_PrintProcessorInfo **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_EnumPrintProcessors(cli, mem_ctx,
+ servername,
+ environment,
+ 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_EnumPrintProcessors(cli, mem_ctx,
+ servername,
+ environment,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
/*********************************************************************
Decode various spoolss rpc's and info levels