[PATCHES] spoolss testing + better driver level 8 support
Jeremy Allison
jra at samba.org
Mon Aug 22 22:32:57 UTC 2016
On Mon, Aug 22, 2016 at 04:14:38PM +0200, Günther Deschner wrote:
> Hi,
>
> attached some patches Andreas and me have been working on.
>
> Please review & push,
Thank you *SO MUCH* for still fixing the printing code :-).
Pushed.
> --
> Günther Deschner GPG-ID: 8EE11688
> Red Hat gdeschner at redhat.com
> Samba Team gd at samba.org
> From c999e6467af88031cea1fbe5755e83672d2de60c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Sat, 20 Aug 2016 00:32:39 +0200
> Subject: [PATCH 1/9] s4-scripting: let gen_hresult.py tolerate empty lines.
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> source4/scripting/bin/gen_hresult.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/source4/scripting/bin/gen_hresult.py b/source4/scripting/bin/gen_hresult.py
> index 176c89d..d49aef9 100755
> --- a/source4/scripting/bin/gen_hresult.py
> +++ b/source4/scripting/bin/gen_hresult.py
> @@ -50,6 +50,8 @@ def parseErrorDescriptions( input_file, isWinError ):
> for line in fileContents:
> content = line.strip().split(None,1)
> # start new error definition ?
> + if len(content) == 0:
> + continue
> if line.startswith("0x"):
> newError = ErrorDef()
> newError.err_code = content[0]
> --
> 2.7.4
>
>
> From d36e0b1a58e0b097359c09c4e79b2b46253637a1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Mon, 22 Aug 2016 14:21:25 +0200
> Subject: [PATCH 2/9] hresult: create enough space for the hresult_errstr
> message.
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> libcli/util/hresult.c | 2 +-
> source4/scripting/bin/gen_hresult.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libcli/util/hresult.c b/libcli/util/hresult.c
> index 1b3a8f2..327d97b 100644
> --- a/libcli/util/hresult.c
> +++ b/libcli/util/hresult.c
> @@ -14688,7 +14688,7 @@ const char *hresult_errstr_const(HRESULT err_code)
>
> const char *hresult_errstr(HRESULT err_code)
> {
> - static char msg[20];
> + static char msg[22];
> int i;
>
> for (i = 0; i < ARRAY_SIZE(hresult_errs); i++) {
> diff --git a/source4/scripting/bin/gen_hresult.py b/source4/scripting/bin/gen_hresult.py
> index d49aef9..cdc9142 100755
> --- a/source4/scripting/bin/gen_hresult.py
> +++ b/source4/scripting/bin/gen_hresult.py
> @@ -186,7 +186,7 @@ def generateSourceFile(out_file):
> out_file.write("\n")
> out_file.write("const char *hresult_errstr(HRESULT err_code)\n")
> out_file.write("{\n");
> - out_file.write(" static char msg[20];\n")
> + out_file.write(" static char msg[22];\n")
> out_file.write(" int i;\n")
> out_file.write("\n")
> out_file.write(" for (i = 0; i < ARRAY_SIZE(hresult_errs); i++) {\n")
> --
> 2.7.4
>
>
> From 67c0eaa9a3be0ac0c108a7a299d6c795110edc4e Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Mon, 22 Aug 2016 14:41:05 +0200
> Subject: [PATCH 3/9] spoolss: add various well known core printer driver file
> GUIDs to IDL.
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> librpc/idl/spoolss.idl | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
> index 5bbc267..5d63b26 100644
> --- a/librpc/idl/spoolss.idl
> +++ b/librpc/idl/spoolss.idl
> @@ -3277,6 +3277,13 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
>
> /******************/
> /* Function: 0x66 */
> +
> + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_UNIDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F0}";
> + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PSCRIPT = "{D20EA372-DD35-4950-9ED8-A6335AFE79F1}";
> + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PCLXL = "{D20EA372-DD35-4950-9ED8-A6335AFE79F2}";
> + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PLOTTER = "{D20EA372-DD35-4950-9ED8-A6335AFE79F4}";
> + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F5}";
> +
> typedef [public] struct {
> GUID core_driver_guid;
> NTTIME driver_date;
> --
> 2.7.4
>
>
> From ad89babb62bd5ffd60064220e51cb0d2d119de0c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Fri, 19 Aug 2016 23:26:34 +0200
> Subject: [PATCH 4/9] librpc: fix spoolss_GetCorePrinterDrivers IDL.
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> librpc/idl/spoolss.idl | 4 ++--
> source3/rpc_server/spoolss/srv_spoolss_nt.c | 6 +++---
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
> index 5d63b26..2782c71 100644
> --- a/librpc/idl/spoolss.idl
> +++ b/librpc/idl/spoolss.idl
> @@ -3288,10 +3288,10 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
> GUID core_driver_guid;
> NTTIME driver_date;
> hyper driver_version;
> - [charset(UTF8)] uint8 formname[520];
> + [charset(UTF16)] uint16 szPackageID[260];
> } spoolss_CorePrinterDriver;
>
> - [public] WERROR spoolss_GetCorePrinterDrivers(
> + [public] HRESULT spoolss_GetCorePrinterDrivers(
> [in,unique] [string,charset(UTF16)] uint16 *servername,
> [in,ref] [string,charset(UTF16)] uint16 *architecture,
> [in] uint32 core_driver_size,
> diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> index 2da85e0..0f3b604 100644
> --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
> +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> @@ -11282,11 +11282,11 @@ WERROR _spoolss_65(struct pipes_struct *p,
> _spoolss_GetCorePrinterDrivers
> ****************************************************************/
>
> -WERROR _spoolss_GetCorePrinterDrivers(struct pipes_struct *p,
> - struct spoolss_GetCorePrinterDrivers *r)
> +HRESULT _spoolss_GetCorePrinterDrivers(struct pipes_struct *p,
> + struct spoolss_GetCorePrinterDrivers *r)
> {
> p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
> - return WERR_NOT_SUPPORTED;
> + return HRES_ERROR_NOT_SUPPORTED;
> }
>
> /****************************************************************
> --
> 2.7.4
>
>
> From 6c69cdb30fc12aeae9db0874472b8cdcf5cd3467 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Fri, 19 Aug 2016 23:27:19 +0200
> Subject: [PATCH 5/9] s4-torture: add test for spoolss_CorePrinterDriver().
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> selftest/knownfail | 1 +
> source4/torture/rpc/spoolss.c | 111 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 112 insertions(+)
>
> diff --git a/selftest/knownfail b/selftest/knownfail
> index 41cad44..09a4ac7 100644
> --- a/selftest/knownfail
> +++ b/selftest/knownfail
> @@ -182,6 +182,7 @@
> ^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping?
> ^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env
> ^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
> +^samba3.rpc.spoolss.printserver.*.get_core_printer_drivers\(.*\)$
> ^samba4.rpc.fsrvp # fsrvp server only provided by smbd
> #
> # The following tests fail against ad_dc (aka s3fs) currently.
> diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
> index 4e9f700..5ede07e 100644
> --- a/source4/torture/rpc/spoolss.c
> +++ b/source4/torture/rpc/spoolss.c
> @@ -7874,6 +7874,116 @@ static bool test_architecture_buffer(struct torture_context *tctx,
> return true;
> }
>
> +static bool test_get_core_printer_drivers_arch_guid(struct torture_context *tctx,
> + struct dcerpc_pipe *p,
> + const char *architecture,
> + const char *guid_str,
> + const char **package_id)
> +{
> + struct spoolss_GetCorePrinterDrivers r;
> + struct spoolss_CorePrinterDriver core_printer_drivers;
> + DATA_BLOB blob;
> + const char **s;
> + struct dcerpc_binding_handle *b = p->binding_handle;
> + struct GUID guid;
> +
> + s = talloc_zero_array(tctx, const char *, 2);
> +
> + r.in.servername = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
> + r.in.architecture = "foobar";
> + r.in.core_driver_size = 0;
> + r.in.core_driver_dependencies = "";
> + r.in.core_printer_driver_count = 0;
> + r.out.core_printer_drivers = &core_printer_drivers;
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetCorePrinterDrivers_r(b, tctx, &r),
> + "spoolss_GetCorePrinterDrivers failed");
> + torture_assert_hresult_equal(tctx, r.out.result, HRES_E_INVALIDARG,
> + "spoolss_GetCorePrinterDrivers failed");
> +
> + guid = GUID_random();
> + s[0] = GUID_string2(tctx, &guid);
> +
> + torture_assert(tctx,
> + push_reg_multi_sz(tctx, &blob, s),
> + "push_reg_multi_sz failed");
> +
> + r.in.core_driver_size = blob.length;
> + r.in.core_driver_dependencies = s[0];
> + r.in.core_printer_driver_count = 1;
> + r.out.core_printer_drivers = talloc_zero_array(tctx, struct spoolss_CorePrinterDriver, r.in.core_printer_driver_count);
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetCorePrinterDrivers_r(b, tctx, &r),
> + "spoolss_GetCorePrinterDrivers failed");
> + torture_assert_werr_equal(tctx,
> + W_ERROR(WIN32_FROM_HRESULT(r.out.result)), WERR_INVALID_ENVIRONMENT,
> + "spoolss_GetCorePrinterDrivers failed");
> +
> + r.in.architecture = architecture;
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetCorePrinterDrivers_r(b, tctx, &r),
> + "spoolss_GetCorePrinterDrivers failed");
> + torture_assert_werr_equal(tctx,
> + W_ERROR(WIN32_FROM_HRESULT(r.out.result)), WERR_NOT_FOUND,
> + "spoolss_GetCorePrinterDrivers failed");
> +
> + s[0] = talloc_strdup(s, guid_str);
> +
> + torture_assert(tctx,
> + push_reg_multi_sz(tctx, &blob, s),
> + "push_reg_multi_sz failed");
> +
> + r.in.core_driver_size = blob.length;
> + r.in.core_driver_dependencies = s[0];
> + r.in.core_printer_driver_count = 1;
> + r.out.core_printer_drivers = talloc_zero_array(tctx, struct spoolss_CorePrinterDriver, r.in.core_printer_driver_count);
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetCorePrinterDrivers_r(b, tctx, &r),
> + "spoolss_GetCorePrinterDrivers failed");
> + torture_assert_hresult_ok(tctx, r.out.result,
> + "spoolss_GetCorePrinterDrivers failed");
> +
> + if (package_id) {
> + *package_id = r.out.core_printer_drivers[0].szPackageID;
> + }
> +
> + return true;
> +}
> +
> +static bool test_get_core_printer_drivers(struct torture_context *tctx,
> + void *private_data)
> +{
> + struct test_spoolss_context *ctx =
> + talloc_get_type_abort(private_data, struct test_spoolss_context);
> +
> + const char *architectures[] = {
> + SPOOLSS_ARCHITECTURE_NT_X86,
> + SPOOLSS_ARCHITECTURE_x64
> + };
> + int i;
> + struct dcerpc_pipe *p = ctx->spoolss_pipe;
> +
> + for (i=0; i < ARRAY_SIZE(architectures); i++) {
> +
> + torture_comment(tctx, "Testing GetCorePrinterDrivers(\"%s\",\"%s\")\n",
> + architectures[i],
> + SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV);
> +
> + torture_assert(tctx,
> + test_get_core_printer_drivers_arch_guid(tctx, p,
> + architectures[i],
> + SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV,
> + NULL),
> + "");
> + }
> +
> + return true;
> +}
> +
> static bool test_PrintServer_Forms_Winreg(struct torture_context *tctx,
> void *private_data)
> {
> @@ -9049,6 +9159,7 @@ struct torture_suite *torture_rpc_spoolss(TALLOC_CTX *mem_ctx)
> torture_tcase_add_simple_test(tcase, "enum_printers_servername", test_EnumPrinters_servername);
> torture_tcase_add_simple_test(tcase, "enum_printer_drivers_old", test_EnumPrinterDrivers_old);
> torture_tcase_add_simple_test(tcase, "architecture_buffer", test_architecture_buffer);
> + torture_tcase_add_simple_test(tcase, "get_core_printer_drivers", test_get_core_printer_drivers);
>
> torture_suite_add_suite(suite, torture_rpc_spoolss_printer(suite));
>
> --
> 2.7.4
>
>
> From be2ba8c778c1c1b5e37672d9e2baa53a732e3fac Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Sat, 20 Aug 2016 00:00:50 +0200
> Subject: [PATCH 6/9] librpc: fix IDL for spoolss_GetPrinterDriverPackagePath()
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> librpc/idl/spoolss.idl | 2 +-
> source3/rpc_server/spoolss/srv_spoolss_nt.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
> index 2782c71..ae10917 100644
> --- a/librpc/idl/spoolss.idl
> +++ b/librpc/idl/spoolss.idl
> @@ -3307,7 +3307,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
>
> /******************/
> /* Function: 0x68 */
> - WERROR spoolss_GetPrinterDriverPackagePath(
> + HRESULT spoolss_GetPrinterDriverPackagePath(
> [in,unique] [string,charset(UTF16)] uint16 *servername,
> [in,ref] [string,charset(UTF16)] uint16 *architecture,
> [in,unique] [string,charset(UTF16)] uint16 *language,
> diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> index 0f3b604..9840e3b 100644
> --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
> +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> @@ -11304,11 +11304,11 @@ WERROR _spoolss_67(struct pipes_struct *p,
> _spoolss_GetPrinterDriverPackagePath
> ****************************************************************/
>
> -WERROR _spoolss_GetPrinterDriverPackagePath(struct pipes_struct *p,
> - struct spoolss_GetPrinterDriverPackagePath *r)
> +HRESULT _spoolss_GetPrinterDriverPackagePath(struct pipes_struct *p,
> + struct spoolss_GetPrinterDriverPackagePath *r)
> {
> p->fault_state = DCERPC_FAULT_OP_RNG_ERROR;
> - return WERR_NOT_SUPPORTED;
> + return HRES_ERROR_NOT_SUPPORTED;
> }
>
> /****************************************************************
> --
> 2.7.4
>
>
> From f670dcfb718b97233558fd7f01f39c6955cc38af Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Sat, 20 Aug 2016 00:01:52 +0200
> Subject: [PATCH 7/9] s4-torture: add test for
> spoolss_GetPrinterDriverPackagePath().
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> selftest/knownfail | 1 +
> source4/torture/rpc/spoolss.c | 77 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 78 insertions(+)
>
> diff --git a/selftest/knownfail b/selftest/knownfail
> index 09a4ac7..8e61294 100644
> --- a/selftest/knownfail
> +++ b/selftest/knownfail
> @@ -183,6 +183,7 @@
> ^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env
> ^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
> ^samba3.rpc.spoolss.printserver.*.get_core_printer_drivers\(.*\)$
> +^samba3.rpc.spoolss.printserver.*.get_printer_driver_package_path\(.*\)$
> ^samba4.rpc.fsrvp # fsrvp server only provided by smbd
> #
> # The following tests fail against ad_dc (aka s3fs) currently.
> diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
> index 5ede07e..154e8b1 100644
> --- a/source4/torture/rpc/spoolss.c
> +++ b/source4/torture/rpc/spoolss.c
> @@ -7984,6 +7984,82 @@ static bool test_get_core_printer_drivers(struct torture_context *tctx,
> return true;
> }
>
> +static bool test_get_printer_driver_package_path(struct torture_context *tctx,
> + void *private_data)
> +{
> + struct test_spoolss_context *ctx =
> + talloc_get_type_abort(private_data, struct test_spoolss_context);
> +
> + const char *architectures[] = {
> + SPOOLSS_ARCHITECTURE_NT_X86,
> + SPOOLSS_ARCHITECTURE_x64
> + };
> + int i;
> + struct dcerpc_pipe *p = ctx->spoolss_pipe;
> + struct dcerpc_binding_handle *b = p->binding_handle;
> +
> + for (i=0; i < ARRAY_SIZE(architectures); i++) {
> + struct spoolss_GetPrinterDriverPackagePath r;
> + uint32_t required = 0;
> + const char *package_id = NULL;
> +
> + test_get_core_printer_drivers_arch_guid(tctx, p,
> + architectures[i],
> + SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV,
> + &package_id),
> +
> + torture_comment(tctx, "Testing GetPrinterDriverPackagePath(\"%s\",\"%s\")\n",
> + architectures[i], package_id);
> +
> + r.in.servername = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
> + r.in.architecture = "foobar";
> + r.in.language = NULL;
> + r.in.package_id = "";
> + r.in.driver_package_cab_size = 0;
> + r.in.driver_package_cab = NULL;
> +
> + r.out.required = &required;
> + r.out.driver_package_cab = NULL;
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
> + "spoolss_GetPrinterDriverPackagePath failed");
> + torture_assert_werr_equal(tctx,
> + W_ERROR(WIN32_FROM_HRESULT(r.out.result)), WERR_INVALID_ENVIRONMENT,
> + "spoolss_GetPrinterDriverPackagePath failed");
> +
> + r.in.architecture = architectures[i];
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
> + "spoolss_GetPrinterDriverPackagePath failed");
> + torture_assert_werr_equal(tctx,
> + W_ERROR(WIN32_FROM_HRESULT(r.out.result)), WERR_FILE_NOT_FOUND,
> + "spoolss_GetPrinterDriverPackagePath failed");
> +
> + r.in.package_id = package_id;
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
> + "spoolss_GetPrinterDriverPackagePath failed");
> + torture_assert_hresult_ok(tctx, r.out.result,
> + "spoolss_GetPrinterDriverPackagePath failed");
> +
> + r.in.driver_package_cab_size = required;
> + r.in.driver_package_cab = talloc_zero_array(tctx, char, required);
> + r.out.driver_package_cab = talloc_zero_array(tctx, char, required);
> +
> + torture_assert_ntstatus_ok(tctx,
> + dcerpc_spoolss_GetPrinterDriverPackagePath_r(b, tctx, &r),
> + "spoolss_GetPrinterDriverPackagePath failed");
> + torture_assert_hresult_ok(tctx, r.out.result,
> + "spoolss_GetPrinterDriverPackagePath failed");
> +
> + }
> +
> + return true;
> +}
> +
> static bool test_PrintServer_Forms_Winreg(struct torture_context *tctx,
> void *private_data)
> {
> @@ -9160,6 +9236,7 @@ struct torture_suite *torture_rpc_spoolss(TALLOC_CTX *mem_ctx)
> torture_tcase_add_simple_test(tcase, "enum_printer_drivers_old", test_EnumPrinterDrivers_old);
> torture_tcase_add_simple_test(tcase, "architecture_buffer", test_architecture_buffer);
> torture_tcase_add_simple_test(tcase, "get_core_printer_drivers", test_get_core_printer_drivers);
> + torture_tcase_add_simple_test(tcase, "get_printer_driver_package_path", test_get_printer_driver_package_path);
>
> torture_suite_add_suite(suite, torture_rpc_spoolss_printer(suite));
>
> --
> 2.7.4
>
>
> From 59ee0a22dff02faf9185335cd1ace3ae797e537c Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <asn at samba.org>
> Date: Thu, 18 Aug 2016 10:26:10 +0200
> Subject: [PATCH 8/9] s3-spoolss: Support for adding printer drivers with info
> level 8
>
> We already supported getting driver info level 8 but not adding it. This
> allows adding printer drivers with level. So several fields where emtpy.
>
> Microsoft released a security update for Windows print spooler
> components which requires support for driver info level 8 now. This is
> needed to find out if a driver is PACKAGE_AWARE or not.
>
> Pair-Programmed-With: Guenther Deschner <gd at samba.org>
> Signed-off-by: Andreas Schneider <asn at samba.org>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> source3/printing/nt_printing.c | 30 +++++++++++++++++++++++++++++
> source3/rpc_server/spoolss/srv_spoolss_nt.c | 7 +++----
> 2 files changed, 33 insertions(+), 4 deletions(-)
>
> diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
> index 36e7324..d5b92a1 100644
> --- a/source3/printing/nt_printing.c
> +++ b/source3/printing/nt_printing.c
> @@ -952,6 +952,15 @@ WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
> &r->info.info6->help_file,
> r->info.info6->dependent_files,
> &r->info.info6->version);
> + case 8:
> + return clean_up_driver_struct_level(mem_ctx, session_info,
> + r->info.info8->architecture,
> + &r->info.info8->driver_path,
> + &r->info.info8->data_file,
> + &r->info.info8->config_file,
> + &r->info.info8->help_file,
> + r->info.info8->dependent_files,
> + &r->info.info8->version);
> default:
> return WERR_NOT_SUPPORTED;
> }
> @@ -978,6 +987,23 @@ static void convert_level_6_to_level3(struct spoolss_AddDriverInfo3 *dst,
> dst->dependent_files = src->dependent_files;
> }
>
> +static void convert_level_8_to_level3(struct spoolss_AddDriverInfo3 *dst,
> + const struct spoolss_AddDriverInfo8 *src)
> +{
> + dst->version = src->version;
> +
> + dst->driver_name = src->driver_name;
> + dst->architecture = src->architecture;
> + dst->driver_path = src->driver_path;
> + dst->data_file = src->data_file;
> + dst->config_file = src->config_file;
> + dst->help_file = src->help_file;
> + dst->monitor_name = src->monitor_name;
> + dst->default_datatype = src->default_datatype;
> + dst->_ndr_size_dependent_files = src->_ndr_size_dependent_files;
> + dst->dependent_files = src->dependent_files;
> +}
> +
> /****************************************************************************
> ****************************************************************************/
>
> @@ -1075,6 +1101,10 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
> convert_level_6_to_level3(&converted_driver, r->info.info6);
> driver = &converted_driver;
> break;
> + case 8:
> + convert_level_8_to_level3(&converted_driver, r->info.info8);
> + driver = &converted_driver;
> + break;
> default:
> DEBUG(0,("move_driver_to_download_area: Unknown info level (%u)\n", (unsigned int)r->level));
> return WERR_UNKNOWN_LEVEL;
> diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> index 9840e3b..5d4a99c 100644
> --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
> +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
> @@ -8487,10 +8487,9 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
> }
>
> /* FIXME */
> - if (r->in.info_ctr->level != 3 && r->in.info_ctr->level != 6) {
> - /* Clever hack from Martin Zielinski <mz at seh.de>
> - * to allow downgrade from level 8 (Vista).
> - */
> + if (r->in.info_ctr->level != 3 &&
> + r->in.info_ctr->level != 6 &&
> + r->in.info_ctr->level != 8) {
> DEBUG(0,("%s: level %d not yet implemented\n", fn,
> r->in.info_ctr->level));
> return WERR_UNKNOWN_LEVEL;
> --
> 2.7.4
>
>
> From f8497df6217d22c5a824c8da727a2ca87f1d925d Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <asn at samba.org>
> Date: Thu, 18 Aug 2016 10:30:21 +0200
> Subject: [PATCH 9/9] s4-torture: Enable tests for printer driver info level 8
>
> Pair-Programmed-With: Guenther Deschner <gd at samba.org>
> Signed-off-by: Andreas Schneider <asn at samba.org>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> source4/torture/rpc/spoolss.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
> index 154e8b1..16b6aae 100644
> --- a/source4/torture/rpc/spoolss.c
> +++ b/source4/torture/rpc/spoolss.c
> @@ -10405,8 +10405,6 @@ static bool test_add_driver_arg(struct torture_context *tctx,
> switch (levels[i]) {
> case 2:
> case 4:
> - case 8:
> - torture_comment(tctx, "skipping level %d against samba\n", levels[i]);
> continue;
> default:
> break;
> @@ -10449,7 +10447,6 @@ static bool test_add_driver_arg(struct torture_context *tctx,
> switch (levels[i]) {
> case 2:
> case 4:
> - case 8:
> torture_comment(tctx, "skipping level %d against samba\n", levels[i]);
> continue;
> default:
> --
> 2.7.4
>
More information about the samba-technical
mailing list