summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-11-27 09:50:25 +0000
committerTim Potter <tpot@samba.org>2003-11-27 09:50:25 +0000
commit6aee8274ef8623ef6a374feae248c0e5e9a10a49 (patch)
tree3764a16768f15d1758b176575b8611d328b7e4bb /source4/torture
parentc7c9e61987dbc46fe962647727bfe52e0fdd8de0 (diff)
downloadsamba-6aee8274ef8623ef6a374feae248c0e5e9a10a49.tar.gz
samba-6aee8274ef8623ef6a374feae248c0e5e9a10a49.tar.bz2
samba-6aee8274ef8623ef6a374feae248c0e5e9a10a49.zip
Add DeleteForm, start cleaning up tests.
(This used to be commit 10b31623fd421d341787d0769839ea5dca5ae7c0)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/spoolss.c84
1 files changed, 64 insertions, 20 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 268288880c..468484e471 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -122,26 +122,6 @@ BOOL test_GetForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("No form info returned");
return False;
}
-
- {
- struct spoolss_AddForm af;
- struct spoolss_AddFormInfo1 form;
-
- af.in.handle = handle;
- af.in.level = 1;
- form.flags = 2;
- form.name = "testform3";
- form.width = r.out.info->info1.width;
- form.length = r.out.info->info1.length;
- form.left = r.out.info->info1.left;
- form.top = r.out.info->info1.top;
- form.right = r.out.info->info1.right;
- form.bottom = r.out.info->info1.bottom;
- af.in.info.info1 = &form;
-
- status = dcerpc_spoolss_AddForm(
- p, mem_ctx, &af);
- }
}
return True;
@@ -209,6 +189,66 @@ BOOL test_EnumForms(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+BOOL test_DeleteForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle, char *formname)
+{
+ NTSTATUS status;
+ struct spoolss_DeleteForm r;
+
+ r.in.handle = handle;
+ r.in.formname = formname;
+
+ status = dcerpc_spoolss_DeleteForm(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
+ printf("DeleteForm failed - %s/%s\n",
+ nt_errstr(status), win_errstr(r.out.result));
+ return False;
+ }
+
+ return True;
+}
+
+BOOL test_AddForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ struct spoolss_AddForm r;
+ struct spoolss_AddFormInfo1 form;
+ NTSTATUS status;
+ char *formname = "testform3";
+
+ r.in.handle = handle;
+ r.in.level = 1;
+ form.flags = 2; /* User form */
+ form.name = formname;
+ form.width = 1;
+ form.length = 2;
+ form.left = 3;
+ form.top = 4;
+ form.right = 5;
+ form.bottom = 6;
+ r.in.info.info1 = &form;
+
+ status = dcerpc_spoolss_AddForm(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("AddForm failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("AddForm failed - %s\n", nt_errstr(status));
+ /* Fall through to delete form */
+ }
+
+ if (!test_DeleteForm(p, mem_ctx, handle, formname)) {
+ printf("DeleteForm failed\n");
+ return False;
+ }
+
+ return True;
+}
+
BOOL test_EnumPrinterData(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -338,6 +378,10 @@ static BOOL test_OpenPrinterEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_AddForm(p, mem_ctx, &handle)) {
+ ret = False;
+ }
+
if (!test_EnumPrinterData(p, mem_ctx, &handle)) {
ret = False;
}