diff options
author | Günther Deschner <gd@samba.org> | 2010-05-03 11:57:06 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-05-03 14:44:25 +0200 |
commit | 5efdd13d12a0c4daf0d659556ea0eba4625499f4 (patch) | |
tree | 3a74ce01ab0410f7937002d4a13a74fe6d940adb /source4/torture/rap/printing.c | |
parent | 44fdec02fc03f5af5a081e80e8eda12ebc5f31ba (diff) | |
download | samba-5efdd13d12a0c4daf0d659556ea0eba4625499f4.tar.gz |
s4-smbtorture: add test_netprintjobsetinfo to RAP-PRINTING.
Guenther
Diffstat (limited to 'source4/torture/rap/printing.c')
-rw-r--r-- | source4/torture/rap/printing.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/source4/torture/rap/printing.c b/source4/torture/rap/printing.c index 6161239b151..0be477cf25b 100644 --- a/source4/torture/rap/printing.c +++ b/source4/torture/rap/printing.c @@ -330,6 +330,38 @@ static bool test_netprintjobgetinfo_byid(struct torture_context *tctx, return true; } +static bool test_netprintjobsetinfo_byid(struct torture_context *tctx, + struct smbcli_state *cli, + uint16_t JobID) +{ + struct rap_NetPrintJobSetInfo r; + uint16_t levels[] = { 0, 1, 2 }; + NTSTATUS status; + int i; + const char *comment = "tortured by samba"; + + r.in.JobID = JobID; + r.in.bufsize = strlen(comment); + r.in.ParamNum = RAP_PARAM_JOBCOMMENT; + r.in.Param.string = comment; + + for (i=0; i < ARRAY_SIZE(levels); i++) { + + r.in.level = levels[i]; + + torture_comment(tctx, "Testing rap_NetPrintJobSetInfo(%d) level %d\n", r.in.JobID, r.in.level); + + status = smbcli_rap_netprintjobsetinfo(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r); + if (!NT_STATUS_IS_OK(status)) { + torture_warning(tctx, "smbcli_rap_netprintjobsetinfo failed with %s\n", nt_errstr(status)); + continue; + } + } + + return true; +} + + static bool test_netprintjobgetinfo_byqueue(struct torture_context *tctx, struct smbcli_state *cli, const char *PrintQueueName) @@ -355,6 +387,30 @@ static bool test_netprintjobgetinfo_byqueue(struct torture_context *tctx, return true; } +static bool test_netprintjobsetinfo_byqueue(struct torture_context *tctx, + struct smbcli_state *cli, + const char *PrintQueueName) +{ + struct rap_NetPrintJobEnum r; + int i; + + r.in.PrintQueueName = PrintQueueName; + r.in.bufsize = 8192; + r.in.level = 0; + + torture_assert_ntstatus_ok(tctx, + smbcli_rap_netprintjobenum(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), + "failed to enumerate jobs"); + + for (i=0; i < r.out.count; i++) { + + torture_assert(tctx, + test_netprintjobsetinfo_byid(tctx, cli, r.out.info[i].info0.JobID), + "failed to set job info"); + } + + return true; +} static bool test_netprintjobenum(struct torture_context *tctx, struct smbcli_state *cli) @@ -406,6 +462,31 @@ static bool test_netprintjobgetinfo(struct torture_context *tctx, return true; } +static bool test_netprintjobsetinfo(struct torture_context *tctx, + struct smbcli_state *cli) +{ + struct rap_NetPrintQEnum r; + int i; + + r.in.level = 5; + r.in.bufsize = 8192; + + torture_assert_ntstatus_ok(tctx, + smbcli_rap_netprintqenum(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), + "failed to enum printq"); + + for (i=0; i < r.out.count; i++) { + + const char *printqname = r.out.info[i].info5.PrintQueueName; + + torture_assert(tctx, + test_netprintjobsetinfo_byqueue(tctx, cli, printqname), + "failed to set printjobs on print queue"); + } + + return true; +} + static bool test_rap_print(struct torture_context *tctx, struct smbcli_state *cli) { @@ -431,6 +512,7 @@ struct torture_suite *torture_rap_printing(TALLOC_CTX *mem_ctx) torture_suite_add_1smb_test(suite, "rap_printq", test_netprintq); torture_suite_add_1smb_test(suite, "rap_printjob_enum", test_netprintjobenum); torture_suite_add_1smb_test(suite, "rap_printjob_getinfo", test_netprintjobgetinfo); + torture_suite_add_1smb_test(suite, "rap_printjob_setinfo", test_netprintjobsetinfo); torture_suite_add_1smb_test(suite, "rap_printjob", test_netprintjob); return suite; |