summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/spoolss.idl4
-rw-r--r--source4/torture/rpc/spoolss.c84
2 files changed, 67 insertions, 21 deletions
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 593ea3f202..99db12b34d 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -329,7 +329,9 @@
/******************/
/* Function: 0x1f */
- WERROR spoolss_1f(
+ WERROR spoolss_DeleteForm(
+ [in,ref] policy_handle *handle,
+ [in] unistr formname
);
/******************/
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;
}