summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/eventlog.c5
-rw-r--r--source4/torture/rpc/spoolss_win.c18
-rw-r--r--source4/torture/rpc/svcctl.c44
3 files changed, 40 insertions, 27 deletions
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index 10c4886259..865b4e2217 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -203,7 +203,6 @@ static bool test_ReadEventLog(struct torture_context *tctx,
static bool test_ReportEventLog(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
- NTSTATUS status;
struct eventlog_ReportEventW r;
struct eventlog_CloseEventLog cr;
struct policy_handle handle;
@@ -237,7 +236,9 @@ static bool test_ReportEventLog(struct torture_context *tctx,
r.out.record_number = &record_number;
r.out.time_written = &time_written;
- status = dcerpc_eventlog_ReportEventW(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_eventlog_ReportEventW(p, tctx, &r),
+ "ReportEventW failed");
torture_assert_ntstatus_ok(tctx, r.out.result, "ReportEventW failed");
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index c50cbfbaee..42b6929557 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -34,6 +34,8 @@ struct test_spoolss_win_context {
/* EnumPrinterKeys */
const char **printer_keys;
+
+ bool printer_has_driver;
};
/* This is a convenience function for all OpenPrinterEx calls */
@@ -256,6 +258,12 @@ static bool test_GetPrinter(struct torture_context *tctx,
torture_assert_werr_ok(tctx, gp.out.result, "GetPrinter failed");
ctx->current_info = gp.out.info;
+
+ if (level == 2 && gp.out.info) {
+ ctx->printer_has_driver = gp.out.info->info2.drivername &&
+ strlen(gp.out.info->info2.drivername);
+ }
+
return true;
}
@@ -289,6 +297,7 @@ static bool test_EnumJobs(struct torture_context *tctx,
static bool test_GetPrinterDriver2(struct torture_context *tctx,
struct dcerpc_pipe *p,
+ struct test_spoolss_win_context *ctx,
struct policy_handle *handle)
{
NTSTATUS status;
@@ -313,8 +322,11 @@ static bool test_GetPrinterDriver2(struct torture_context *tctx,
status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &gpd2);
torture_assert_ntstatus_ok(tctx, status, "GetPrinterDriver2 failed");
- torture_assert_werr_ok(tctx, gpd2.out.result,
- "GetPrinterDriver2 failed.");
+
+ if (ctx->printer_has_driver) {
+ torture_assert_werr_ok(tctx, gpd2.out.result,
+ "GetPrinterDriver2 failed.");
+ }
return true;
}
@@ -527,7 +539,7 @@ static bool test_WinXP(struct torture_context *tctx, struct dcerpc_pipe *p)
ret &= test_ClosePrinter(tctx, p, &handle04);
ret &= test_EnumPrinters(tctx, p, ctx, 1556);
- ret &= test_GetPrinterDriver2(tctx, p, &handle03);
+ ret &= test_GetPrinterDriver2(tctx, p, ctx, &handle03);
ret &= test_EnumForms(tctx, p, &handle03, 0);
ret &= test_EnumPrinterKey(tctx, p, &handle03, "", ctx);
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index a4b9e6bed1..375df9f647 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -82,8 +82,8 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
uint32_t info_level = SVC_STATUS_PROCESS_INFO;
uint8_t *buffer;
- uint32_t buf_size = 0;
- uint32_t bytes_needed = 0;
+ uint32_t offered = 0;
+ uint32_t needed = 0;
if (!test_OpenSCManager(p, tctx, &h))
return false;
@@ -95,16 +95,16 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
r.in.handle = &s;
r.in.info_level = info_level;
- r.in.buf_size = buf_size;
+ r.in.offered = offered;
r.out.buffer = buffer;
- r.out.bytes_needed = &bytes_needed;
+ r.out.needed = &needed;
status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceStatusEx failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
- r.in.buf_size = bytes_needed;
- buffer = talloc_array(tctx, uint8_t, bytes_needed);
+ r.in.offered = needed;
+ buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
status = dcerpc_svcctl_QueryServiceStatusEx(p, tctx, &r);
@@ -129,8 +129,8 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
uint32_t info_level = SERVICE_CONFIG_DESCRIPTION;
uint8_t *buffer;
- uint32_t buf_size = 0;
- uint32_t bytes_needed = 0;
+ uint32_t offered = 0;
+ uint32_t needed = 0;
if (!test_OpenSCManager(p, tctx, &h))
return false;
@@ -142,16 +142,16 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
r.in.handle = &s;
r.in.info_level = info_level;
- r.in.buf_size = buf_size;
+ r.in.offered = offered;
r.out.buffer = buffer;
- r.out.bytes_needed = &bytes_needed;
+ r.out.needed = &needed;
status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
- r.in.buf_size = bytes_needed;
- buffer = talloc_array(tctx, uint8_t, bytes_needed);
+ r.in.offered = needed;
+ buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
@@ -160,16 +160,16 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
}
r.in.info_level = SERVICE_CONFIG_FAILURE_ACTIONS;
- r.in.buf_size = buf_size;
+ r.in.offered = offered;
r.out.buffer = buffer;
- r.out.bytes_needed = &bytes_needed;
+ r.out.needed = &needed;
status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "QueryServiceConfig2W failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
- r.in.buf_size = bytes_needed;
- buffer = talloc_array(tctx, uint8_t, bytes_needed);
+ r.in.offered = needed;
+ buffer = talloc_array(tctx, uint8_t, needed);
r.out.buffer = buffer;
status = dcerpc_svcctl_QueryServiceConfig2W(p, tctx, &r);
@@ -194,7 +194,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
NTSTATUS status;
uint32_t resume_handle = 0;
struct ENUM_SERVICE_STATUSW *service = NULL;
- uint32_t bytes_needed = 0;
+ uint32_t needed = 0;
uint32_t services_returned = 0;
if (!test_OpenSCManager(p, tctx, &h))
@@ -203,20 +203,20 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
r.in.handle = &h;
r.in.type = SERVICE_TYPE_WIN32;
r.in.state = SERVICE_STATE_ALL;
- r.in.buf_size = 0;
+ r.in.offered = 0;
r.in.resume_handle = &resume_handle;
r.out.service = NULL;
r.out.resume_handle = &resume_handle;
r.out.services_returned = &services_returned;
- r.out.bytes_needed = &bytes_needed;
+ r.out.needed = &needed;
status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
- r.in.buf_size = bytes_needed;
- r.out.service = talloc_array(tctx, uint8_t, bytes_needed);
+ r.in.offered = needed;
+ r.out.service = talloc_array(tctx, uint8_t, needed);
status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
@@ -230,7 +230,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
DATA_BLOB blob;
struct ndr_pull *ndr;
- blob.length = r.in.buf_size;
+ blob.length = r.in.offered;
blob.data = talloc_steal(tctx, r.out.service);
ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx));