s3-spoolss: use driver level info8 everywhere in spoolss server internally.
authorGünther Deschner <gd@samba.org>
Fri, 27 Nov 2009 00:49:08 +0000 (01:49 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 8 Dec 2009 10:05:21 +0000 (11:05 +0100)
Guenther

source3/include/proto.h
source3/printing/nt_printing.c
source3/registry/reg_backend_printing.c
source3/rpc_server/srv_spoolss_nt.c
source3/smbd/lanman.c

index 6ae9e8801e1f5cfbf8d7cfb6e5c2d072e1f71d07..3fd1d189774978a3586942c46f14485307c04eeb 100644 (file)
@@ -4869,15 +4869,15 @@ uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
                              char **driver_name,
                              uint32_t *version);
 WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
-                           union spoolss_DriverInfo **driver_p, uint32_t level,
+                           struct spoolss_DriverInfo8 **driver_p,
                            const char *drivername, const char *architecture,
                            uint32_t version);
-uint32_t free_a_printer_driver(union spoolss_DriverInfo *driver);
-bool printer_driver_in_use(const struct spoolss_DriverInfo3 *info_3);
+uint32_t free_a_printer_driver(struct spoolss_DriverInfo8 *driver);
+bool printer_driver_in_use(const struct spoolss_DriverInfo8 *r);
 bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
-                                struct spoolss_DriverInfo3 *info);
+                                struct spoolss_DriverInfo8 *r);
 WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
-                            const struct spoolss_DriverInfo3 *info_3,
+                            const struct spoolss_DriverInfo8 *r,
                             uint32 version, bool delete_files );
 WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr);
 bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **secdesc_ctr);
index 553eed6bcfc726037df875f26730ac20a9472144..1f306512af512823a0101f4b5ab26314fd503ef7 100644 (file)
@@ -1717,6 +1717,32 @@ static void convert_level_6_to_level3(struct spoolss_AddDriverInfo3 *dst,
        dst->dependent_files    = src->dependent_files;
 }
 
+/****************************************************************************
+ This function sucks and should be replaced. JRA.
+****************************************************************************/
+
+static void convert_level_8_to_level3(TALLOC_CTX *mem_ctx,
+                                     struct spoolss_AddDriverInfo3 *dst,
+                                     const struct spoolss_DriverInfo8 *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;
+       if (src->dependent_files) {
+               dst->dependent_files = talloc_zero(mem_ctx, struct spoolss_StringArray);
+               if (!dst->dependent_files) return;
+               dst->dependent_files->string = src->dependent_files;
+       } else {
+               dst->dependent_files = NULL;
+       }
+}
+
 /****************************************************************************
 ****************************************************************************/
 
@@ -2120,15 +2146,19 @@ done:
 /****************************************************************************
 ****************************************************************************/
 
-static uint32 add_a_printer_driver_6(struct spoolss_AddDriverInfo6 *driver)
+static uint32_t add_a_printer_driver_8(struct spoolss_DriverInfo8 *driver)
 {
+       TALLOC_CTX *mem_ctx = talloc_new(talloc_tos());
        struct spoolss_AddDriverInfo3 info3;
+       uint32_t ret;
 
-       convert_level_6_to_level3(&info3, driver);
+       convert_level_8_to_level3(mem_ctx, &info3, driver);
 
-       return add_a_printer_driver_3(&info3);
-}
+       ret = add_a_printer_driver_3(&info3);
+       talloc_free(mem_ctx);
 
+       return ret;
+}
 
 /****************************************************************************
 ****************************************************************************/
@@ -4602,93 +4632,158 @@ uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level)
 
 /****************************************************************************
 ****************************************************************************/
+
 uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
                              struct spoolss_AddDriverInfoCtr *r,
                              char **driver_name,
                              uint32_t *version)
 {
-       uint32 result;
+       struct spoolss_DriverInfo8 info8;
+
+       ZERO_STRUCT(info8);
+
        DEBUG(10,("adding a printer at level [%d]\n", r->level));
 
        switch (r->level) {
        case 3:
-               result = add_a_printer_driver_3(r->info.info3);
-               if (result == 0) {
-                       *driver_name = talloc_strdup(mem_ctx, r->info.info3->driver_name);
-                       if (!*driver_name) {
-                               return -1;
-                       }
-                       *version = r->info.info3->version;
+               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:
-               result = add_a_printer_driver_6(r->info.info6);
-               if (result == 0) {
-                       *driver_name = talloc_strdup(mem_ctx, r->info.info6->driver_name);
-                       if (!*driver_name) {
-                               return -1;
-                       }
-                       *version = r->info.info6->version;
+               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;
-       default:
-               result = 1;
+       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 -1;
        }
 
-       return result;
+       *driver_name = talloc_strdup(mem_ctx, info8.driver_name);
+       if (!*driver_name) {
+               return -1;
+       }
+       *version = info8.version;
+
+       return add_a_printer_driver_8(&info8);
 }
+
 /****************************************************************************
 ****************************************************************************/
 
 WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
-                           union spoolss_DriverInfo **driver_p, uint32_t level,
+                           struct spoolss_DriverInfo8 **driver,
                            const char *drivername, const char *architecture,
                            uint32_t version)
 {
        WERROR result;
-       union spoolss_DriverInfo *driver;
-
-       driver = talloc_zero(mem_ctx, union spoolss_DriverInfo);
-       W_ERROR_HAVE_NO_MEMORY(driver);
-
-       switch (level) {
-               case 3:
-                       /* Sometime we just want any version of the driver */
-
-                       if ( version == DRIVER_ANY_VERSION ) {
-                               /* look for Win2k first and then for NT4 */
-                               result = get_a_printer_driver_3(driver,
-                                                               &driver->info3,
-                                                               drivername,
-                                                               architecture, 3);
-
-                               if ( !W_ERROR_IS_OK(result) ) {
-                                       result = get_a_printer_driver_3(driver,
-                                                                       &driver->info3,
-                                                                       drivername,
-                                                                       architecture, 2);
-                               }
-                       } else {
-                               result = get_a_printer_driver_3(driver,
-                                                               &driver->info3,
-                                                               drivername,
-                                                               architecture,
-                                                               version);
-                       }
-                       break;
-
-               default:
-                       result=W_ERROR(1);
-                       break;
+       struct spoolss_DriverInfo3 info3;
+       struct spoolss_DriverInfo8 *info8;
+
+       ZERO_STRUCT(info3);
+
+       /* Sometime we just want any version of the driver */
+
+       if (version == DRIVER_ANY_VERSION) {
+               /* look for Win2k first and then for NT4 */
+               result = get_a_printer_driver_3(mem_ctx,
+                                               &info3,
+                                               drivername,
+                                               architecture, 3);
+               if (!W_ERROR_IS_OK(result)) {
+                       result = get_a_printer_driver_3(mem_ctx,
+                                                       &info3,
+                                                       drivername,
+                                                       architecture, 2);
+               }
+       } else {
+               result = get_a_printer_driver_3(mem_ctx,
+                                               &info3,
+                                               drivername,
+                                               architecture,
+                                               version);
        }
 
        if (!W_ERROR_IS_OK(result)) {
-               TALLOC_FREE(driver);
                return result;
        }
 
-       *driver_p = driver;
+       info8 = talloc_zero(mem_ctx, struct spoolss_DriverInfo8);
+       if (!info8) {
+               return WERR_NOMEM;
+       }
+
+       info8->version          = info3.version;
+       info8->driver_name      = info3.driver_name;
+       info8->architecture     = info3.architecture;
+       info8->driver_path      = info3.driver_path;
+       info8->data_file        = info3.data_file;
+       info8->config_file      = info3.config_file;
+       info8->help_file        = info3.help_file;
+       info8->dependent_files  = info3.dependent_files;
+       info8->monitor_name     = info3.monitor_name;
+       info8->default_datatype = info3.default_datatype;
+
+       *driver = info8;
 
        return WERR_OK;
 }
@@ -4696,7 +4791,7 @@ WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
 /****************************************************************************
 ****************************************************************************/
 
-uint32_t free_a_printer_driver(union spoolss_DriverInfo *driver)
+uint32_t free_a_printer_driver(struct spoolss_DriverInfo8 *driver)
 {
        talloc_free(driver);
        return 0;
@@ -4708,15 +4803,16 @@ uint32_t free_a_printer_driver(union spoolss_DriverInfo *driver)
   to a printer
 ****************************************************************************/
 
-bool printer_driver_in_use(const struct spoolss_DriverInfo3 *info_3)
+bool printer_driver_in_use(const struct spoolss_DriverInfo8 *r)
 {
        int snum;
        int n_services = lp_numservices();
        NT_PRINTER_INFO_LEVEL *printer = NULL;
        bool in_use = False;
 
-       if ( !info_3 )
-               return False;
+       if (!r) {
+               return false;
+       }
 
        DEBUG(10,("printer_driver_in_use: Beginning search through ntprinters.tdb...\n"));
 
@@ -4729,7 +4825,7 @@ bool printer_driver_in_use(const struct spoolss_DriverInfo3 *info_3)
                if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, lp_servicename(snum))) )
                        continue;
 
-               if (strequal(info_3->driver_name, printer->info_2->drivername))
+               if (strequal(r->driver_name, printer->info_2->drivername))
                        in_use = True;
 
                free_a_printer( &printer, 2 );
@@ -4738,28 +4834,28 @@ bool printer_driver_in_use(const struct spoolss_DriverInfo3 *info_3)
        DEBUG(10,("printer_driver_in_use: Completed search through ntprinters.tdb...\n"));
 
        if ( in_use ) {
-               union spoolss_DriverInfo *d;
+               struct spoolss_DriverInfo8 *d;
                WERROR werr;
 
-               DEBUG(5,("printer_driver_in_use: driver \"%s\" is currently in use\n", info_3->driver_name));
+               DEBUG(5,("printer_driver_in_use: driver \"%s\" is currently in use\n", r->driver_name));
 
                /* we can still remove the driver if there is one of
                   "Windows NT x86" version 2 or 3 left */
 
-               if (!strequal("Windows NT x86", info_3->architecture)) {
-                       werr = get_a_printer_driver(talloc_tos(), &d, 3, info_3->driver_name, "Windows NT x86", DRIVER_ANY_VERSION);
+               if (!strequal("Windows NT x86", r->architecture)) {
+                       werr = get_a_printer_driver(talloc_tos(), &d, r->driver_name, "Windows NT x86", DRIVER_ANY_VERSION);
                }
                else {
-                       switch (info_3->version) {
+                       switch (r->version) {
                        case 2:
-                               werr = get_a_printer_driver(talloc_tos(), &d, 3, info_3->driver_name, "Windows NT x86", 3);
+                               werr = get_a_printer_driver(talloc_tos(), &d, r->driver_name, "Windows NT x86", 3);
                                break;
                        case 3:
-                               werr = get_a_printer_driver(talloc_tos(), &d, 3, info_3->driver_name, "Windows NT x86", 2);
+                               werr = get_a_printer_driver(talloc_tos(), &d, r->driver_name, "Windows NT x86", 2);
                                break;
                        default:
                                DEBUG(0,("printer_driver_in_use: ERROR! unknown driver version (%d)\n",
-                                       info_3->version));
+                                       r->version));
                                werr = WERR_UNKNOWN_PRINTER_DRIVER;
                                break;
                        }
@@ -4784,7 +4880,7 @@ bool printer_driver_in_use(const struct spoolss_DriverInfo3 *info_3)
  Check to see if a ogiven file is in use by *info
  *********************************************************************/
 
-static bool drv_file_in_use(const char *file, const struct spoolss_DriverInfo3 *info)
+static bool drv_file_in_use(const char *file, const struct spoolss_DriverInfo8 *info)
 {
        int i = 0;
 
@@ -4848,8 +4944,8 @@ static void trim_dependent_file(TALLOC_CTX *mem_ctx, const char **files, int idx
  *********************************************************************/
 
 static bool trim_overlap_drv_files(TALLOC_CTX *mem_ctx,
-                                  struct spoolss_DriverInfo3 *src,
-                                  const struct spoolss_DriverInfo3 *drv)
+                                  struct spoolss_DriverInfo8 *src,
+                                  const struct spoolss_DriverInfo8 *drv)
 {
        bool    in_use = False;
        int     i = 0;
@@ -4922,13 +5018,13 @@ static bool trim_overlap_drv_files(TALLOC_CTX *mem_ctx,
 ****************************************************************************/
 
 bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
-                                struct spoolss_DriverInfo3 *info)
+                                struct spoolss_DriverInfo8 *info)
 {
        int                             i;
        int                             ndrivers;
        uint32                          version;
        fstring                         *list = NULL;
-       union spoolss_DriverInfo        *driver;
+       struct spoolss_DriverInfo8      *driver;
        bool in_use = false;
 
        if ( !info )
@@ -4955,7 +5051,7 @@ bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
 
                driver = NULL;
 
-               if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, 3, list[i], info->architecture, version))) {
+               if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, list[i], info->architecture, version))) {
                        SAFE_FREE(list);
                        return True;
                }
@@ -4963,8 +5059,8 @@ bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
                /* check if d2 uses any files from d1 */
                /* only if this is a different driver than the one being deleted */
 
-               if (!strequal(info->driver_name, driver->info3.driver_name)) {
-                       if (trim_overlap_drv_files(mem_ctx, info, &driver->info3)) {
+               if (!strequal(info->driver_name, driver->driver_name)) {
+                       if (trim_overlap_drv_files(mem_ctx, info, driver)) {
                                /* mz: Do not instantly return -
                                 * we need to ensure this file isn't
                                 * also in use by other drivers. */
@@ -5007,7 +5103,7 @@ static NTSTATUS driver_unlink_internals(connection_struct *conn,
 ****************************************************************************/
 
 static bool delete_driver_files(struct pipes_struct *rpc_pipe,
-                               const struct spoolss_DriverInfo3 *info_3)
+                               const struct spoolss_DriverInfo8 *r)
 {
        int i = 0;
        char *s;
@@ -5019,11 +5115,12 @@ static bool delete_driver_files(struct pipes_struct *rpc_pipe,
        int printdollar_snum;
        bool ret = false;
 
-       if ( !info_3 )
-               return False;
+       if (!r) {
+               return false;
+       }
 
        DEBUG(6,("delete_driver_files: deleting driver [%s] - version [%d]\n",
-               info_3->driver_name, info_3->version));
+               r->driver_name, r->version));
 
        fstrcpy(printdollar, "print$");
 
@@ -5049,32 +5146,32 @@ static bool delete_driver_files(struct pipes_struct *rpc_pipe,
        /* now delete the files; must strip the '\print$' string from
           fron of path                                                */
 
-       if (info_3->driver_path && info_3->driver_path[0]) {
-               if ((s = strchr(&info_3->driver_path[1], '\\')) != NULL) {
+       if (r->driver_path && r->driver_path[0]) {
+               if ((s = strchr(&r->driver_path[1], '\\')) != NULL) {
                        file = s;
                        DEBUG(10,("deleting driverfile [%s]\n", s));
                        driver_unlink_internals(conn, file);
                }
        }
 
-       if (info_3->config_file && info_3->config_file[0]) {
-               if ((s = strchr(&info_3->config_file[1], '\\')) != NULL) {
+       if (r->config_file && r->config_file[0]) {
+               if ((s = strchr(&r->config_file[1], '\\')) != NULL) {
                        file = s;
                        DEBUG(10,("deleting configfile [%s]\n", s));
                        driver_unlink_internals(conn, file);
                }
        }
 
-       if (info_3->data_file && info_3->data_file[0]) {
-               if ((s = strchr(&info_3->data_file[1], '\\')) != NULL) {
+       if (r->data_file && r->data_file[0]) {
+               if ((s = strchr(&r->data_file[1], '\\')) != NULL) {
                        file = s;
                        DEBUG(10,("deleting datafile [%s]\n", s));
                        driver_unlink_internals(conn, file);
                }
        }
 
-       if (info_3->help_file && info_3->help_file[0]) {
-               if ((s = strchr( &info_3->help_file[1], '\\')) != NULL) {
+       if (r->help_file && r->help_file[0]) {
+               if ((s = strchr(&r->help_file[1], '\\')) != NULL) {
                        file = s;
                        DEBUG(10,("deleting helpfile [%s]\n", s));
                        driver_unlink_internals(conn, file);
@@ -5083,13 +5180,13 @@ static bool delete_driver_files(struct pipes_struct *rpc_pipe,
 
        /* check if we are done removing files */
 
-       if (info_3->dependent_files) {
-               while (info_3->dependent_files[i] && info_3->dependent_files[i][0]) {
+       if (r->dependent_files) {
+               while (r->dependent_files[i] && r->dependent_files[i][0]) {
                        char *p;
 
                        /* bypass the "\print$" portion of the path */
 
-                       if ((p = strchr(info_3->dependent_files[i]+1, '\\')) != NULL) {
+                       if ((p = strchr(r->dependent_files[i]+1, '\\')) != NULL) {
                                file = p;
                                DEBUG(10,("deleting dependent file [%s]\n", file));
                                driver_unlink_internals(conn, file);
@@ -5116,7 +5213,7 @@ static bool delete_driver_files(struct pipes_struct *rpc_pipe,
  ***************************************************************************/
 
 WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
-                            const struct spoolss_DriverInfo3 *info_3,
+                            const struct spoolss_DriverInfo8 *r,
                             uint32 version, bool delete_files )
 {
        char *key = NULL;
@@ -5125,12 +5222,12 @@ WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
 
        /* delete the tdb data first */
 
-       arch = get_short_archi(info_3->architecture);
+       arch = get_short_archi(r->architecture);
        if (!arch) {
                return WERR_UNKNOWN_PRINTER_DRIVER;
        }
        if (asprintf(&key, "%s%s/%d/%s", DRIVERS_PREFIX,
-                       arch, version, info_3->driver_name) < 0) {
+                       arch, version, r->driver_name) < 0) {
                return WERR_NOMEM;
        }
 
@@ -5163,7 +5260,7 @@ WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
         */
 
        if ( delete_files )
-               delete_driver_files(rpc_pipe, info_3);
+               delete_driver_files(rpc_pipe, r);
 
        DEBUG(5,("delete_printer_driver: driver delete successful [%s]\n", key));
        SAFE_FREE(key);
index 05bb6efb38bb278a2b5aacd1582549216fe075e3..90ccc33c4c9b54f735114f650941db3bfe1cfcbc 100644 (file)
@@ -884,7 +884,7 @@ static int key_driver_fetch_keys( const char *key, struct regsubkey_ctr *subkeys
 /**********************************************************************
  *********************************************************************/
 
-static void fill_in_driver_values(const struct spoolss_DriverInfo3 *info3,
+static void fill_in_driver_values(const struct spoolss_DriverInfo8 *r,
                                  struct regval_ctr *values)
 {
        char *buffer = NULL;
@@ -893,32 +893,32 @@ static void fill_in_driver_values(const struct spoolss_DriverInfo3 *info3,
        const char *filename;
        DATA_BLOB data;
 
-       filename = dos_basename(info3->driver_path);
+       filename = dos_basename(r->driver_path);
        regval_ctr_addvalue_sz(values, "Driver", filename);
 
-       filename = dos_basename(info3->config_file);
+       filename = dos_basename(r->config_file);
        regval_ctr_addvalue_sz(values, "Configuration File", filename);
 
-       filename = dos_basename(info3->data_file);
+       filename = dos_basename(r->data_file);
        regval_ctr_addvalue_sz(values, "Data File", filename);
 
-       filename = dos_basename(info3->help_file);
+       filename = dos_basename(r->help_file);
        regval_ctr_addvalue_sz(values, "Help File", filename);
 
-       regval_ctr_addvalue_sz(values, "Data Type", info3->default_datatype);
+       regval_ctr_addvalue_sz(values, "Data Type", r->default_datatype);
 
-       regval_ctr_addvalue( values, "Version", REG_DWORD, (char*)&info3->version,
-               sizeof(info3->version) );
+       regval_ctr_addvalue( values, "Version", REG_DWORD, (char*)&r->version,
+               sizeof(r->version) );
 
-       if (info3->dependent_files) {
+       if (r->dependent_files) {
                /* place the list of dependent files in a single
                   character buffer, separating each file name by
                   a NULL */
 
-               for (i=0; info3->dependent_files[i] && strcmp(info3->dependent_files[i], ""); i++) {
+               for (i=0; r->dependent_files[i] && strcmp(r->dependent_files[i], ""); i++) {
                        /* strip the path to only the file's base name */
 
-                       filename = dos_basename(info3->dependent_files[i]);
+                       filename = dos_basename(r->dependent_files[i]);
 
                        length = strlen(filename);
 
@@ -960,7 +960,7 @@ static int driver_arch_fetch_values(char *key, struct regval_ctr *values)
        fstring         arch_environment;
        fstring         driver;
        int             version;
-       union spoolss_DriverInfo *driver_ctr;
+       struct spoolss_DriverInfo8 *driver_ctr;
        WERROR          w_result;
 
        if (!reg_split_path( key, &base, &subkeypath )) {
@@ -1021,12 +1021,12 @@ static int driver_arch_fetch_values(char *key, struct regval_ctr *values)
 
        fstrcpy( driver, base );
 
-       w_result = get_a_printer_driver(talloc_tos(), &driver_ctr, 3, driver, arch_environment, version);
+       w_result = get_a_printer_driver(talloc_tos(), &driver_ctr, driver, arch_environment, version);
 
        if ( !W_ERROR_IS_OK(w_result) )
                return -1;
 
-       fill_in_driver_values(&driver_ctr->info3, values);
+       fill_in_driver_values(driver_ctr, values);
 
        free_a_printer_driver(driver_ctr);
 
index 385ae08ebc0d703033800739bc4ebbaa8e74eaba..1dec824e9dfecd44cdaf72cd6c9439b785b188c4 100644 (file)
@@ -1928,8 +1928,8 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
                                    struct spoolss_DeletePrinterDriver *r)
 {
 
-       union spoolss_DriverInfo *info = NULL;
-       union spoolss_DriverInfo *info_win2k = NULL;
+       struct spoolss_DriverInfo8 *info = NULL;
+       struct spoolss_DriverInfo8 *info_win2k = NULL;
        int                             version;
        WERROR                          status;
        WERROR                          status_win2k = WERR_ACCESS_DENIED;
@@ -1953,7 +1953,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
        if ((version = get_version_id(r->in.architecture)) == -1)
                return WERR_INVALID_ENVIRONMENT;
 
-       if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info, 3, r->in.driver,
+       if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info, r->in.driver,
                                                r->in.architecture,
                                                version)))
        {
@@ -1962,7 +1962,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
                if ( version == 2 ) {
                        version = 3;
                        if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx,
-                                                               &info, 3,
+                                                               &info,
                                                                r->in.driver,
                                                                r->in.architecture,
                                                                version))) {
@@ -1978,7 +1978,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
 
        }
 
-       if (printer_driver_in_use(&info->info3)) {
+       if (printer_driver_in_use(info)) {
                status = WERR_PRINTER_DRIVER_IN_USE;
                goto done;
        }
@@ -1986,7 +1986,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
        if ( version == 2 )
        {
                if (W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx,
-                                                      &info_win2k, 3,
+                                                      &info_win2k,
                                                       r->in.driver,
                                                       r->in.architecture, 3)))
                {
@@ -1994,7 +1994,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
                        /* remove the Win2k driver first*/
 
                        status_win2k = delete_printer_driver(
-                               p, &info_win2k->info3, 3, false);
+                               p, info_win2k, 3, false);
                        free_a_printer_driver(info_win2k);
 
                        /* this should not have failed---if it did, report to client */
@@ -2006,7 +2006,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
                }
        }
 
-       status = delete_printer_driver(p, &info->info3, version, false);
+       status = delete_printer_driver(p, info, version, false);
 
        /* if at least one of the deletes succeeded return OK */
 
@@ -2026,8 +2026,8 @@ done:
 WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
                                      struct spoolss_DeletePrinterDriverEx *r)
 {
-       union spoolss_DriverInfo        *info = NULL;
-       union spoolss_DriverInfo        *info_win2k = NULL;
+       struct spoolss_DriverInfo8      *info = NULL;
+       struct spoolss_DriverInfo8      *info_win2k = NULL;
        int                             version;
        bool                            delete_files;
        WERROR                          status;
@@ -2055,7 +2055,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
        if (r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION)
                version = r->in.version;
 
-       status = get_a_printer_driver(p->mem_ctx, &info, 3, r->in.driver,
+       status = get_a_printer_driver(p->mem_ctx, &info, r->in.driver,
                                      r->in.architecture, version);
 
        if ( !W_ERROR_IS_OK(status) )
@@ -2072,7 +2072,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
                /* try for Win2k driver if "Windows NT x86" */
 
                version = 3;
-               if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info, 3, r->in.driver,
+               if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info, r->in.driver,
                                                        r->in.architecture,
                                                        version))) {
                        status = WERR_UNKNOWN_PRINTER_DRIVER;
@@ -2080,7 +2080,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
                }
        }
 
-       if ( printer_driver_in_use(&info->info3) ) {
+       if (printer_driver_in_use(info)) {
                status = WERR_PRINTER_DRIVER_IN_USE;
                goto done;
        }
@@ -2101,7 +2101,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
 
        /* fail if any files are in use and DPD_DELETE_ALL_FILES is set */
 
-       if ( delete_files && printer_driver_files_in_use(info, &info->info3) & (r->in.delete_flags & DPD_DELETE_ALL_FILES) ) {
+       if (delete_files && printer_driver_files_in_use(info, info) & (r->in.delete_flags & DPD_DELETE_ALL_FILES)) {
                /* no idea of the correct error here */
                status = WERR_ACCESS_DENIED;
                goto done;
@@ -2111,12 +2111,12 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
        /* also check for W32X86/3 if necessary; maybe we already have? */
 
        if ( (version == 2) && ((r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION) != DPD_DELETE_SPECIFIC_VERSION)  ) {
-               if (W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info_win2k, 3,
+               if (W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &info_win2k,
                                                       r->in.driver,
                                                       r->in.architecture, 3)))
                {
 
-                       if ( delete_files && printer_driver_files_in_use(info, &info_win2k->info3) & (r->in.delete_flags & DPD_DELETE_ALL_FILES) ) {
+                       if (delete_files && printer_driver_files_in_use(info, info_win2k) & (r->in.delete_flags & DPD_DELETE_ALL_FILES) ) {
                                /* no idea of the correct error here */
                                free_a_printer_driver(info_win2k);
                                status = WERR_ACCESS_DENIED;
@@ -2127,7 +2127,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
                        /* remove the Win2k driver first*/
 
                        status_win2k = delete_printer_driver(
-                               p, &info_win2k->info3, 3, delete_files);
+                               p, info_win2k, 3, delete_files);
                        free_a_printer_driver(info_win2k);
 
                        /* this should not have failed---if it did, report to client */
@@ -2137,7 +2137,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
                }
        }
 
-       status = delete_printer_driver(p, &info->info3, version, delete_files);
+       status = delete_printer_driver(p, info, version, delete_files);
 
        if ( W_ERROR_IS_OK(status) || W_ERROR_IS_OK(status_win2k) )
                status = WERR_OK;
@@ -4476,6 +4476,8 @@ static const char **string_array_from_driver_info(TALLOC_CTX *mem_ctx,
                if (in && strlen(in)) { \
                        out = talloc_strdup(mem_ctx, in); \
                        W_ERROR_HAVE_NO_MEMORY(out); \
+               } else { \
+                       out = NULL; \
                } \
        } while (0);
 
@@ -4495,7 +4497,7 @@ static const char **string_array_from_driver_info(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info1(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo1 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername,
                                        const char *architecture)
 {
@@ -4511,7 +4513,7 @@ static WERROR fill_printer_driver_info1(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info2(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo2 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername)
 
 {
@@ -4545,7 +4547,7 @@ static WERROR fill_printer_driver_info2(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info3(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo3 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername)
 {
        const char *cservername = canon_servername(servername);
@@ -4593,7 +4595,7 @@ static WERROR fill_printer_driver_info3(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info4(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo4 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername)
 {
        const char *cservername = canon_servername(servername);
@@ -4634,7 +4636,7 @@ static WERROR fill_printer_driver_info4(TALLOC_CTX *mem_ctx,
                           r->default_datatype);
 
        r->previous_names = string_array_from_driver_info(mem_ctx,
-                                                         NULL,
+                                                         driver->previous_names,
                                                          cservername);
 
        return WERR_OK;
@@ -4646,7 +4648,7 @@ static WERROR fill_printer_driver_info4(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info5(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo5 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername)
 {
        const char *cservername = canon_servername(servername);
@@ -4682,7 +4684,7 @@ static WERROR fill_printer_driver_info5(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info6(TALLOC_CTX *mem_ctx,
                                        struct spoolss_DriverInfo6 *r,
-                                       const struct spoolss_DriverInfo3 *driver,
+                                       const struct spoolss_DriverInfo8 *driver,
                                        const char *servername)
 {
        const char *cservername = canon_servername(servername);
@@ -4722,19 +4724,23 @@ static WERROR fill_printer_driver_info6(TALLOC_CTX *mem_ctx,
                                                           driver->dependent_files,
                                                           cservername);
        r->previous_names = string_array_from_driver_info(mem_ctx,
-                                                         NULL,
+                                                         driver->previous_names,
                                                          cservername);
 
-       r->driver_date          = 0;
-       r->driver_version       = 0;
+       r->driver_date          = driver->driver_date;
+       r->driver_version       = driver->driver_version;
 
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->manufacturer_name,
                           r->manufacturer_name);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->manufacturer_url,
                           r->manufacturer_url);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->hardware_id,
                           r->hardware_id);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->provider,
                           r->provider);
 
        return WERR_OK;
@@ -4763,7 +4769,7 @@ static WERROR fill_spoolss_DriverFileInfo(TALLOC_CTX *mem_ctx,
  ********************************************************************/
 
 static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx,
-                                                const struct spoolss_DriverInfo3 *driver,
+                                                const struct spoolss_DriverInfo8 *driver,
                                                 const char *cservername,
                                                 struct spoolss_DriverFileInfo **info_p,
                                                 uint32_t *count_p)
@@ -4863,7 +4869,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx,
 
 static WERROR fill_printer_driver_info101(TALLOC_CTX *mem_ctx,
                                          struct spoolss_DriverInfo101 *r,
-                                         const struct spoolss_DriverInfo3 *driver,
+                                         const struct spoolss_DriverInfo8 *driver,
                                          const char *servername)
 {
        const char *cservername = canon_servername(servername);
@@ -4893,18 +4899,22 @@ static WERROR fill_printer_driver_info101(TALLOC_CTX *mem_ctx,
                           r->default_datatype);
 
        r->previous_names = string_array_from_driver_info(mem_ctx,
-                                                         NULL,
+                                                         driver->previous_names,
                                                          cservername);
-       r->driver_date          = 0;
-       r->driver_version       = 0;
+       r->driver_date          = driver->driver_date;
+       r->driver_version       = driver->driver_version;
 
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->manufacturer_name,
                           r->manufacturer_name);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->manufacturer_url,
                           r->manufacturer_url);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->hardware_id,
                           r->hardware_id);
-       FILL_DRIVER_STRING(mem_ctx, "",
+       FILL_DRIVER_STRING(mem_ctx,
+                          driver->provider,
                           r->provider);
 
        return WERR_OK;
@@ -4922,18 +4932,18 @@ static WERROR construct_printer_driver_info_1(TALLOC_CTX *mem_ctx,
                                              uint32_t version)
 {
        NT_PRINTER_INFO_LEVEL *printer = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        WERROR result;
 
        if (!W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, lp_const_servicename(snum))))
                return WERR_INVALID_PRINTER_NAME;
 
-       if (!W_ERROR_IS_OK(get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version))) {
+       if (!W_ERROR_IS_OK(get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername, architecture, version))) {
                free_a_printer(&printer, 2);
                return WERR_UNKNOWN_PRINTER_DRIVER;
        }
 
-       result = fill_printer_driver_info1(mem_ctx, r, &driver->info3, servername, architecture);
+       result = fill_printer_driver_info1(mem_ctx, r, driver, servername, architecture);
 
        free_a_printer_driver(driver);
        free_a_printer(&printer,2);
@@ -4954,7 +4964,7 @@ static WERROR construct_printer_driver_info_2(TALLOC_CTX *mem_ctx,
                                              uint32_t version)
 {
        NT_PRINTER_INFO_LEVEL *printer = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        WERROR result;
 
        ZERO_STRUCT(printer);
@@ -4962,12 +4972,12 @@ static WERROR construct_printer_driver_info_2(TALLOC_CTX *mem_ctx,
        if (!W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, lp_const_servicename(snum))))
                return WERR_INVALID_PRINTER_NAME;
 
-       if (!W_ERROR_IS_OK(get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version))) {
+       if (!W_ERROR_IS_OK(get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername, architecture, version))) {
                free_a_printer(&printer, 2);
                return WERR_UNKNOWN_PRINTER_DRIVER;
        }
 
-       result = fill_printer_driver_info2(mem_ctx, r, &driver->info3, servername);
+       result = fill_printer_driver_info2(mem_ctx, r, driver, servername);
 
        free_a_printer_driver(driver);
        free_a_printer(&printer,2);
@@ -4988,7 +4998,7 @@ static WERROR construct_printer_driver_info_3(TALLOC_CTX *mem_ctx,
                                              uint32_t version)
 {
        NT_PRINTER_INFO_LEVEL *printer = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        WERROR status;
        ZERO_STRUCT(driver);
 
@@ -4997,7 +5007,7 @@ static WERROR construct_printer_driver_info_3(TALLOC_CTX *mem_ctx,
        if (!W_ERROR_IS_OK(status))
                return WERR_INVALID_PRINTER_NAME;
 
-       status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
+       status = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername, architecture, version);
        DEBUG(8,("construct_printer_driver_info_3: status: %s\n", win_errstr(status)));
 
 #if 0  /* JERRY */
@@ -5032,7 +5042,7 @@ static WERROR construct_printer_driver_info_3(TALLOC_CTX *mem_ctx,
 #endif
 
 
-       status = fill_printer_driver_info3(mem_ctx, r, &driver->info3, servername);
+       status = fill_printer_driver_info3(mem_ctx, r, driver, servername);
 
        free_a_printer_driver(driver);
        free_a_printer(&printer,2);
@@ -5053,7 +5063,7 @@ static WERROR construct_printer_driver_info_6(TALLOC_CTX *mem_ctx,
                                              uint32_t version)
 {
        NT_PRINTER_INFO_LEVEL           *printer = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        WERROR                          status;
 
        status=get_a_printer(NULL, &printer, 2, lp_const_servicename(snum) );
@@ -5063,7 +5073,7 @@ static WERROR construct_printer_driver_info_6(TALLOC_CTX *mem_ctx,
        if (!W_ERROR_IS_OK(status))
                return WERR_INVALID_PRINTER_NAME;
 
-       status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
+       status = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername, architecture, version);
 
        DEBUG(8,("construct_printer_driver_info_6: status: %s\n", win_errstr(status)));
 
@@ -5080,7 +5090,7 @@ static WERROR construct_printer_driver_info_6(TALLOC_CTX *mem_ctx,
 
                /* Yes - try again with a WinNT driver. */
                version = 2;
-               status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
+               status = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername, architecture, version);
                DEBUG(8,("construct_printer_driver_info_6: status: %s\n", win_errstr(status)));
                if (!W_ERROR_IS_OK(status)) {
                        free_a_printer(&printer,2);
@@ -5088,7 +5098,7 @@ static WERROR construct_printer_driver_info_6(TALLOC_CTX *mem_ctx,
                }
        }
 
-       status = fill_printer_driver_info6(mem_ctx, r, &driver->info3, servername);
+       status = fill_printer_driver_info6(mem_ctx, r, driver, servername);
 
        free_a_printer(&printer,2);
        free_a_printer_driver(driver);
@@ -5109,7 +5119,7 @@ static WERROR construct_printer_driver_info_101(TALLOC_CTX *mem_ctx,
                                                uint32_t version)
 {
        NT_PRINTER_INFO_LEVEL           *printer = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        WERROR                          result;
 
        result = get_a_printer(NULL, &printer, 2, lp_const_servicename(snum));
@@ -5121,7 +5131,7 @@ static WERROR construct_printer_driver_info_101(TALLOC_CTX *mem_ctx,
                return WERR_INVALID_PRINTER_NAME;
        }
 
-       result = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername,
+       result = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername,
                                      architecture, version);
 
        DEBUG(8,("construct_printer_driver_info_101: status: %s\n",
@@ -5139,7 +5149,7 @@ static WERROR construct_printer_driver_info_101(TALLOC_CTX *mem_ctx,
 
                /* Yes - try again with a WinNT driver. */
                version = 2;
-               result = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername,
+               result = get_a_printer_driver(mem_ctx, &driver, printer->info_2->drivername,
                                              architecture, version);
                DEBUG(8,("construct_printer_driver_info_6: status: %s\n",
                        win_errstr(result)));
@@ -5149,7 +5159,7 @@ static WERROR construct_printer_driver_info_101(TALLOC_CTX *mem_ctx,
                }
        }
 
-       result = fill_printer_driver_info101(mem_ctx, r, &driver->info3, servername);
+       result = fill_printer_driver_info101(mem_ctx, r, driver, servername);
 
        free_a_printer(&printer, 2);
        free_a_printer_driver(driver);
@@ -6448,7 +6458,7 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx,
        int ndrivers;
        uint32_t version;
        fstring *list = NULL;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        union spoolss_DriverInfo *info = NULL;
        uint32_t count = 0;
        WERROR result = WERR_OK;
@@ -6482,7 +6492,7 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx,
                for (i=0; i<ndrivers; i++) {
                        DEBUGADD(5,("\tdriver: [%s]\n", list[i]));
                        ZERO_STRUCT(driver);
-                       result = get_a_printer_driver(mem_ctx, &driver, 3, list[i],
+                       result = get_a_printer_driver(mem_ctx, &driver, list[i],
                                                      architecture, version);
                        if (!W_ERROR_IS_OK(result)) {
                                goto out;
@@ -6491,28 +6501,28 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx,
                        switch (level) {
                        case 1:
                                result = fill_printer_driver_info1(info, &info[count+i].info1,
-                                                                  &driver->info3, servername,
+                                                                  driver, servername,
                                                                   architecture);
                                break;
                        case 2:
                                result = fill_printer_driver_info2(info, &info[count+i].info2,
-                                                                  &driver->info3, servername);
+                                                                  driver, servername);
                                break;
                        case 3:
                                result = fill_printer_driver_info3(info, &info[count+i].info3,
-                                                                  &driver->info3, servername);
+                                                                  driver, servername);
                                break;
                        case 4:
                                result = fill_printer_driver_info4(info, &info[count+i].info4,
-                                                                  &driver->info3, servername);
+                                                                  driver, servername);
                                break;
                        case 5:
                                result = fill_printer_driver_info5(info, &info[count+i].info5,
-                                                                  &driver->info3, servername);
+                                                                  driver, servername);
                                break;
                        case 6:
                                result = fill_printer_driver_info6(info, &info[count+i].info6,
-                                                                  &driver->info3, servername);
+                                                                  driver, servername);
                                break;
                        default:
                                result = WERR_UNKNOWN_LEVEL;
@@ -7493,9 +7503,9 @@ WERROR _spoolss_AddPrinterDriver(pipes_struct *p,
                */
                case 2:
                {
-                       union spoolss_DriverInfo *driver1;
+                       struct spoolss_DriverInfo8 *driver1;
 
-                       if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &driver1, 3, driver_name, "Windows NT x86", 3))) {
+                       if (!W_ERROR_IS_OK(get_a_printer_driver(p->mem_ctx, &driver1, driver_name, "Windows NT x86", 3))) {
                                /*
                                 * No 2k/Xp driver found, delete init data (if any) for the new Nt driver.
                                */
index 2bee5c1bde491b6fa4b4c86e6b32cf770c1bdf89..7ee6c9b59c377763f3010112ac9cfa458ba977ff 100644 (file)
@@ -648,7 +648,7 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
 {
        int                             i;
        fstring                         location;
-       union spoolss_DriverInfo *driver = NULL;
+       struct spoolss_DriverInfo8 *driver = NULL;
        NT_PRINTER_INFO_LEVEL           *printer = NULL;
 
        if ( !W_ERROR_IS_OK(get_a_printer( NULL, &printer, 2, lp_servicename(snum))) ) {
@@ -657,7 +657,7 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
                goto err;
        }
 
-       if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, 3, printer->info_2->drivername,
+       if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, printer->info_2->drivername,
                "Windows 4.0", 0)) )
        {
                DEBUG(3,("fill_printq_info_52: Failed to lookup driver [%s]\n", 
@@ -665,38 +665,38 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
                goto err;
        }
 
-       trim_string((char *)driver->info3.driver_path, "\\print$\\WIN40\\0\\", 0);
-       trim_string((char *)driver->info3.data_file, "\\print$\\WIN40\\0\\", 0);
-       trim_string((char *)driver->info3.help_file, "\\print$\\WIN40\\0\\", 0);
+       trim_string((char *)driver->driver_path, "\\print$\\WIN40\\0\\", 0);
+       trim_string((char *)driver->data_file, "\\print$\\WIN40\\0\\", 0);
+       trim_string((char *)driver->help_file, "\\print$\\WIN40\\0\\", 0);
 
        PACKI(desc, "W", 0x0400);                     /* don't know */
-       PACKS(desc, "z", driver->info3.driver_name);        /* long printer name */
-       PACKS(desc, "z", driver->info3.driver_path);  /* Driverfile Name */
-       PACKS(desc, "z", driver->info3.data_file);    /* Datafile name */
-       PACKS(desc, "z", driver->info3.monitor_name); /* language monitor */
+       PACKS(desc, "z", driver->driver_name);        /* long printer name */
+       PACKS(desc, "z", driver->driver_path);  /* Driverfile Name */
+       PACKS(desc, "z", driver->data_file);    /* Datafile name */
+       PACKS(desc, "z", driver->monitor_name); /* language monitor */
 
        fstrcpy(location, "\\\\%L\\print$\\WIN40\\0");
        standard_sub_basic( "", "", location, sizeof(location)-1 );
        PACKS(desc,"z", location);                          /* share to retrieve files */
 
-       PACKS(desc,"z", driver->info3.default_datatype);    /* default data type */
-       PACKS(desc,"z", driver->info3.help_file);           /* helpfile name */
-       PACKS(desc,"z", driver->info3.driver_path);               /* driver name */
+       PACKS(desc,"z", driver->default_datatype);    /* default data type */
+       PACKS(desc,"z", driver->help_file);           /* helpfile name */
+       PACKS(desc,"z", driver->driver_path);               /* driver name */
 
-       DEBUG(3,("Printer Driver Name: %s:\n",driver->info3.driver_name));
-       DEBUG(3,("Driver: %s:\n",driver->info3.driver_path));
-       DEBUG(3,("Data File: %s:\n",driver->info3.data_file));
-       DEBUG(3,("Language Monitor: %s:\n",driver->info3.monitor_name));
+       DEBUG(3,("Printer Driver Name: %s:\n",driver->driver_name));
+       DEBUG(3,("Driver: %s:\n",driver->driver_path));
+       DEBUG(3,("Data File: %s:\n",driver->data_file));
+       DEBUG(3,("Language Monitor: %s:\n",driver->monitor_name));
        DEBUG(3,("Driver Location: %s:\n",location));
-       DEBUG(3,("Data Type: %s:\n",driver->info3.default_datatype));
-       DEBUG(3,("Help File: %s:\n",driver->info3.help_file));
+       DEBUG(3,("Data Type: %s:\n",driver->default_datatype));
+       DEBUG(3,("Help File: %s:\n",driver->help_file));
        PACKI(desc,"N",count);                     /* number of files to copy */
 
-       for ( i=0; i<count && driver->info3.dependent_files && *driver->info3.dependent_files[i]; i++)
+       for ( i=0; i<count && driver->dependent_files && *driver->dependent_files[i]; i++)
        {
-               trim_string((char *)driver->info3.dependent_files[i], "\\print$\\WIN40\\0\\", 0);
-               PACKS(desc,"z",driver->info3.dependent_files[i]);         /* driver files to copy */
-               DEBUG(3,("Dependent File: %s:\n", driver->info3.dependent_files[i]));
+               trim_string((char *)driver->dependent_files[i], "\\print$\\WIN40\\0\\", 0);
+               PACKS(desc,"z",driver->dependent_files[i]);         /* driver files to copy */
+               DEBUG(3,("Dependent File: %s:\n", driver->dependent_files[i]));
        }
 
        /* sanity check */
@@ -806,7 +806,7 @@ static void fill_printq_info(connection_struct *conn, int snum, int uLevel,
 static int get_printerdrivernumber(int snum)
 {
        int                             result = 0;
-       union spoolss_DriverInfo *driver;
+       struct spoolss_DriverInfo8 *driver;
        NT_PRINTER_INFO_LEVEL           *printer = NULL;
 
        ZERO_STRUCT(driver);
@@ -817,7 +817,7 @@ static int get_printerdrivernumber(int snum)
                goto done;
        }
 
-       if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, 3, printer->info_2->drivername,
+       if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, printer->info_2->drivername,
                "Windows 4.0", 0)) )
        {
                DEBUG(3,("get_printerdrivernumber: Failed to lookup driver [%s]\n", 
@@ -826,7 +826,7 @@ static int get_printerdrivernumber(int snum)
        }
 
        /* count the number of files */
-       while (driver->info3.dependent_files && *driver->info3.dependent_files[result])
+       while (driver->dependent_files && *driver->dependent_files[result])
                result++;
  done:
        if ( printer )