summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_spoolss.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-20 16:34:00 +0100
committerGünther Deschner <gd@samba.org>2009-11-23 11:44:43 +0100
commitd464151f3b47c675664f464b1645ca85de663655 (patch)
tree45826328415c6d76e2a282658234c81bcf9b946d /source3/rpc_client/cli_spoolss.c
parent366946f29b58a6efa7acbfe2a74b2ddbad4d32a2 (diff)
downloadsamba-d464151f3b47c675664f464b1645ca85de663655.tar.gz
samba-d464151f3b47c675664f464b1645ca85de663655.tar.bz2
samba-d464151f3b47c675664f464b1645ca85de663655.zip
s3-spoolss: fix spoolss_EnumPrinterKey client and server code.
Guenther
Diffstat (limited to 'source3/rpc_client/cli_spoolss.c')
-rw-r--r--source3/rpc_client/cli_spoolss.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 02a0e168cb..2dba103069 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -810,27 +810,45 @@ WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
NTSTATUS status;
WERROR werror;
uint32_t needed;
+ uint16_t *buffer = NULL;
+
+ *key_buffer = NULL;
+
+ if (offered) {
+ buffer = talloc_array(mem_ctx, uint16_t, offered);
+ W_ERROR_HAVE_NO_MEMORY(buffer);
+ }
status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
handle,
key_name,
- key_buffer,
+ buffer,
offered,
&needed,
&werror);
if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
offered = needed;
-
+ buffer = talloc_realloc(mem_ctx, buffer, uint16_t, needed);
+ W_ERROR_HAVE_NO_MEMORY(buffer);
status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
handle,
key_name,
- key_buffer,
+ buffer,
offered,
&needed,
&werror);
}
+ if (W_ERROR_IS_OK(werror)) {
+ const char **array;
+ DATA_BLOB blob = data_blob_const((uint8_t *)buffer, offered);
+ if (!pull_reg_multi_sz(mem_ctx, &blob, &array)) {
+ return WERR_NOMEM;
+ }
+ *key_buffer = array;
+ }
+
return werror;
}