diff options
author | Günther Deschner <gd@samba.org> | 2009-03-07 00:10:15 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-03-07 00:55:39 +0100 |
commit | 33a441b0c223bc87abdac9dcc8a87dbf13e883f5 (patch) | |
tree | 065df7433fec7c6b5b12ee1df731e8ed530a655f /source3/rpc_client/cli_spoolss.c | |
parent | d8a05bd55dd0e1602082376f31a21045a4a7bbee (diff) | |
download | samba-33a441b0c223bc87abdac9dcc8a87dbf13e883f5.tar.gz samba-33a441b0c223bc87abdac9dcc8a87dbf13e883f5.tar.bz2 samba-33a441b0c223bc87abdac9dcc8a87dbf13e883f5.zip |
s3-spoolss: add rpccli_spoolss_enummonitors convenience wrapper.
Guenther
Diffstat (limited to 'source3/rpc_client/cli_spoolss.c')
-rw-r--r-- | source3/rpc_client/cli_spoolss.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index 99ec98da8a..a83b0c53c6 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -489,6 +489,57 @@ WERROR rpccli_spoolss_enumports(struct rpc_pipe_client *cli, return werror; } +/********************************************************************** + convencience wrapper around rpccli_spoolss_EnumMonitors +**********************************************************************/ + +WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + uint32_t level, + uint32_t offered, + uint32_t *count, + union spoolss_MonitorInfo **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_EnumMonitors(cli, mem_ctx, + servername, + 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_EnumMonitors(cli, mem_ctx, + servername, + level, + (offered > 0) ? &buffer : NULL, + offered, + count, + info, + &needed, + &werror); + } + + return werror; +} + /********************************************************************* Decode various spoolss rpc's and info levels ********************************************************************/ |