From a073be6a2d6b597e8f55fe13d5bc741d96ef6222 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Fri, 12 Feb 2010 04:04:36 +0300 Subject: [PATCH] try to generate file version --- source3/printing/nt_printing.c | 316 +++++++++++++++++++++++------------- source3/rpc_server/srv_spoolss_nt.c | 116 +++++++++++-- 2 files changed, 308 insertions(+), 124 deletions(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 7aef4249617..916de2578f2 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -27,6 +27,7 @@ static TDB_CONTEXT *tdb_printers; /* used for printers files */ #define FORMS_PREFIX "FORMS/" #define DRIVERS_PREFIX "DRIVERS/" +#define DRIVERS_PREFIX8 "DRIVERS8/" #define DRIVER_INIT_PREFIX "DRIVER_INIT/" #define PRINTERS_PREFIX "PRINTERS/" #define SECDESC_PREFIX "SECDESC/" @@ -634,7 +635,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx) Function to allow filename parsing "the old way". ********************************************************************/ -static NTSTATUS driver_unix_convert(connection_struct *conn, +NTSTATUS driver_unix_convert(connection_struct *conn, const char *old_name, struct smb_filename **smb_fname) { @@ -969,7 +970,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version) { int total=0; const char *short_archi; - char *key = NULL; + char *key, *key8; TDB_DATA kbuf, newkey; short_archi = get_short_archi(architecture); @@ -982,24 +983,40 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version) return 0; } + if (asprintf(&key8, "%s%s/%d/", DRIVERS_PREFIX8, + short_archi, version) < 0) { + SAFE_FREE(key); + return 0; + } + for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr; newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) { - if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0) - continue; + if ((strncmp((const char *)kbuf.dptr, key, strlen(key)) == 0) || + (strncmp((const char *)kbuf.dptr, key8, strlen(key8)) == 0)) { - if((*list = SMB_REALLOC_ARRAY(*list, fstring, total+1)) == NULL) { - DEBUG(0,("get_ntdrivers: failed to enlarge list!\n")); - SAFE_FREE(key); - return -1; - } + if((*list = SMB_REALLOC_ARRAY(*list, fstring, total+1)) == NULL) { + DEBUG(0,("get_ntdrivers: failed to enlarge list!\n")); + SAFE_FREE(key); + SAFE_FREE(key8); + return -1; + } - fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key)); - total++; + if (strncmp((const char *)kbuf.dptr, key, strlen(key)) == 0) { + fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key)); + } else if (strncmp((const char *)kbuf.dptr, key8, strlen(key8)) == 0) { + fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key8)); + } else { + continue; + } + total++; + } } SAFE_FREE(key); + SAFE_FREE(key8); + return(total); } @@ -1040,7 +1057,7 @@ const char *get_short_archi(const char *long_archi) returns -1 on error, 1 on version info found, and 0 on no version info found. ****************************************************************************/ -static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 *minor) +int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 *minor) { int i; char *buf = NULL; @@ -1691,6 +1708,15 @@ WERROR clean_up_driver_struct(struct pipes_struct *rpc_pipe, &r->info.info6->help_file, r->info.info6->dependent_files, &r->info.info6->version); + case 8: + return clean_up_driver_struct_level(r, rpc_pipe, + r->info.info8->architecture, + &r->info.info8->driver_path, + &r->info.info8->data_file, + &r->info.info8->config_file, + &r->info.info8->help_file, + r->info.info8->dependent_files, + &r->info.info8->version); default: return WERR_NOT_SUPPORTED; } @@ -1721,11 +1747,11 @@ static void convert_level_6_to_level3(struct spoolss_AddDriverInfo3 *dst, 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) +static void convert_level_8_to_level3(struct spoolss_AddDriverInfo3 *dst, + const struct spoolss_AddDriverInfo8 *src) { dst->version = src->version; + dst->driver_name = src->driver_name; dst->architecture = src->architecture; dst->driver_path = src->driver_path; @@ -1734,13 +1760,8 @@ static void convert_level_8_to_level3(TALLOC_CTX *mem_ctx, 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; - } + dst->_ndr_size_dependent_files = src->_ndr_size_dependent_files; + dst->dependent_files = src->dependent_files; } /**************************************************************************** @@ -1842,6 +1863,10 @@ WERROR move_driver_to_download_area(struct pipes_struct *p, convert_level_6_to_level3(&converted_driver, r->info.info6); driver = &converted_driver; break; + case 8: + convert_level_8_to_level3(&converted_driver, r->info.info8); + driver = &converted_driver; + break; default: DEBUG(0,("move_driver_to_download_area: Unknown info level (%u)\n", (unsigned int)r->level)); return WERR_UNKNOWN_LEVEL; @@ -2030,20 +2055,20 @@ WERROR move_driver_to_download_area(struct pipes_struct *p, /**************************************************************************** ****************************************************************************/ -static uint32 add_a_printer_driver_3(struct spoolss_AddDriverInfo3 *driver) +static uint32_t add_a_printer_driver_8(struct spoolss_DriverInfo8 *r) { TALLOC_CTX *ctx = talloc_tos(); - int len, buflen; const char *architecture; char *directory = NULL; char *key = NULL; - uint8 *buf; int i, ret; TDB_DATA dbuf; + enum ndr_err_code ndr_err; + DATA_BLOB blob; - architecture = get_short_archi(driver->architecture); + architecture = get_short_archi(r->architecture); if (!architecture) { - return (uint32)-1; + return (uint32_t)-1; } /* The names are relative. We store them in the form: \print$\arch\version\driver.xxx @@ -2052,9 +2077,9 @@ static uint32 add_a_printer_driver_3(struct spoolss_AddDriverInfo3 *driver) */ directory = talloc_asprintf(ctx, "\\print$\\%s\\%d\\", - architecture, driver->version); + architecture, r->version); if (!directory) { - return (uint32)-1; + return (uint32_t)-1; } #define gen_full_driver_unc_path(ctx, directory, file) \ @@ -2075,87 +2100,40 @@ static uint32 add_a_printer_driver_3(struct spoolss_AddDriverInfo3 *driver) * printer driver installed. Click OK if you * wish to install the driver on your local machine." */ + gen_full_driver_unc_path(ctx, directory, r->driver_path); + gen_full_driver_unc_path(ctx, directory, r->data_file); + gen_full_driver_unc_path(ctx, directory, r->config_file); + gen_full_driver_unc_path(ctx, directory, r->help_file); - gen_full_driver_unc_path(ctx, directory, driver->driver_path); - gen_full_driver_unc_path(ctx, directory, driver->data_file); - gen_full_driver_unc_path(ctx, directory, driver->config_file); - gen_full_driver_unc_path(ctx, directory, driver->help_file); - - if (driver->dependent_files && driver->dependent_files->string) { - for (i=0; driver->dependent_files->string[i]; i++) { - gen_full_driver_unc_path(ctx, directory, - driver->dependent_files->string[i]); - } + for (i=0; r->dependent_files && r->dependent_files[i]; i++) { + gen_full_driver_unc_path(ctx, directory, + r->dependent_files[i]); } - key = talloc_asprintf(ctx, "%s%s/%d/%s", DRIVERS_PREFIX, - architecture, driver->version, driver->driver_name); + key = talloc_asprintf(ctx, "%s%s/%d/%s", DRIVERS_PREFIX8, + architecture, r->version, r->driver_name); if (!key) { - return (uint32)-1; + return (uint32_t)-1; } - DEBUG(5,("add_a_printer_driver_3: Adding driver with key %s\n", key )); - - buf = NULL; - len = buflen = 0; - - again: - len = 0; - len += tdb_pack(buf+len, buflen-len, "dffffffff", - driver->version, - driver->driver_name, - driver->architecture, - driver->driver_path, - driver->data_file, - driver->config_file, - driver->help_file, - driver->monitor_name ? driver->monitor_name : "", - driver->default_datatype ? driver->default_datatype : ""); + DEBUG(5,("add_a_printer_driver_8: Adding driver with key %s\n", key)); - if (driver->dependent_files && driver->dependent_files->string) { - for (i=0; driver->dependent_files->string[i]; i++) { - len += tdb_pack(buf+len, buflen-len, "f", - driver->dependent_files->string[i]); - } - } - - if (len != buflen) { - buf = (uint8 *)SMB_REALLOC(buf, len); - if (!buf) { - DEBUG(0,("add_a_printer_driver_3: failed to enlarge buffer\n!")); - ret = -1; - goto done; - } - buflen = len; - goto again; + ndr_err = ndr_push_struct_blob(&blob, ctx, NULL, r, + (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo8); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return (uint32_t)-1; } - dbuf.dptr = buf; - dbuf.dsize = len; + dbuf.dptr = blob.data; + dbuf.dsize = blob.length; ret = tdb_store_bystring(tdb_drivers, key, dbuf, TDB_REPLACE); -done: - if (ret) - DEBUG(0,("add_a_printer_driver_3: Adding driver with key %s failed.\n", key )); - - SAFE_FREE(buf); - return ret; -} - -/**************************************************************************** -****************************************************************************/ - -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_8_to_level3(mem_ctx, &info3, driver); + data_blob_free(&blob); - ret = add_a_printer_driver_3(&info3); - talloc_free(mem_ctx); + if (ret) { + DEBUG(0,("add_a_printer_driver_8: Adding driver with key %s failed.\n", key)); + } return ret; } @@ -2281,6 +2259,73 @@ static WERROR get_a_printer_driver_3(TALLOC_CTX *mem_ctx, /**************************************************************************** ****************************************************************************/ + +static WERROR get_a_printer_driver_8(TALLOC_CTX *mem_ctx, + struct spoolss_DriverInfo8 **driver, + const char *drivername, const char *arch, + uint32_t version) +{ + TDB_DATA dbuf; + const char *architecture; + char *key = NULL; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct spoolss_DriverInfo8 *r; + + *driver = NULL; + + architecture = get_short_archi(arch); + if (!architecture) { + return WERR_UNKNOWN_PRINTER_DRIVER; + } + + /* Windows 4.0 (i.e. win9x) should always use a version of 0 */ + + if (strcmp(architecture, SPL_ARCH_WIN40) == 0) { + version = 0; + } + + DEBUG(8,("get_a_printer_driver_8: [%s%s/%d/%s]\n", DRIVERS_PREFIX8, + architecture, version, drivername)); + + if (asprintf(&key, "%s%s/%d/%s", DRIVERS_PREFIX8, + architecture, version, drivername) < 0) { + return WERR_NOMEM; + } + + dbuf = tdb_fetch_bystring(tdb_drivers, key); + if (!dbuf.dptr) { + SAFE_FREE(key); + return WERR_UNKNOWN_PRINTER_DRIVER; + } + + r = talloc(mem_ctx, struct spoolss_DriverInfo8); + if (!r) { + SAFE_FREE(dbuf.dptr); + SAFE_FREE(key); + return WERR_NOMEM; + } + + blob = data_blob_const(dbuf.dptr, dbuf.dsize); + + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, r, + (ndr_pull_flags_fn_t)ndr_pull_spoolss_DriverInfo8); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + SAFE_FREE(dbuf.dptr); + SAFE_FREE(key); + return WERR_UNKNOWN_PRINTER_DRIVER; + } + + SAFE_FREE(dbuf.dptr); + SAFE_FREE(key); + + *driver = r; + + return WERR_OK; +} + +/**************************************************************************** +****************************************************************************/ int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen) { int len = 0; @@ -4745,6 +4790,34 @@ WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx, if (version == DRIVER_ANY_VERSION) { /* look for Win2k first and then for NT4 */ + result = get_a_printer_driver_8(mem_ctx, + driver, + drivername, + architecture, 3); + if (!W_ERROR_IS_OK(result)) { + result = get_a_printer_driver_8(mem_ctx, + driver, + drivername, + architecture, 2); + } + } else { + result = get_a_printer_driver_8(mem_ctx, + driver, + drivername, + architecture, + version); + } + + if (W_ERROR_IS_OK(result)) { + return WERR_OK; + } + + /* falling back to lookup for old level 3 driver - gd */ + + /* 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, @@ -5217,6 +5290,7 @@ WERROR delete_printer_driver(struct pipes_struct *rpc_pipe, uint32 version, bool delete_files ) { char *key = NULL; + char *key8 = NULL; const char *arch; TDB_DATA dbuf; @@ -5226,33 +5300,54 @@ WERROR delete_printer_driver(struct pipes_struct *rpc_pipe, if (!arch) { return WERR_UNKNOWN_PRINTER_DRIVER; } + if (asprintf(&key, "%s%s/%d/%s", DRIVERS_PREFIX, arch, version, r->driver_name) < 0) { return WERR_NOMEM; } + if (asprintf(&key8, "%s%s/%d/%s", DRIVERS_PREFIX8, + arch, version, r->driver_name) < 0) { + SAFE_FREE(key); + return WERR_NOMEM; + } DEBUG(5,("delete_printer_driver: key = [%s] delete_files = %s\n", key, delete_files ? "TRUE" : "FALSE" )); /* check if the driver actually exists for this environment */ - dbuf = tdb_fetch_bystring( tdb_drivers, key ); - if ( !dbuf.dptr ) { - DEBUG(8,("delete_printer_driver: Driver unknown [%s]\n", key)); - SAFE_FREE(key); - return WERR_UNKNOWN_PRINTER_DRIVER; + dbuf = tdb_fetch_bystring(tdb_drivers, key8); + if (dbuf.dptr) { + /* ok... the driver exists so the delete should return success */ + if (tdb_delete_bystring(tdb_drivers, key8) == -1) { + DEBUG (0,("delete_printer_driver: fail to delete %s!\n", key8)); + SAFE_FREE(key); + SAFE_FREE(key8); + return WERR_ACCESS_DENIED; + } + SAFE_FREE(dbuf.dptr); + goto driver_deleted; } - SAFE_FREE( dbuf.dptr ); - - /* ok... the driver exists so the delete should return success */ + dbuf = tdb_fetch_bystring(tdb_drivers, key); + if (dbuf.dptr) { + /* ok... the driver exists so the delete should return success */ + if (tdb_delete_bystring(tdb_drivers, key) == -1) { + DEBUG (0,("delete_printer_driver: fail to delete %s!\n", key)); + SAFE_FREE(key); + SAFE_FREE(key8); + return WERR_ACCESS_DENIED; + } + SAFE_FREE(dbuf.dptr); + goto driver_deleted; + } - if (tdb_delete_bystring(tdb_drivers, key) == -1) { - DEBUG (0,("delete_printer_driver: fail to delete %s!\n", key)); - SAFE_FREE(key); - return WERR_ACCESS_DENIED; + if (!dbuf.dptr) { + DEBUG(8,("delete_printer_driver: Driver unknown\n")); + return WERR_UNKNOWN_PRINTER_DRIVER; } + driver_deleted: /* * now delete any associated files if delete_files == True * even if this part failes, we return succes because the @@ -5262,8 +5357,7 @@ WERROR delete_printer_driver(struct pipes_struct *rpc_pipe, if ( delete_files ) delete_driver_files(rpc_pipe, r); - DEBUG(5,("delete_printer_driver: driver delete successful [%s]\n", key)); - SAFE_FREE(key); + DEBUG(5,("delete_printer_driver: driver delete successful\n")); return WERR_OK; } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index e2e523d0de4..52cc8d9986f 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -4863,32 +4863,116 @@ static WERROR fill_spoolss_DriverFileInfo(TALLOC_CTX *mem_ctx, /******************************************************************** ********************************************************************/ +NTSTATUS driver_unix_convert(connection_struct *conn, + const char *old_name, + struct smb_filename **smb_fname); +int get_file_version(files_struct *fsp, char *fname,uint32_t *major, uint32_t *minor); + +WERROR get_file_minor_major(pipes_struct *p, const char* driver_path,uint32_t *major, uint32_t *minor) +{ + fstring printdollar; + int printdollar_snum; + connection_struct *conn = NULL; + char *driverpath = NULL; + NTSTATUS nt_status; + char *oldcwd; + struct smb_filename *smb_fname = NULL; + files_struct *fsp; + char* pchar; + *major=0; + *minor=0; + + fstrcpy(printdollar, "print$"); + printdollar_snum = find_service(printdollar); + + DEBUG(1,("Pouet :%s\n",lp_pathname(printdollar_snum))); + + nt_status = create_conn_struct(talloc_tos(), &conn, printdollar_snum, + lp_pathname(printdollar_snum), + p->server_info, &oldcwd); + if (!NT_STATUS_IS_OK(nt_status)) { + DEBUG(0,("spoolss_DriverFileInfo_from_driver: create_conn_struct " + "returned %s\n", nt_errstr(nt_status))); + return ntstatus_to_werror(nt_status); + } + + /* Open the driver file (Portable Executable format) and determine the + * deriver the cversion. */ + DEBUG(0,("Plop 0\n" )); + driverpath = talloc_asprintf(talloc_tos(), + "%s", + (driver_path)+7); + if (!driverpath) { + return WERR_NOMEM; + } + pchar = strchr(driverpath,'\\'); + while(pchar) + { + *pchar = '/'; + pchar = strchr(driverpath,'\\'); + } + DEBUG(0,("Plop 1 %s \n",driverpath )); + nt_status = driver_unix_convert(conn, driverpath, &smb_fname); + if (!NT_STATUS_IS_OK(nt_status)) { + return ntstatus_to_werror(nt_status); + } + DEBUG(0,("Plop 2\n" )); + + nt_status = vfs_file_exist(conn, smb_fname); + if (!NT_STATUS_IS_OK(nt_status)) { + return WERR_BADFILE; + } + DEBUG(0,("Plop 3\n" )); + + nt_status = SMB_VFS_CREATE_FILE( + conn, /* conn */ + NULL, /* req */ + 0, /* root_dir_fid */ + smb_fname, /* fname */ + FILE_GENERIC_READ, /* access_mask */ + FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ + FILE_OPEN, /* create_disposition*/ + 0, /* create_options */ + FILE_ATTRIBUTE_NORMAL, /* file_attributes */ + INTERNAL_OPEN_ONLY, /* oplock_request */ + 0, /* allocation_size */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + NULL); /* pinfo */ + DEBUG(0,("Plop 4\n" )); + get_file_version(fsp,smb_fname->base_name,major, minor); + return WERR_OK; +} static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, const struct spoolss_DriverInfo8 *driver, const char *cservername, struct spoolss_DriverFileInfo **info_p, - uint32_t *count_p) + uint32_t *count_p,pipes_struct *p) { struct spoolss_DriverFileInfo *info = NULL; uint32_t count = 0; WERROR result; uint32_t i; - *info_p = NULL; *count_p = 0; + uint32_t major; + uint32_t minor; if (strlen(driver->driver_path)) { info = TALLOC_REALLOC_ARRAY(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); + get_file_minor_major(p,driver->driver_path,&major,&minor); + DEBUG(0,("Plop 5 %x %x\n", major,minor)); result = fill_spoolss_DriverFileInfo(info, &info[count], cservername, driver->driver_path, SPOOLSS_DRIVER_FILE_TYPE_RENDERING, - 0); + minor); W_ERROR_NOT_OK_RETURN(result); count++; } @@ -4898,12 +4982,13 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); + get_file_minor_major(p,driver->config_file,&major,&minor); result = fill_spoolss_DriverFileInfo(info, &info[count], cservername, driver->config_file, SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION, - 0); + minor); W_ERROR_NOT_OK_RETURN(result); count++; } @@ -4913,12 +4998,13 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); + get_file_minor_major(p,driver->data_file,&major,&minor); result = fill_spoolss_DriverFileInfo(info, &info[count], cservername, driver->data_file, SPOOLSS_DRIVER_FILE_TYPE_DATA, - 0); + minor); W_ERROR_NOT_OK_RETURN(result); count++; } @@ -4928,6 +5014,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); + get_file_minor_major(p,driver->help_file,&major,&minor); result = fill_spoolss_DriverFileInfo(info, &info[count], cservername, @@ -4943,12 +5030,13 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); + get_file_minor_major(p,driver->dependent_files[i],&major,&minor); result = fill_spoolss_DriverFileInfo(info, &info[count], cservername, driver->dependent_files[i], SPOOLSS_DRIVER_FILE_TYPE_OTHER, - 0); + minor); W_ERROR_NOT_OK_RETURN(result); count++; } @@ -4966,7 +5054,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_DriverInfo8 *driver, - const char *servername) + const char *servername,pipes_struct *p) { const char *cservername = canon_servername(servername); WERROR result; @@ -4981,7 +5069,7 @@ static WERROR fill_printer_driver_info101(TALLOC_CTX *mem_ctx, result = spoolss_DriverFileInfo_from_driver(mem_ctx, driver, cservername, &r->file_info, - &r->file_count); + &r->file_count,p); if (!W_ERROR_IS_OK(result)) { return result; } @@ -5025,7 +5113,7 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx, int snum, const char *servername, const char *architecture, - uint32_t version) + uint32_t version, pipes_struct *p) { NT_PRINTER_INFO_LEVEL *printer = NULL; struct spoolss_DriverInfo8 *driver; @@ -5091,7 +5179,7 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx, result = fill_printer_driver_info8(mem_ctx, &r->info8, driver, servername); break; case 101: - result = fill_printer_driver_info101(mem_ctx, &r->info101, driver, servername); + result = fill_printer_driver_info101(mem_ctx, &r->info101, driver, servername,p); break; default: result = WERR_UNKNOWN_LEVEL; @@ -5144,7 +5232,7 @@ WERROR _spoolss_GetPrinterDriver2(pipes_struct *p, r->out.info, snum, servername, r->in.architecture, - r->in.client_major_version); + r->in.client_major_version,p); if (!W_ERROR_IS_OK(result)) { TALLOC_FREE(r->out.info); return result; @@ -6354,7 +6442,6 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx, int ndrivers; uint32_t version; fstring *list = NULL; - struct spoolss_DriverInfo8 *driver; union spoolss_DriverInfo *info = NULL; uint32_t count = 0; WERROR result = WERR_OK; @@ -6386,8 +6473,11 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx, } for (i=0; i