summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-07-03 18:39:58 +0200
committerGünther Deschner <gd@samba.org>2009-07-03 22:05:46 +0200
commit1225d57abe6c04805479138a620748653f7e2bcf (patch)
tree5e9b97368a57af8699626c9ded5e69be606995f1 /source3/rpc_client
parentcb39ba3d40841097c513358e7bac361aa7e38a9c (diff)
downloadsamba-1225d57abe6c04805479138a620748653f7e2bcf.tar.gz
samba-1225d57abe6c04805479138a620748653f7e2bcf.tar.bz2
samba-1225d57abe6c04805479138a620748653f7e2bcf.zip
s3-spoolss: add rpccli_spoolss_getprinterdriver convenience wrapper.
Guenther
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_spoolss.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 3f369bdab3..02a0e168cb 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -76,6 +76,56 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
}
/**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetPrinterDriver
+**********************************************************************/
+
+WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ const char *architecture,
+ uint32_t level,
+ uint32_t offered,
+ union spoolss_DriverInfo *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_GetPrinterDriver(cli, mem_ctx,
+ handle,
+ architecture,
+ 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_GetPrinterDriver(cli, mem_ctx,
+ handle,
+ architecture,
+ level,
+ &buffer,
+ offered,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
+/**********************************************************************
convencience wrapper around rpccli_spoolss_GetPrinterDriver2
**********************************************************************/