From 86c25b353381179ee392841618c9ae34dca1d992 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 16 Mar 2009 21:41:11 +0100 Subject: s3-spoolss: add rpccli_spoolss_enumprinterkey convenience wrapper. Guenther --- source3/include/proto.h | 6 ++++++ source3/rpc_client/cli_spoolss.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index e73237daff..4b95822263 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5540,6 +5540,12 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, uint32_t offered, enum winreg_Type *type, union spoolss_PrinterData *data); +WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *key_name, + const char ***key_buffer, + uint32_t offered); WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, POLICY_HND *hnd, const char *keyname, REGVAL_CTR *ctr); diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index 66e760c6f3..696fcd1058 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -746,6 +746,45 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, return werror; } +/********************************************************************** + convencience wrapper around rpccli_spoolss_EnumPrinterKey +**********************************************************************/ + +WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *key_name, + const char ***key_buffer, + uint32_t offered) +{ + NTSTATUS status; + WERROR werror; + uint32_t needed; + + status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx, + handle, + key_name, + key_buffer, + offered, + &needed, + &werror); + + if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) { + offered = needed; + + status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx, + handle, + key_name, + key_buffer, + offered, + &needed, + &werror); + } + + return werror; +} + + /********************************************************************* Decode various spoolss rpc's and info levels ********************************************************************/ -- cgit