The branch, master has been updated
       via  e595590 s3-printing: remove tdb migration invalid printer name 
checks
       via  cfc3b6e s3-printing: make sure to first migrate the printers then 
the security descriptor.
       via  5dd8185 s3-printing: fill info2_mask in printer migration
       via  57bbb32 s3-printing: remove spoolss pipe from migration library, 
only using winreg finally.
       via  8f3d5f5 s3-printing: use winreg interface for migration, instead of 
spoolss.
       via  72b1f8b s3-printing: safe a ton of roundtrips by reusing existing 
winreg binding_handles.
       via  0a1ec73 s3-printing: use winreg_internal functions.
       via  ada5380 s3-printing: add winreg_internal functions.
       via  a762eda s3-printing: add winreg_printer_binding_handle and remove 
most of srv_spoolss_util.c.
       via  f2be837 s3-printing: add rpc_client/cli_winreg_spoolss.c
       via  a0fc64a s3-waf: make LIBCLI_SPOOLSS a shared library
       via  43cf3a2 s3-printing: move spoolss_create_default_devmode/secdesc to 
init_spoolss.h
       via  74e4160 s3-printing: move driver_info_ctr_to_info8 to init_spoolss.h
       via  dd5375b s3-printing: move os2 related functions to 
printing/nt_printing_os2.c.
      from  eba5d0b s3: Remove a use of cli_errstr

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e5955903fdc5ed6f8660b72db0716d4da25c711c
Author: David Disseldorp <dd...@suse.de>
Date:   Tue Jul 5 15:04:02 2011 +0200

    s3-printing: remove tdb migration invalid printer name checks
    
    WERR_INVALID_PRINTER_NAME only needed to be handled when printing tdb
    migration used spoolss, with winreg such errors are no longer possible.
    
    Signed-off-by: Günther Deschner <g...@samba.org>
    
    Autobuild-User: Günther Deschner <g...@samba.org>
    Autobuild-Date: Thu Jul  7 19:15:34 CEST 2011 on sn-devel-104

commit cfc3b6e5f79f253e83dfbd13d47b671deb5801b3
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 14:01:40 2011 +0200

    s3-printing: make sure to first migrate the printers then the security 
descriptor.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 5dd8185d852afc3843253c9471326677f8816a77
Author: David Disseldorp <dd...@suse.de>
Date:   Tue Jul 5 11:34:47 2011 +0200

    s3-printing: fill info2_mask in printer migration
    
    Also fix possibly uninitialised status return from
    printing_tdb_migrate_printer().

commit 57bbb32c64db1027e2b9ae1aef7f5f3b33ae3882
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 02:33:23 2011 +0200

    s3-printing: remove spoolss pipe from migration library, only using winreg 
finally.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 8f3d5f5333a61922c4ea7ff1e1d244978958e857
Author: Günther Deschner <g...@samba.org>
Date:   Mon Jul 4 19:47:07 2011 +0200

    s3-printing: use winreg interface for migration, instead of spoolss.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 72b1f8be5619ed778c4aa0b967f6a4f34d7e9de8
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 00:55:35 2011 +0200

    s3-printing: safe a ton of roundtrips by reusing existing winreg 
binding_handles.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 0a1ec73b965f66977a90fb7febb3b56b52ebab20
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 00:16:03 2011 +0200

    s3-printing: use winreg_internal functions.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit ada5380d2090179fc57eee66e2b46788f4944db0
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 00:16:47 2011 +0200

    s3-printing: add winreg_internal functions.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit a762eda519c995214c041170e2615c5c51b2a2b1
Author: Günther Deschner <g...@samba.org>
Date:   Mon Jul 4 20:09:54 2011 +0200

    s3-printing: add winreg_printer_binding_handle and remove most of 
srv_spoolss_util.c.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit f2be8378b92669092f8444df038f769fc9312ff4
Author: Günther Deschner <g...@samba.org>
Date:   Mon Jul 4 19:47:29 2011 +0200

    s3-printing: add rpc_client/cli_winreg_spoolss.c
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit a0fc64a88ee6f1f45d4c2b95d6773eccab50ebb4
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 11:29:37 2011 +0200

    s3-waf: make LIBCLI_SPOOLSS a shared library
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 43cf3a28dc539351da8a316e0e52a8292ec40cc7
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 02:15:35 2011 +0200

    s3-printing: move spoolss_create_default_devmode/secdesc to init_spoolss.h
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit 74e416031b2fc5d9c6af30f692d5b73cb1942cf4
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 02:12:24 2011 +0200

    s3-printing: move driver_info_ctr_to_info8 to init_spoolss.h
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

commit dd5375b4a1798c856fa9c104baa36c137d664b9d
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jul 5 01:24:48 2011 +0200

    s3-printing: move os2 related functions to printing/nt_printing_os2.c.
    
    Guenther
    
    Pair-Programmed-With: David Disseldorp <dd...@suse.de>

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in                                |    4 +-
 source3/include/nt_printing.h                      |   12 -
 source3/printing/nt_printing.c                     |  443 +--
 source3/printing/nt_printing_ads.c                 |   20 +-
 source3/printing/nt_printing_migrate.c             |  232 +-
 source3/printing/nt_printing_migrate.h             |    4 -
 source3/printing/nt_printing_migrate_internal.c    |   52 +-
 source3/printing/nt_printing_os2.c                 |  165 +
 ...inting_migrate_internal.h => nt_printing_os2.h} |   12 +-
 .../cli_winreg_spoolss.c}                          |  288 +-
 .../cli_winreg_spoolss.h}                          |  118 +-
 source3/rpc_client/init_spoolss.c                  |  264 ++
 source3/rpc_client/init_spoolss.h                  |    9 +
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |  382 +-
 source3/rpc_server/spoolss/srv_spoolss_util.c      | 4369 ++------------------
 source3/rpc_server/spoolss/srv_spoolss_util.h      |  687 +---
 source3/utils/net_printing.c                       |   30 +-
 source3/wscript_build                              |   11 +-
 18 files changed, 1313 insertions(+), 5789 deletions(-)
 create mode 100644 source3/printing/nt_printing_os2.c
 copy source3/printing/{nt_printing_migrate_internal.h => nt_printing_os2.h} 
(74%)
 copy source3/{rpc_server/spoolss/srv_spoolss_util.c => 
rpc_client/cli_winreg_spoolss.c} (93%)
 copy source3/{rpc_server/spoolss/srv_spoolss_util.h => 
rpc_client/cli_winreg_spoolss.h} (81%)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 3cfc6fa..8dc5153 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -348,7 +348,9 @@ LIBNDR_XATTR_OBJ = librpc/gen_ndr/ndr_xattr.o \
 
 LIBCLI_SPOOLSS_OBJ = librpc/gen_ndr/ndr_spoolss_c.o \
                     rpc_client/cli_spoolss.o \
-                    rpc_client/init_spoolss.o
+                    rpc_client/init_spoolss.o \
+                    rpc_client/cli_winreg_spoolss.o \
+                    printing/nt_printing_os2.o
 
 LIBCLI_EVENTLOG_OBJ = librpc/gen_ndr/ndr_eventlog_c.o
 
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index ad6262e..4f85159 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -126,15 +126,6 @@ struct print_architecture_table_node {
 
 bool nt_printing_init(struct messaging_context *msg_ctx);
 
-WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx,
-                                     const char *devicename,
-                                     struct spoolss_DeviceMode **devmode);
-
-WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
-                                     struct spoolss_security_descriptor 
**secdesc);
-
-WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char 
**pdrivername);
-
 const char *get_short_archi(const char *long_archi);
 
 bool print_access_check(const struct auth_serversupplied_info *server_info,
@@ -155,9 +146,6 @@ bool is_printer_published(TALLOC_CTX *mem_ctx,
 
 WERROR check_published_printers(struct messaging_context *msg_ctx);
 
-bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
-                             struct spoolss_DriverInfo8 *_info8);
-
 bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
                           const struct auth_serversupplied_info *server_info,
                           struct messaging_context *msg_ctx,
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 45d4191..fd2ab2a 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -32,6 +32,7 @@
 #include "auth.h"
 #include "messages.h"
 #include "rpc_server/spoolss/srv_spoolss_nt.h"
+#include "rpc_client/cli_winreg_spoolss.h"
 
 /* Map generic permissions to printer object specific permissions */
 
@@ -1168,410 +1169,6 @@ WERROR move_driver_to_download_area(struct 
auth_serversupplied_info *session_inf
 }
 
 /****************************************************************************
- Create and allocate a default devicemode.
-****************************************************************************/
-
-WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx,
-                                     const char *devicename,
-                                     struct spoolss_DeviceMode **devmode)
-{
-       struct spoolss_DeviceMode *dm;
-       char *dname;
-
-       dm = talloc_zero(mem_ctx, struct spoolss_DeviceMode);
-       if (dm == NULL) {
-               return WERR_NOMEM;
-       }
-
-       dname = talloc_asprintf(dm, "%s", devicename);
-       if (dname == NULL) {
-               return WERR_NOMEM;
-       }
-       if (strlen(dname) > MAXDEVICENAME) {
-               dname[MAXDEVICENAME] = '\0';
-       }
-       dm->devicename = dname;
-
-       dm->formname = talloc_strdup(dm, "Letter");
-       if (dm->formname == NULL) {
-               return WERR_NOMEM;
-       }
-
-       dm->specversion          = DMSPEC_NT4_AND_ABOVE;
-       dm->driverversion        = 0x0400;
-       dm->size                 = 0x00DC;
-       dm->__driverextra_length = 0;
-       dm->fields               = DEVMODE_FORMNAME |
-                                  DEVMODE_TTOPTION |
-                                  DEVMODE_PRINTQUALITY |
-                                  DEVMODE_DEFAULTSOURCE |
-                                  DEVMODE_COPIES |
-                                  DEVMODE_SCALE |
-                                  DEVMODE_PAPERSIZE |
-                                  DEVMODE_ORIENTATION;
-       dm->orientation          = DMORIENT_PORTRAIT;
-       dm->papersize            = DMPAPER_LETTER;
-       dm->paperlength          = 0;
-       dm->paperwidth           = 0;
-       dm->scale                = 0x64;
-       dm->copies               = 1;
-       dm->defaultsource        = DMBIN_FORMSOURCE;
-       dm->printquality         = DMRES_HIGH;           /* 0x0258 */
-       dm->color                = DMRES_MONOCHROME;
-       dm->duplex               = DMDUP_SIMPLEX;
-       dm->yresolution          = 0;
-       dm->ttoption             = DMTT_SUBDEV;
-       dm->collate              = DMCOLLATE_FALSE;
-       dm->icmmethod            = 0;
-       dm->icmintent            = 0;
-       dm->mediatype            = 0;
-       dm->dithertype           = 0;
-
-       dm->logpixels            = 0;
-       dm->bitsperpel           = 0;
-       dm->pelswidth            = 0;
-       dm->pelsheight           = 0;
-       dm->displayflags         = 0;
-       dm->displayfrequency     = 0;
-       dm->reserved1            = 0;
-       dm->reserved2            = 0;
-       dm->panningwidth         = 0;
-       dm->panningheight        = 0;
-
-       dm->driverextra_data.data = NULL;
-       dm->driverextra_data.length = 0;
-
-        *devmode = dm;
-       return WERR_OK;
-}
-
-WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
-                                     struct spoolss_security_descriptor 
**secdesc)
-{
-       struct security_ace ace[7];     /* max number of ace entries */
-       int i = 0;
-       uint32_t sa;
-       struct security_acl *psa = NULL;
-       struct security_descriptor *psd = NULL;
-       struct dom_sid adm_sid;
-       size_t sd_size;
-
-       /* Create an ACE where Everyone is allowed to print */
-
-       sa = PRINTER_ACE_PRINT;
-       init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
-                    sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
-       /* Add the domain admins group if we are a DC */
-
-       if ( IS_DC ) {
-               struct dom_sid domadmins_sid;
-
-               sid_compose(&domadmins_sid, get_global_sam_sid(),
-                           DOMAIN_RID_ADMINS);
-
-               sa = PRINTER_ACE_FULL_CONTROL;
-               init_sec_ace(&ace[i++], &domadmins_sid,
-                       SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
-                       SEC_ACE_FLAG_OBJECT_INHERIT | 
SEC_ACE_FLAG_INHERIT_ONLY);
-               init_sec_ace(&ace[i++], &domadmins_sid, 
SEC_ACE_TYPE_ACCESS_ALLOWED,
-                       sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-       }
-       else if (secrets_fetch_domain_sid(lp_workgroup(), &adm_sid)) {
-               sid_append_rid(&adm_sid, DOMAIN_RID_ADMINISTRATOR);
-
-               sa = PRINTER_ACE_FULL_CONTROL;
-               init_sec_ace(&ace[i++], &adm_sid,
-                       SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
-                       SEC_ACE_FLAG_OBJECT_INHERIT | 
SEC_ACE_FLAG_INHERIT_ONLY);
-               init_sec_ace(&ace[i++], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
-                       sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-       }
-
-       /* add BUILTIN\Administrators as FULL CONTROL */
-
-       sa = PRINTER_ACE_FULL_CONTROL;
-       init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
-               SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
-               SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
-       init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
-               SEC_ACE_TYPE_ACCESS_ALLOWED,
-               sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
-       /* add BUILTIN\Print Operators as FULL CONTROL */
-
-       sa = PRINTER_ACE_FULL_CONTROL;
-       init_sec_ace(&ace[i++], &global_sid_Builtin_Print_Operators,
-               SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
-               SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
-       init_sec_ace(&ace[i++], &global_sid_Builtin_Print_Operators,
-               SEC_ACE_TYPE_ACCESS_ALLOWED,
-               sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
-       /* Make the security descriptor owned by the BUILTIN\Administrators */
-
-       /* The ACL revision number in rpc_secdesc.h differs from the one
-          created by NT when setting ACE entries in printer
-          descriptors.  NT4 complains about the property being edited by a
-          NT5 machine. */
-
-       if ((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, i, ace)) != NULL) {
-               psd = make_sec_desc(mem_ctx,
-                                   SD_REVISION,
-                                   SEC_DESC_SELF_RELATIVE,
-                                   &global_sid_Builtin_Administrators,
-                                   &global_sid_Builtin_Administrators,
-                                   NULL,
-                                   psa,
-                                   &sd_size);
-       }
-
-       if (psd == NULL) {
-               DEBUG(0,("construct_default_printer_sd: Failed to make 
SEC_DESC.\n"));
-               return WERR_NOMEM;
-       }
-
-       DEBUG(4,("construct_default_printer_sdb: size = %u.\n",
-                (unsigned int)sd_size));
-
-       *secdesc = psd;
-
-       return WERR_OK;
-}
-
-/****************************************************************************
- ***************************************************************************/
-
-static char *win_driver;
-static char *os2_driver;
-
-static const char *get_win_driver(void)
-{
-       if (win_driver == NULL) {
-               return "";
-       }
-       return win_driver;
-}
-
-static const char *get_os2_driver(void)
-{
-       if (os2_driver == NULL) {
-               return "";
-       }
-       return os2_driver;
-}
-
-static bool set_driver_mapping(const char *from, const char *to)
-{
-       SAFE_FREE(win_driver);
-       SAFE_FREE(os2_driver);
-
-       win_driver = SMB_STRDUP(from);
-       os2_driver = SMB_STRDUP(to);
-
-       if (win_driver == NULL || os2_driver == NULL) {
-               SAFE_FREE(win_driver);
-               SAFE_FREE(os2_driver);
-               return false;
-       }
-       return true;
-}
-
-/**
- * @internal
- *
- * @brief Map a Windows driver to a OS/2 driver.
- *
- * @param[in]  mem_ctx  The memory context to use.
- *
- * @param[in,out] pdrivername The drivername of Windows to remap.
- *
- * @return              WERR_OK on success, a corresponding WERROR on failure.
- */
-WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername)
-{
-       const char *mapfile = lp_os2_driver_map();
-       char **lines = NULL;
-       const char *drivername;
-       int numlines = 0;
-       int i;
-
-       if (pdrivername == NULL || *pdrivername == NULL || *pdrivername[0] == 
'\0') {
-               return WERR_INVALID_PARAMETER;
-       }
-
-       drivername = *pdrivername;
-
-       if (mapfile[0] == '\0') {
-               return WERR_BADFILE;
-       }
-
-       if (strequal(drivername, get_win_driver())) {
-               DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",
-                       drivername, get_os2_driver()));
-               drivername = talloc_strdup(mem_ctx, get_os2_driver());
-               if (drivername == NULL) {
-                       return WERR_NOMEM;
-               }
-               *pdrivername = drivername;
-               return WERR_OK;
-       }
-
-       lines = file_lines_load(mapfile, &numlines, 0, NULL);
-       if (numlines == 0 || lines == NULL) {
-               DEBUG(0,("No entries in OS/2 driver map %s\n", mapfile));
-               TALLOC_FREE(lines);
-               return WERR_EMPTY;
-       }
-
-       DEBUG(4,("Scanning OS/2 driver map %s\n",mapfile));
-
-       for( i = 0; i < numlines; i++) {
-               char *nt_name = lines[i];
-               char *os2_name = strchr(nt_name, '=');
-
-               if (os2_name == NULL) {
-                       continue;
-               }
-
-               *os2_name++ = '\0';
-
-               while (isspace(*nt_name)) {
-                       nt_name++;
-               }
-
-               if (*nt_name == '\0' || strchr("#;", *nt_name)) {
-                       continue;
-               }
-
-               {
-                       int l = strlen(nt_name);
-                       while (l && isspace(nt_name[l - 1])) {
-                               nt_name[l - 1] = 0;
-                               l--;
-                       }
-               }
-
-               while (isspace(*os2_name)) {
-                       os2_name++;
-               }
-
-               {
-                       int l = strlen(os2_name);
-                       while (l && isspace(os2_name[l-1])) {
-                               os2_name[l-1] = 0;
-                               l--;
-                       }
-               }
-
-               if (strequal(nt_name, drivername)) {
-                       DEBUG(3,("Mapped Windows driver %s to OS/2 driver 
%s\n",drivername,os2_name));
-                       set_driver_mapping(drivername, os2_name);
-                       drivername = talloc_strdup(mem_ctx, os2_name);
-                       TALLOC_FREE(lines);
-                       if (drivername == NULL) {
-                               return WERR_NOMEM;
-                       }
-                       *pdrivername = drivername;
-                       return WERR_OK;
-               }
-       }
-
-       TALLOC_FREE(lines);
-       return WERR_OK;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
-                             struct spoolss_DriverInfo8 *_info8)
-{
-       struct spoolss_DriverInfo8 info8;
-
-       ZERO_STRUCT(info8);
-
-       switch (r->level) {
-       case 3:
-               info8.version           = r->info.info3->version;
-               info8.driver_name       = r->info.info3->driver_name;
-               info8.architecture      = r->info.info3->architecture;
-               info8.driver_path       = r->info.info3->driver_path;
-               info8.data_file         = r->info.info3->data_file;
-               info8.config_file       = r->info.info3->config_file;
-               info8.help_file         = r->info.info3->help_file;
-               info8.monitor_name      = r->info.info3->monitor_name;
-               info8.default_datatype  = r->info.info3->default_datatype;
-               if (r->info.info3->dependent_files && 
r->info.info3->dependent_files->string) {
-                       info8.dependent_files   = 
r->info.info3->dependent_files->string;
-               }
-               break;
-       case 6:
-               info8.version           = r->info.info6->version;
-               info8.driver_name       = r->info.info6->driver_name;
-               info8.architecture      = r->info.info6->architecture;
-               info8.driver_path       = r->info.info6->driver_path;
-               info8.data_file         = r->info.info6->data_file;
-               info8.config_file       = r->info.info6->config_file;
-               info8.help_file         = r->info.info6->help_file;
-               info8.monitor_name      = r->info.info6->monitor_name;
-               info8.default_datatype  = r->info.info6->default_datatype;
-               if (r->info.info6->dependent_files && 
r->info.info6->dependent_files->string) {
-                       info8.dependent_files   = 
r->info.info6->dependent_files->string;
-               }
-               info8.driver_date       = r->info.info6->driver_date;
-               info8.driver_version    = r->info.info6->driver_version;
-               info8.manufacturer_name = r->info.info6->manufacturer_name;
-               info8.manufacturer_url  = r->info.info6->manufacturer_url;
-               info8.hardware_id       = r->info.info6->hardware_id;
-               info8.provider          = r->info.info6->provider;
-               break;
-       case 8:
-               info8.version           = r->info.info8->version;
-               info8.driver_name       = r->info.info8->driver_name;
-               info8.architecture      = r->info.info8->architecture;
-               info8.driver_path       = r->info.info8->driver_path;
-               info8.data_file         = r->info.info8->data_file;
-               info8.config_file       = r->info.info8->config_file;
-               info8.help_file         = r->info.info8->help_file;
-               info8.monitor_name      = r->info.info8->monitor_name;
-               info8.default_datatype  = r->info.info8->default_datatype;
-               if (r->info.info8->dependent_files && 
r->info.info8->dependent_files->string) {
-                       info8.dependent_files   = 
r->info.info8->dependent_files->string;
-               }
-               if (r->info.info8->previous_names && 
r->info.info8->previous_names->string) {
-                       info8.previous_names    = 
r->info.info8->previous_names->string;
-               }
-               info8.driver_date       = r->info.info8->driver_date;
-               info8.driver_version    = r->info.info8->driver_version;
-               info8.manufacturer_name = r->info.info8->manufacturer_name;
-               info8.manufacturer_url  = r->info.info8->manufacturer_url;
-               info8.hardware_id       = r->info.info8->hardware_id;
-               info8.provider          = r->info.info8->provider;
-               info8.print_processor   = r->info.info8->print_processor;
-               info8.vendor_setup      = r->info.info8->vendor_setup;
-               if (r->info.info8->color_profiles && 
r->info.info8->color_profiles->string) {
-                       info8.color_profiles = 
r->info.info8->color_profiles->string;
-               }
-               info8.inf_path          = r->info.info8->inf_path;
-               info8.printer_driver_attributes = 
r->info.info8->printer_driver_attributes;
-               if (r->info.info8->core_driver_dependencies && 
r->info.info8->core_driver_dependencies->string) {
-                       info8.core_driver_dependencies = 
r->info.info8->core_driver_dependencies->string;
-               }
-               info8.min_inbox_driver_ver_date = 
r->info.info8->min_inbox_driver_ver_date;
-               info8.min_inbox_driver_ver_version = 
r->info.info8->min_inbox_driver_ver_version;
-               break;
-       default:
-               return false;
-       }
-
-       *_info8 = info8;
-
-       return true;
-}
-
-
-/****************************************************************************
   Determine whether or not a particular driver is currently assigned
   to a printer
 ****************************************************************************/
@@ -1586,6 +1183,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
        bool in_use = False;
        struct spoolss_PrinterInfo2 *pinfo2 = NULL;
        WERROR result;
+       struct dcerpc_binding_handle *b = NULL;
 
        if (!r) {
                return false;
@@ -1600,7 +1198,17 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
                        continue;
                }
 
-               result = winreg_get_printer(mem_ctx, session_info, msg_ctx,
+               if (b == NULL) {
+                       result = winreg_printer_binding_handle(mem_ctx,
+                                                              session_info,
+                                                              msg_ctx,
+                                                              &b);
+                       if (!W_ERROR_IS_OK(result)) {
+                               return false;
+                       }
+               }
+
+               result = winreg_get_printer(mem_ctx, b,
                                            lp_servicename(snum),
                                            &pinfo2);
                if (!W_ERROR_IS_OK(result)) {
@@ -1626,18 +1234,18 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
                   "Windows NT x86" version 2 or 3 left */
 
                if (!strequal("Windows NT x86", r->architecture)) {
-                       werr = winreg_get_driver(mem_ctx, session_info, msg_ctx,


-- 
Samba Shared Repository

Reply via email to