From c41944b9f9e6dc5287065b24ab1c1fc20ec36cb4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 10:36:49 +0100 Subject: spoolss.idl: improve idl for EnumPrinterData and not use 'lstring' any more metze (This used to be commit d6cdddbcf37d120cb365bc7f8188858c8776e2e0) --- source4/torture/rpc/spoolss.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 23b4aad30b..4a6ff480c4 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -1178,16 +1178,23 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip NTSTATUS status; struct spoolss_EnumPrinterData r; + ZERO_STRUCT(r); r.in.handle = handle; r.in.enum_index = 0; do { - uint32_t data_size; - - r.in.value_offered = 0; - data_size = 0; - r.in.data_size = &data_size; - r.out.data_size = &data_size; + uint32_t value_size = 0; + uint32_t data_size = 0; + uint32_t printerdata_type = 0; + DATA_BLOB data = data_blob(NULL,0); + + r.in.value_offered = value_size; + r.out.value_needed = &value_size; + r.in.data_offered = data_size; + r.out.data_needed = &data_size; + + r.out.printerdata_type = &printerdata_type; + r.out.buffer = &data; torture_comment(tctx, "Testing EnumPrinterData\n"); @@ -1195,7 +1202,8 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip torture_assert_ntstatus_ok(tctx, status, "EnumPrinterData failed"); - r.in.value_offered = r.out.value_needed; + r.in.value_offered = value_size; + r.in.data_offered = data_size; status = dcerpc_spoolss_EnumPrinterData(p, tctx, &r); -- cgit From a9d30b0d61a6a3363dc659c3e07ce1615c5e85df Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 14:52:53 +0100 Subject: torture/eventlog: fix crash bugs! This bug was introduced in 92b8bde561277a6b83048ce003cc29ff1b380255 and this shows that we need to be very, very careful in changing idl elements from scalars to [ref] pointers! metze (This used to be commit 3ec4bce0b64764e364aedea2800eed296805c51e) --- source4/torture/rpc/eventlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 047146edaf..4701fdfe4d 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -67,11 +67,14 @@ static bool test_GetNumRecords(struct torture_context *tctx, struct dcerpc_pipe struct eventlog_GetNumRecords r; struct eventlog_CloseEventLog cr; struct policy_handle handle; + uint32_t number = 0; if (!get_policy_handle(tctx, p, &handle)) return false; + ZERO_STRUCT(r); r.in.handle = &handle; + r.out.number = &number; torture_assert_ntstatus_ok(tctx, dcerpc_eventlog_GetNumRecords(p, tctx, &r), @@ -98,6 +101,7 @@ static bool test_ReadEventLog(struct torture_context *tctx, if (!get_policy_handle(tctx, p, &handle)) return false; + ZERO_STRUCT(r); r.in.offset = 0; r.in.handle = &handle; r.in.flags = EVENTLOG_BACKWARDS_READ|EVENTLOG_SEQUENTIAL_READ; @@ -107,11 +111,15 @@ static bool test_ReadEventLog(struct torture_context *tctx, struct eventlog_Record rec; struct ndr_pull *ndr; enum ndr_err_code ndr_err; + uint32_t sent_size = 0; + uint32_t real_size = 0; /* Read first for number of bytes in record */ r.in.number_of_bytes = 0; r.out.data = NULL; + r.out.sent_size = &sent_size; + r.out.real_size = &real_size; status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r); -- cgit From 60e205c34c4a28060f47ba1aa7c7592d33d302bc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 16:20:23 +0100 Subject: torture/eventlog: the NTSTATUS of dcerpc_ functions is the same as r.out.result metze (This used to be commit 0c5539e5fedd4123f61d50ee29acdc5a5f0faf76) --- source4/torture/rpc/eventlog.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c index 4701fdfe4d..feeeb9330b 100644 --- a/source4/torture/rpc/eventlog.c +++ b/source4/torture/rpc/eventlog.c @@ -127,8 +127,6 @@ static bool test_ReadEventLog(struct torture_context *tctx, break; } - torture_assert_ntstatus_ok(tctx, status, "ReadEventLog failed"); - torture_assert_ntstatus_equal(tctx, r.out.result, NT_STATUS_BUFFER_TOO_SMALL, "ReadEventLog failed"); -- cgit