s4:torture: Enforce Printer Class
authorJustin Stephenson <jstephen@redhat.com>
Tue, 20 Nov 2018 16:25:49 +0000 (11:25 -0500)
committerBjoern Jacke <bjacke@samba.org>
Mon, 28 Jan 2019 18:34:41 +0000 (19:34 +0100)
Ensure that the provided inf defines Class=Printer for driver installation
to succeed.

Some driver packages(HP Universal Print Driver) include inf files with
other device types such as Class=USB. Attempting to install these will fail
when tested against Windows Server 2016 Print server using
iremotewinspool RPC calls.

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Mon Jan 28 19:34:41 CET 2019 on sn-devel-144

source4/torture/rpc/iremotewinspool_driver.c

index 0045818e7ff67f3fca1896e729ee3a7491a4270a..8090076f1ca1782b46b87be2a039176bde841a1a 100644 (file)
@@ -564,6 +564,13 @@ static bool test_init_driver_info(struct torture_context *tctx,
                              drv_info->core_driver_inf, &drv_info->info);
        torture_assert_goto(tctx, ok, ok, done, "Failed to parse inf driver");
 
+       /* Ensure that we are trying to install the correct device class:
+        * https://docs.microsoft.com/en-us/windows-hardware/drivers/install/system-defined-device-setup-classes-available-to-vendors
+        */
+       if (!(drv_info->info->printer_driver_attributes & PRINTER_DRIVER_CLASS)) {
+                               ok = false;
+                               torture_fail_goto(tctx, done, "Inf file Class value must be Printer");
+       }
 done:
        return ok;