summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2013-05-29 10:43:35 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-06-03 16:06:15 +0200
commitb475ef008b1a2d2095c9b2276a55e9fbd38a5ca5 (patch)
tree75e9403e0b7f9305c5690987a102408e54f47c59
parent56b02461626a0d49c47ff5e909b60d10b93afecf (diff)
downloadsamba-b475ef008b1a2d2095c9b2276a55e9fbd38a5ca5.tar.gz
samba-b475ef008b1a2d2095c9b2276a55e9fbd38a5ca5.tar.bz2
samba-b475ef008b1a2d2095c9b2276a55e9fbd38a5ca5.zip
torture: support printer publish pending responses
Windows (tested against 2k8r2) returns WERR_IO_PENDING and DSPRINT_PENDING when a publish or unpublish is requested via setprinter(level=7). Modify the AD printer publishing test to support these responses. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Jun 3 16:06:15 CEST 2013 on sn-devel-104
-rw-r--r--source4/torture/rpc/spoolss.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 959ba30e83..4c84bc0d13 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1247,8 +1247,9 @@ static bool test_SetPrinter(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_SetPrinter_r(b, tctx, &r),
"failed to call SetPrinter");
- torture_assert_werr_ok(tctx, r.out.result,
- "failed to call SetPrinter");
+ torture_assert(tctx, (W_ERROR_EQUAL(r.out.result, WERR_OK)
+ || W_ERROR_EQUAL(r.out.result, WERR_IO_PENDING)),
+ "SetPrinter failed");
return true;
}
@@ -8534,7 +8535,6 @@ static bool test_printer_set_publish(struct torture_context *tctx,
struct spoolss_SetPrinterInfoCtr info_ctr;
struct spoolss_DevmodeContainer devmode_ctr;
struct sec_desc_buf secdesc_ctr;
- struct GUID guid;
info7.guid = "";
info7.action = DSPRINT_PUBLISH;
@@ -8558,11 +8558,23 @@ static bool test_printer_set_publish(struct torture_context *tctx,
torture_assert(tctx,
test_GetPrinter_level(tctx, b, handle, 7, &info),
"");
- torture_assert_int_equal(tctx,
- info.info7.action, DSPRINT_PUBLISH,
- "info7 publish flag not set");
- torture_assert_ntstatus_ok(tctx, GUID_from_string(info.info7.guid, &guid),
- "invalid guid for published printer");
+ if (info.info7.action & DSPRINT_PENDING) {
+ torture_comment(tctx, "publish is pending\n");
+ torture_assert_int_equal(tctx,
+ info.info7.action,
+ (DSPRINT_PENDING | DSPRINT_PUBLISH),
+ "info7 publish flag not set");
+ } else {
+ struct GUID guid;
+ torture_assert_int_equal(tctx,
+ info.info7.action,
+ DSPRINT_PUBLISH,
+ "info7 publish flag not set");
+ torture_assert_ntstatus_ok(tctx,
+ GUID_from_string(info.info7.guid,
+ &guid),
+ "invalid published printer GUID");
+ }
return true;
}
@@ -8599,12 +8611,23 @@ static bool test_printer_set_unpublish(struct torture_context *tctx,
torture_assert(tctx,
test_GetPrinter_level(tctx, b, handle, 7, &info),
"");
- torture_assert_int_equal(tctx,
- info.info7.action, DSPRINT_UNPUBLISH,
- "info7 unpublish flag not set");
- torture_assert_str_equal(tctx,
- info.info7.guid, "",
- "guid not empty after unpublish");
+
+ if (info.info7.action & DSPRINT_PENDING) {
+ struct GUID guid;
+ torture_comment(tctx, "unpublish is pending\n");
+ torture_assert_int_equal(tctx,
+ info.info7.action,
+ (DSPRINT_PENDING | DSPRINT_UNPUBLISH),
+ "info7 unpublish flag not set");
+ torture_assert_ntstatus_ok(tctx,
+ GUID_from_string(info.info7.guid,
+ &guid),
+ "invalid printer GUID");
+ } else {
+ torture_assert_int_equal(tctx,
+ info.info7.action, DSPRINT_UNPUBLISH,
+ "info7 unpublish flag not set");
+ }
return true;
}