summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-06-20 23:58:56 +0000
committerJeremy Allison <jra@samba.org>2000-06-20 23:58:56 +0000
commit69c75c8a165f05c01d13ba4eddbb970540e44b96 (patch)
treef509c0ff30d6f7550419302f199f5f65023d3cab /source3
parenta69d47640cb150fbffa12dee68ead34a5b1931bb (diff)
downloadsamba-69c75c8a165f05c01d13ba4eddbb970540e44b96.tar.gz
samba-69c75c8a165f05c01d13ba4eddbb970540e44b96.tar.bz2
samba-69c75c8a165f05c01d13ba4eddbb970540e44b96.zip
Fixes for Win2k "add printer driver" INFO_LEVEL_6 was wrong, also some
memory fixes. Jeremy. (This used to be commit 2a9e645cbddef1cddc5c978310b7efed492758d2)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/include/rpc_spoolss.h3
-rw-r--r--source3/printing/nt_printing.c12
-rw-r--r--source3/rpc_parse/parse_spoolss.c47
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c1
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c4
5 files changed, 36 insertions, 31 deletions
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index de3f04ca3d..c44aad8347 100755
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -1281,8 +1281,7 @@ SPOOL_PRINTER_DRIVER_INFO_LEVEL_3;
/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
typedef struct {
- uint32 dummy1;
- uint32 version;
+ uint32 version;
uint32 name_ptr;
uint32 environment_ptr;
uint32 driverpath_ptr;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 417c0afcca..3d6d6f573a 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -349,6 +349,7 @@ static uint32 add_a_printer_driver_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *driver)
{
NT_PRINTER_DRIVER_INFO_LEVEL_3 info3;
+ ZERO_STRUCT(info3);
info3.cversion = driver->version;
fstrcpy(info3.environment,driver->environment);
fstrcpy(info3.driverpath,driver->driverpath);
@@ -377,10 +378,16 @@ static uint32 get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
fstrcpy(info.name, lp_printerdriver(snum));
fstrcpy(info.defaultdatatype, "RAW");
- if ((info.dependentfiles=(fstring *)malloc(sizeof(fstring))) == NULL)
+ fstrcpy(info.driverpath, "DUMMY.DLL");
+ fstrcpy(info.datafile, "DUMMY.PPD");
+ fstrcpy(info.configfile, "DUMMY.DLL");
+ fstrcpy(info.helpfile, "DUMMY.HLP");
+
+ if ((info.dependentfiles=(fstring *)malloc(2*sizeof(fstring))) == NULL)
return ERROR_NOT_ENOUGH_MEMORY;
- fstrcpy(info.dependentfiles[0], "");
+ memset(info.dependentfiles, '\0', 2*sizeof(fstring));
+ fstrcpy(info.dependentfiles[0], "DUMMY.PPD");
*info_ptr = memdup(&info, sizeof(info));
@@ -1367,6 +1374,7 @@ uint32 free_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level)
{
info6=driver.info_6;
safe_free(info6->dependentfiles);
+ safe_free(info6->previousnames);
ZERO_STRUCTP(info6);
safe_free(info6);
success=0;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 9e7d7501bb..d5f3b1c7c8 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -3759,8 +3759,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_
/* parse the main elements the packet */
- if(!prs_uint32("dummy1", ps, depth, &il->dummy1))
- return False;
if(!prs_uint32("version", ps, depth, &il->version))
return False;
if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
@@ -3836,18 +3834,18 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_
return False;
if(!prs_align(ps))
return False;
- if (il->dependentfiles_ptr) {
- if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth))
- return False;
- if(!prs_align(ps))
- return False;
- }
- if (il->previousnames_ptr) {
- if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth))
- return False;
- if(!prs_align(ps))
- return False;
- }
+ if (il->dependentfiles_ptr) {
+ if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ }
+ if (il->previousnames_ptr) {
+ if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ }
if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth))
return False;
if(!prs_align(ps))
@@ -3865,7 +3863,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_
if(!prs_align(ps))
return False;
-
return True;
}
@@ -4099,14 +4096,14 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
d->version=uni->version;
- unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1);
- unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1);
- unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1);
- unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1);
- unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1);
- unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1);
- unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1);
- unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1);
+ unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1);
+ unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1);
+ unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1);
+ unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1);
+ unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1);
+ unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1);
+ unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1);
+ unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1);
DEBUGADD(8,( "version: %d\n", d->version));
DEBUGADD(8,( "name: %s\n", d->name));
@@ -4118,8 +4115,8 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
DEBUGADD(8,( "monitorname: %s\n", d->monitorname));
DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype));
- uniarray_2_dosarray(&(uni->dependentfiles), &(d->dependentfiles) );
- uniarray_2_dosarray(&(uni->previousnames), &(d->previousnames) );
+ uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles );
+ uniarray_2_dosarray(&uni->previousnames, &d->previousnames );
return True;
}
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 61e5341c75..a7a63fed89 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -876,6 +876,7 @@ static BOOL api_spoolss_addprinterdriver(pipes_struct *p)
if(!spoolss_io_q_addprinterdriver("", &q_u, data, 0)) {
DEBUG(0,("spoolss_io_q_addprinterdriver: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVER.\n"));
+ free_spoolss_q_addprinterdriver(&q_u);
return False;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 90536daedf..8cff8d68d9 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -577,11 +577,11 @@ static BOOL convert_printer_driver_info(const SPOOL_PRINTER_DRIVER_INFO_LEVEL *u
switch (level) {
case 3:
printer->info_3=NULL;
- uni_2_asc_printer_driver_3(uni->info_3, &(printer->info_3));
+ uni_2_asc_printer_driver_3(uni->info_3, &printer->info_3);
break;
case 6:
printer->info_6=NULL;
- uni_2_asc_printer_driver_6(uni->info_6, &(printer->info_6));
+ uni_2_asc_printer_driver_6(uni->info_6, &printer->info_6);
break;
default:
break;