summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-04-07 00:39:17 +0200
committerGünther Deschner <gd@samba.org>2010-04-07 11:40:41 +0200
commit4712940e7cbd0d05a30b548d23e96a4d0b741e78 (patch)
treedd4fbb6359fbf2448fd7b41e332ac69a7881a2f9
parent8bb30ffcf619e4e799ba38df41f0479fb70980c9 (diff)
downloadsamba-4712940e7cbd0d05a30b548d23e96a4d0b741e78.tar.gz
samba-4712940e7cbd0d05a30b548d23e96a4d0b741e78.tar.bz2
samba-4712940e7cbd0d05a30b548d23e96a4d0b741e78.zip
s4-smbtorture: merge badname spoolss openprinter tests.
Guenther
-rw-r--r--source4/torture/rpc/spoolss.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 05ee57268c..4cc0e84769 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -4382,6 +4382,39 @@ static bool test_OpenPrinter_badname(struct torture_context *tctx,
return ret;
}
+static bool test_OpenPrinter_badname_list(struct torture_context *tctx,
+ struct dcerpc_binding_handle *b,
+ const char *server_name)
+{
+ const char *badnames[] = {
+ "__INVALID_PRINTER__",
+ "\\\\__INVALID_HOST__",
+ "",
+ "\\\\\\",
+ "\\\\\\__INVALID_PRINTER__"
+ };
+ const char *badname;
+ int i;
+
+ for (i=0; i < ARRAY_SIZE(badnames); i++) {
+ torture_assert(tctx,
+ test_OpenPrinter_badname(tctx, b, badnames[i]),
+ "");
+ }
+
+ badname = talloc_asprintf(tctx, "\\\\%s\\", server_name);
+ torture_assert(tctx,
+ test_OpenPrinter_badname(tctx, b, badname),
+ "");
+
+ badname = talloc_asprintf(tctx, "\\\\%s\\__INVALID_PRINTER__", server_name);
+ torture_assert(tctx,
+ test_OpenPrinter_badname(tctx, b, badname),
+ "");
+
+ return true;
+}
+
static bool test_OpenPrinter(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *name,
@@ -5607,15 +5640,7 @@ bool torture_rpc_spoolss(struct torture_context *torture)
ret &= test_EnumPrintProcessors(torture, b, ctx, environment);
ret &= test_EnumPrintProcDataTypes(torture, b);
ret &= test_EnumPrinters(torture, b, ctx);
- ret &= test_OpenPrinter_badname(torture, b, "__INVALID_PRINTER__");
- ret &= test_OpenPrinter_badname(torture, b, "\\\\__INVALID_HOST__");
- ret &= test_OpenPrinter_badname(torture, b, "");
- ret &= test_OpenPrinter_badname(torture, b, "\\\\\\");
- ret &= test_OpenPrinter_badname(torture, b, "\\\\\\__INVALID_PRINTER__");
- ret &= test_OpenPrinter_badname(torture, b, talloc_asprintf(torture, "\\\\%s\\", dcerpc_server_name(p)));
- ret &= test_OpenPrinter_badname(torture, b,
- talloc_asprintf(torture, "\\\\%s\\__INVALID_PRINTER__", dcerpc_server_name(p)));
-
+ ret &= test_OpenPrinter_badname_list(torture, b, dcerpc_server_name(p));
ret &= test_AddPort(torture, p);
ret &= test_EnumPorts_old(torture, p);