summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-02 14:25:31 +0100
committerGünther Deschner <gd@samba.org>2009-12-02 14:56:17 +0100
commit5f60855ba2eb822dcb867378ff09278c42931b89 (patch)
treee1d8ba7df8711f464e3c61a4adc7f41a7f146abe /source4/torture/rpc
parent292af4fc046ff39ebd3ec853c402dc267a863fa6 (diff)
downloadsamba-5f60855ba2eb822dcb867378ff09278c42931b89.tar.gz
samba-5f60855ba2eb822dcb867378ff09278c42931b89.tar.bz2
samba-5f60855ba2eb822dcb867378ff09278c42931b89.zip
samba-spoolss: use spoolss_StringArray2 in spoolss_EnumPrinterKey.
This should finally resolve the endian issues we were seeing on sparc and is much cleaner for spoolss clients and servers. Guenther
Diffstat (limited to 'source4/torture/rpc')
-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;
}