summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-06-06 15:03:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:44 -0500
commitf9716b51cd6503911a18fd50698dd891387d1f8e (patch)
tree587c22206480be46183f06327e25b228336d0678
parent56257df1d494d722d95920979716d61735cd5fc7 (diff)
downloadsamba-f9716b51cd6503911a18fd50698dd891387d1f8e.tar.gz
samba-f9716b51cd6503911a18fd50698dd891387d1f8e.tar.bz2
samba-f9716b51cd6503911a18fd50698dd891387d1f8e.zip
r7342: submit a test job for each printer and delete this job
metze (This used to be commit b71d57709733b33e553022271de4ec51f9049a66)
-rw-r--r--source4/torture/rpc/spoolss.c58
1 files changed, 55 insertions, 3 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index c3df059056..20b55f80bf 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1059,7 +1059,6 @@ static BOOL test_SetJob(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("Testing SetJob\n");
status = dcerpc_spoolss_SetJob(p, mem_ctx, &r);
-
if (!NT_STATUS_IS_OK(status)) {
printf("SetJob failed - %s\n", nt_errstr(status));
return False;
@@ -1116,7 +1115,8 @@ static BOOL test_EnumJobs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
for (j = 0; j < r.out.count; j++) {
test_GetJob(p, mem_ctx, handle, info[j].info1.job_id);
- test_SetJob(p, mem_ctx, handle, info[j].info1.job_id, 1);
+ test_SetJob(p, mem_ctx, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_PAUSE);
+ test_SetJob(p, mem_ctx, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_RESUME);
}
} else if (!W_ERROR_IS_OK(r.out.result)) {
@@ -1127,6 +1127,58 @@ static BOOL test_EnumJobs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+static BOOL test_DoPrintTest(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ BOOL ret = True;
+ NTSTATUS status;
+ struct spoolss_StartDocPrinter s;
+ struct spoolss_DocumentInfo1 info1;
+ struct spoolss_EndDocPrinter e;
+ uint32_t job_id;
+
+ printf("Testing StartDocPrinter\n");
+
+ s.in.handle = handle;
+ s.in.level = 1;
+ s.in.info.info1 = &info1;
+ info1.document_name = "TorturePrintJob";
+ info1.output_file = NULL;
+ info1.datatype = "RAW";
+
+ status = dcerpc_spoolss_StartDocPrinter(p, mem_ctx, &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("dcerpc_spoolss_StartDocPrinter failed - %s\n", nt_errstr(status));
+ return False;
+ }
+ if (!W_ERROR_IS_OK(s.out.result)) {
+ printf("StartDocPrinter failed - %s\n", win_errstr(s.out.result));
+ return False;
+ }
+
+ job_id = s.out.job_id;
+
+ printf("Testing EndDocPrinter\n");
+
+ e.in.handle = handle;
+
+ status = dcerpc_spoolss_EndDocPrinter(p, mem_ctx, &e);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("dcerpc_spoolss_EndDocPrinter failed - %s\n", nt_errstr(status));
+ return False;
+ }
+ if (!W_ERROR_IS_OK(e.out.result)) {
+ printf("EndDocPrinter failed - %s\n", win_errstr(e.out.result));
+ return False;
+ }
+
+ ret &= test_EnumJobs(p, mem_ctx, handle);
+
+ ret &= test_SetJob(p, mem_ctx, handle, job_id, SPOOLSS_JOB_CONTROL_DELETE);
+
+ return ret;
+}
+
static BOOL test_PausePrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -1674,7 +1726,7 @@ static BOOL test_OpenPrinterEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
- if (!test_EnumJobs(p, mem_ctx, &handle)) {
+ if (!test_DoPrintTest(p, mem_ctx, &handle)) {
ret = False;
}