summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-09 17:56:20 +0100
committerGünther Deschner <gd@samba.org>2009-02-10 11:04:53 +0100
commitb19b6aea1258de18eec6832199f2b736a930b095 (patch)
treeb0c771d19edf3e64a9157e1c58f37c71d49c7f09 /source3
parent25fc58afcd6051cd387a7114afadab2a85b98cfb (diff)
downloadsamba-b19b6aea1258de18eec6832199f2b736a930b095.tar.gz
samba-b19b6aea1258de18eec6832199f2b736a930b095.tar.bz2
samba-b19b6aea1258de18eec6832199f2b736a930b095.zip
s3-rpcclient: add rpccli_spoolss_openprinter_ex() convenience wrapper.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/rpc_client/cli_spoolss.c49
2 files changed, 54 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 849bed3b0b..db277ffa42 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5428,6 +5428,11 @@ NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
/* The following definitions come from rpc_client/cli_spoolss.c */
+WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *printername,
+ uint32_t access_desired,
+ struct policy_handle *handle);
WERROR rpccli_spoolss_open_printer_ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
const char *printername, const char *datatype, uint32 access_required,
const char *station, const char *username, POLICY_HND *pol);
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 1ad8b5dd61..780043aaab 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -25,6 +25,55 @@
#include "includes.h"
#include "rpc_client.h"
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_OpenPrinterEx
+**********************************************************************/
+
+WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *printername,
+ uint32_t access_desired,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ WERROR werror;
+ struct spoolss_DevmodeContainer devmode_ctr;
+ union spoolss_UserLevel userlevel;
+ struct spoolss_UserLevel1 level1;
+
+ ZERO_STRUCT(devmode_ctr);
+
+ level1.size = 28;
+ level1.client = cli->srv_name_slash;
+ level1.user = cli->auth->user_name;
+ level1.build = 1381;
+ level1.major = 2;
+ level1.minor = 0;
+ level1.processor = 0;
+
+ userlevel.level1 = &level1;
+
+ status = rpccli_spoolss_OpenPrinterEx(cli, mem_ctx,
+ printername,
+ NULL,
+ devmode_ctr,
+ access_desired,
+ 1, /* level */
+ userlevel,
+ handle,
+ &werror);
+
+ if (!W_ERROR_IS_OK(werror)) {
+ return werror;
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ return WERR_OK;
+}
+
/*********************************************************************
Decode various spoolss rpc's and info levels
********************************************************************/