summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJustin Stephenson <jstephen@redhat.com>2018-09-11 15:57:14 -0400
committerBjoern Jacke <bjacke@samba.org>2019-01-28 15:44:19 +0100
commita9f283c84ff9c429620f9e7fdc28b063174e4605 (patch)
treeb76aa253d37de3bad0facc8dd2bbec9110210002 /source4
parenta9619abb95f5d87686cded5754e4c33f34244ac3 (diff)
downloadsamba-a9f283c84ff9c429620f9e7fdc28b063174e4605.tar.gz
s4:torture: Add test_UploadPrinterDriverPackage
Add test to Upload Print Driver, a prerequisite RPC call before installing the print driver. The inf driver file to use in this test will be provided using torture option:inf_file Signed-off-by: Justin Stephenson <jstephen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/iremotewinspool_driver.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/source4/torture/rpc/iremotewinspool_driver.c b/source4/torture/rpc/iremotewinspool_driver.c
index 7ec1ae05d3f..f5e73d9a5ac 100644
--- a/source4/torture/rpc/iremotewinspool_driver.c
+++ b/source4/torture/rpc/iremotewinspool_driver.c
@@ -464,6 +464,64 @@ done:
return ok;
}
+/*
+ * Upload print driver package files and inf file, preparing the print server
+ * for driver installation
+ */
+static bool test_UploadPrinterDriverPackage(struct torture_context *tctx,
+ void *private_data)
+{
+ struct test_iremotewinspool_context *ctx =
+ talloc_get_type_abort(private_data, struct test_iremotewinspool_context);
+
+ struct dcerpc_pipe *p = ctx->iremotewinspool_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
+
+ struct spoolss_AddDriverInfo8 *parsed_dinfo;
+ struct winspool_AsyncUploadPrinterDriverPackage r;
+ uint32_t pcchDestInfPath = 0;
+ NTSTATUS status;
+ bool ok = true;
+
+ parsed_dinfo = ctx->dinfo->info;
+
+ r.in.pszServer = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ torture_assert_not_null_goto(tctx, r.in.pszServer, ok, done, "Cannot allocate memory");
+
+ r.in.pszInfPath = talloc_asprintf(tctx, "\\\\%s\\%s\\%s\\%s", ctx->dinfo->server_name,
+ ctx->dinfo->share_name,
+ ctx->dinfo->print_upload_guid_dir,
+ ctx->dinfo->inf_file);
+ torture_assert_not_null_goto(tctx, r.in.pszInfPath, ok, done, "Cannot allocate memory");
+
+ r.in.pszEnvironment = parsed_dinfo->architecture;
+ /* Upload driver package files even if the driver package is already present
+ * on the print server */
+ r.in.dwFlags = UPDP_UPLOAD_ALWAYS;
+ pcchDestInfPath = 260;
+ r.in.pszDestInfPath = NULL;
+ r.in.pcchDestInfPath = &pcchDestInfPath;
+ r.out.pszDestInfPath = NULL;
+ r.out.pcchDestInfPath = &pcchDestInfPath;
+
+ r.in.pszDestInfPath = talloc_zero(tctx, const char);
+ torture_assert_not_null_goto(tctx, r.in.pszDestInfPath, ok, done, "Cannot allocate memory");
+ r.out.pszDestInfPath = talloc_zero(tctx, const char);
+ torture_assert_not_null_goto(tctx, r.out.pszDestInfPath, ok, done, "Cannot allocate memory");
+
+ status = dcerpc_winspool_AsyncUploadPrinterDriverPackage_r(b, tctx, &r);
+ torture_assert_ntstatus_ok_goto(tctx, status, ok, done, "AsyncUploadPrinterDriverPackage failed");
+
+ torture_assert_hresult_ok(tctx, r.out.result, "AsyncUploadPrinterDriverPackage failed");
+
+ ctx->dinfo->uploaded_inf_path = talloc_strdup(tctx, r.out.pszDestInfPath);
+ torture_assert_not_null_goto(tctx, ctx->dinfo->uploaded_inf_path, ok, done, "Cannot allocate memory");
+
+done:
+
+ return ok;
+}
+
struct torture_suite *torture_rpc_iremotewinspool_drv(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx, "iremotewinspool_driver");
@@ -474,6 +532,7 @@ struct torture_suite *torture_rpc_iremotewinspool_drv(TALLOC_CTX *mem_ctx)
torture_rpc_iremotewinspool_drv_teardown);
torture_tcase_add_simple_test(tcase, "CopyDriverFiles", test_CopyDriverFiles);
+ torture_tcase_add_simple_test(tcase, "UploadPrinterDriverPackage", test_UploadPrinterDriverPackage);
return suite;
}