summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/spoolss.c19
-rw-r--r--source4/torture/rpc/spoolss_win.c19
2 files changed, 6 insertions, 32 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 396ed75d25..e341b71307 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3043,44 +3043,31 @@ bool test_printer_keys(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle)
{
- DATA_BLOB blob;
const char **key_array = NULL;
int i;
{
struct spoolss_EnumPrinterKey r;
uint32_t needed;
- uint16_t *key_buffer = talloc_zero_array(tctx, uint16_t, 0);
+ struct spoolss_StringArray2 key_buffer;
r.in.handle = handle;
r.in.key_name = "";
r.in.offered = 0;
- r.out.key_buffer = key_buffer;
+ r.out.key_buffer = &key_buffer;
r.out.needed = &needed;
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
r.in.offered = needed;
- key_buffer = talloc_zero_array(tctx, uint16_t, needed/2);
- r.out.key_buffer = key_buffer;
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
}
torture_assert_werr_ok(tctx, r.out.result,
"failed to call EnumPrinterKey");
- blob = data_blob_const(key_buffer, needed);
- }
-
- {
- union winreg_Data data;
- enum ndr_err_code ndr_err;
- 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");
- key_array = data.string_array;
+ key_array = key_buffer.string;
}
for (i=0; key_array[i]; i++) {
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index 3a3245df55..d2851cfea1 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -384,17 +384,15 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
NTSTATUS status;
struct spoolss_EnumPrinterKey epk;
uint32_t needed = 0;
- uint16_t *key_buffer;
+ struct spoolss_StringArray2 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");
@@ -402,8 +400,6 @@ 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");
@@ -411,16 +407,7 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
- {
- 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;
- }
+ ctx->printer_keys = key_buffer.string;
return true;
}