From 34218e0448bca3fda9661c67f18bbd0b9886d079 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 10 Jan 2017 18:25:22 +0100 Subject: [PATCH] s3-spoolss: Fix architecture handling in spoolss_DeletePrinterDriverEx call Pair-Programmed-With: Guenther Deschner Signed-off-by: Andreas Schneider Signed-off-by: Guenther Deschner --- source3/printing/nt_printing.c | 41 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 394a3e5e7e1..c05fb04c836 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1374,7 +1374,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx, { int snum; int n_services = lp_numservices(); - bool in_use = False; + bool in_use = false; struct spoolss_PrinterInfo2 *pinfo2 = NULL; WERROR result; @@ -1399,7 +1399,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx, } if (strequal(r->driver_name, pinfo2->drivername)) { - in_use = True; + in_use = true; } TALLOC_FREE(pinfo2); @@ -1416,26 +1416,31 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx, /* we can still remove the driver if there is one of "Windows NT x86" version 2 or 3 left */ - if (!strequal("Windows NT x86", r->architecture)) { + if (strequal(SPOOLSS_ARCHITECTURE_NT_X86, r->architecture)) { + if (r->version == 2) { + werr = winreg_get_driver(mem_ctx, b, + r->architecture, + r->driver_name, + 3, &driver); + } else if (r->version == 3) { + werr = winreg_get_driver(mem_ctx, b, + r->architecture, + r->driver_name, + 2, &driver); + } else { + DBG_ERR("Unknown driver version (%d)\n", + r->version); + werr = WERR_UNKNOWN_PRINTER_DRIVER; + } + } else if (strequal(SPOOLSS_ARCHITECTURE_x64, r->architecture)) { werr = winreg_get_driver(mem_ctx, b, - "Windows NT x86", + SPOOLSS_ARCHITECTURE_NT_X86, r->driver_name, DRIVER_ANY_VERSION, &driver); - } else if (r->version == 2) { - werr = winreg_get_driver(mem_ctx, b, - "Windows NT x86", - r->driver_name, - 3, &driver); - } else if (r->version == 3) { - werr = winreg_get_driver(mem_ctx, b, - "Windows NT x86", - r->driver_name, - 2, &driver); } else { - DEBUG(0, ("printer_driver_in_use: ERROR!" - " unknown driver version (%d)\n", - r->version)); + DBG_ERR("Unknown driver architecture: %s\n", + r->architecture); werr = WERR_UNKNOWN_PRINTER_DRIVER; } @@ -1443,7 +1448,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx, if ( W_ERROR_IS_OK(werr) ) { /* it's ok to remove the driver, we have other architctures left */ - in_use = False; + in_use = false; talloc_free(driver); } }