summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-23 13:35:32 +0100
committerKarolin Seeger <kseeger@samba.org>2009-11-26 11:41:13 +0100
commit1aa722b7a3bb72d471f822de9bf9a8facc070ab6 (patch)
tree94049ab4c9e3bc111637791082bb0c1cead8f844 /source4
parent3ad562cc66ec6128dcd9f3d36f8ef740aa9a4caa (diff)
downloadsamba-1aa722b7a3bb72d471f822de9bf9a8facc070ab6.tar.gz
s4-smbtorture: fix spoolss_EnumPrinterKey client in RPC-SPOOLSS-WIN.
Guenther (cherry picked from commit 0bf518c3c20cc6d86e574733730a266dc7ef2496)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/spoolss_win.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index 719d8e26d2a..df1a47d7ace 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -23,6 +23,7 @@
#include "torture/rpc/rpc.h"
#include "librpc/gen_ndr/ndr_spoolss_c.h"
#include "rpc_server/dcerpc_server.h"
+#include "librpc/gen_ndr/ndr_misc.h"
#include "ntvfs/ntvfs.h"
#include "param/param.h"
@@ -177,7 +178,7 @@ static bool test_GetPrinterData(struct torture_context *tctx,
if (W_ERROR_IS_OK(expected_werr)) {
torture_assert_int_equal(tctx, data.value,
expected_value,
- "GetPrinterData did not return expected value.");
+ talloc_asprintf(tctx, "GetPrinterData for %s did not return expected value.", value_name));
}
return true;
}
@@ -385,15 +386,17 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
NTSTATUS status;
struct spoolss_EnumPrinterKey epk;
uint32_t needed = 0;
- const char **key_buffer = NULL;
+ uint16_t *key_buffer;
torture_comment(tctx, "Testing EnumPrinterKey(%s)\n", key);
+ key_buffer = talloc_zero_array(tctx, uint16_t, 0);
+
epk.in.handle = handle;
epk.in.key_name = talloc_strdup(tctx, key);
epk.in.offered = 0;
epk.out.needed = &needed;
- epk.out.key_buffer = &key_buffer;
+ epk.out.key_buffer = key_buffer;
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status, "EnumPrinterKey failed");
@@ -401,6 +404,8 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
if (W_ERROR_EQUAL(epk.out.result, WERR_MORE_DATA)) {
epk.in.offered = needed;
+ key_buffer = talloc_zero_array(tctx, uint16_t, needed/2);
+ epk.out.key_buffer = key_buffer;
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status,
"EnumPrinterKey failed");
@@ -408,7 +413,16 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
- ctx->printer_keys = key_buffer;
+ {
+ union winreg_Data data;
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob = data_blob_const(key_buffer, needed);
+ ndr_err = ndr_pull_union_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx),
+ &data, REG_MULTI_SZ,
+ (ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
+ torture_assert_ndr_success(tctx, ndr_err, "failed to pull REG_MULTI_SZ");
+ ctx->printer_keys = data.string_array;
+ }
return true;
}