summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-09 14:59:55 +0100
committerGünther Deschner <gd@samba.org>2009-03-13 09:25:22 +0100
commit5f465542286f2f6efb770e7ad385f07a46581326 (patch)
treea595b312a9be45b6d03fd72c68d20a23fdbb3291 /source3
parente605e4503cbf60560a4022b7cb095e1c8cdad0f4 (diff)
downloadsamba-5f465542286f2f6efb770e7ad385f07a46581326.tar.gz
samba-5f465542286f2f6efb770e7ad385f07a46581326.tar.bz2
samba-5f465542286f2f6efb770e7ad385f07a46581326.zip
s3-spoolss: add rpccli_spoolss_enumprinterdrivers convenience wrapper.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/rpc_client/cli_spoolss.c54
2 files changed, 62 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 088a55d673..1aa59cb9a8 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5515,6 +5515,14 @@ WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
uint32_t offered,
uint32_t *count,
union spoolss_JobInfo **info);
+WERROR rpccli_spoolss_enumprinterdrivers(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *environment,
+ uint32_t level,
+ uint32_t offered,
+ uint32_t *count,
+ union spoolss_DriverInfo **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 c8830acdf2..13ba499cdd 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -597,6 +597,60 @@ WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
return werror;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_EnumPrinterDrivers
+**********************************************************************/
+
+WERROR rpccli_spoolss_enumprinterdrivers(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *environment,
+ uint32_t level,
+ uint32_t offered,
+ uint32_t *count,
+ 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_EnumPrinterDrivers(cli, mem_ctx,
+ server,
+ 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_EnumPrinterDrivers(cli, mem_ctx,
+ server,
+ environment,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
/*********************************************************************
Decode various spoolss rpc's and info levels