diff options
author | Günther Deschner <gd@samba.org> | 2009-02-25 01:07:50 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-25 10:32:09 +0100 |
commit | 9d165fa5c69d3c98d1a76a155bb794a7e4c9744a (patch) | |
tree | 6f44b1f21b79bf5d30791c1c0c860d3656fdee76 /source3 | |
parent | 24a63add2d92afa0084fec956df7508ea28aab89 (diff) | |
download | samba-9d165fa5c69d3c98d1a76a155bb794a7e4c9744a.tar.gz samba-9d165fa5c69d3c98d1a76a155bb794a7e4c9744a.tar.bz2 samba-9d165fa5c69d3c98d1a76a155bb794a7e4c9744a.zip |
s3-spoolss: add rpccli_spoolss_addprinterex convenience wrapper.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/rpc_client/cli_spoolss.c | 42 |
2 files changed, 45 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 9366607995..5c9e5d3170 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5476,6 +5476,9 @@ WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli, union spoolss_DriverInfo *info, uint32_t *server_major_version, uint32_t *server_minor_version); +WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct spoolss_SetPrinterInfoCtr *info_ctr); 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 19e9aae0f8..20599d12b6 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -137,6 +137,48 @@ WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli, return werror; } +/********************************************************************** + convencience wrapper around rpccli_spoolss_AddPrinterEx +**********************************************************************/ + +WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct spoolss_SetPrinterInfoCtr *info_ctr) +{ + WERROR result; + NTSTATUS status; + struct spoolss_DevmodeContainer devmode_ctr; + struct sec_desc_buf secdesc_ctr; + struct spoolss_UserLevelCtr userlevel_ctr; + struct spoolss_UserLevel1 level1; + struct policy_handle handle; + + ZERO_STRUCT(devmode_ctr); + ZERO_STRUCT(secdesc_ctr); + + level1.size = 28; + level1.build = 1381; + level1.major = 2; + level1.minor = 0; + level1.processor = 0; + level1.client = talloc_asprintf(mem_ctx, "\\\\%s", global_myname()); + W_ERROR_HAVE_NO_MEMORY(level1.client); + level1.user = cli->auth->user_name; + + userlevel_ctr.level = 1; + userlevel_ctr.user_info.level1 = &level1; + + status = rpccli_spoolss_AddPrinterEx(cli, mem_ctx, + cli->srv_name_slash, + info_ctr, + &devmode_ctr, + &secdesc_ctr, + &userlevel_ctr, + &handle, + &result); + return result; +} + /********************************************************************* Decode various spoolss rpc's and info levels ********************************************************************/ |