diff options
-rw-r--r-- | source3/include/nt_printing.h | 21 | ||||
-rw-r--r-- | source3/include/proto.h | 6 | ||||
-rw-r--r-- | source3/include/rpc_misc.h | 6 | ||||
-rwxr-xr-x | source3/include/rpc_spoolss.h | 41 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 77 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 12 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 20 | ||||
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 193 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 30 | ||||
-rw-r--r-- | source3/smbd/service.c | 2 |
10 files changed, 401 insertions, 7 deletions
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index 7d4c4e9dd5..cec0f994eb 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -149,9 +149,30 @@ typedef struct nt_printer_driver_info_level_3 } NT_PRINTER_DRIVER_INFO_LEVEL_3; +/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ +typedef struct { + uint32 version; + fstring name; + fstring environment; + fstring driverpath; + fstring datafile; + fstring configfile; + fstring helpfile; + fstring monitorname; + fstring defaultdatatype; + fstring mfgname; + fstring oemurl; + fstring hardwareid; + fstring provider; + char **dependentfiles; + char **previousnames; +} NT_PRINTER_DRIVER_INFO_LEVEL_6; + + typedef struct nt_printer_driver_info_level { NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; + NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; } NT_PRINTER_DRIVER_INFO_LEVEL; typedef struct nt_printer_param diff --git a/source3/include/proto.h b/source3/include/proto.h index 7a64a046d7..7001c67f98 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1989,6 +1989,7 @@ BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth); BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth); BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth); BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth); +BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64); /*The following definitions come from rpc_parse/parse_net.c */ @@ -2069,6 +2070,7 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int /*The following definitions come from rpc_parse/parse_prs.c */ +void prs_dump(char *name, int level, prs_struct *ps); void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name); BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io); BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout); @@ -2553,6 +2555,8 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth); BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth); +BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, + prs_struct *ps, int depth); BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar); BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth); BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth); @@ -2560,6 +2564,8 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth); BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc); +BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc); BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc); BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth); diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index e96d6d4527..4f37a4b956 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -293,4 +293,10 @@ typedef struct lsa_policy_info } POLICY_HND; +typedef struct uint64_s +{ + uint32 low; + uint32 high; +} UINT64_S; + #endif /* _RPC_MISC_H */ diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 2af099b510..504bc11ff0 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -1273,11 +1273,52 @@ typedef struct spool_printer_driver_info_level_3 } SPOOL_PRINTER_DRIVER_INFO_LEVEL_3; +/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ +typedef struct { + uint32 dummy1; + uint32 version; + uint32 name_ptr; + uint32 environment_ptr; + uint32 driverpath_ptr; + uint32 datafile_ptr; + uint32 configfile_ptr; + uint32 helpfile_ptr; + uint32 monitorname_ptr; + uint32 defaultdatatype_ptr; + uint32 dependentfiles_len; + uint32 dependentfiles_ptr; + uint32 previousnames_len; + uint32 previousnames_ptr; + NTTIME driverdate; + UINT64_S driverversion; + uint32 dummy4; + uint32 mfgname_ptr; + uint32 oemurl_ptr; + uint32 hardwareid_ptr; + uint32 provider_ptr; + UNISTR2 name; + UNISTR2 environment; + UNISTR2 driverpath; + UNISTR2 datafile; + UNISTR2 configfile; + UNISTR2 helpfile; + UNISTR2 monitorname; + UNISTR2 defaultdatatype; + BUFFER5 dependentfiles; + BUFFER5 previousnames; + UNISTR2 mfgname; + UNISTR2 oemurl; + UNISTR2 hardwareid; + UNISTR2 provider; +} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6; + + typedef struct spool_printer_driver_info_level { uint32 level; uint32 ptr; SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; + SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; } SPOOL_PRINTER_DRIVER_INFO_LEVEL; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index c70ed20998..3e15082f21 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -381,6 +381,75 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) /**************************************************************************** ****************************************************************************/ +static uint32 add_a_printer_driver_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *driver) +{ + int fd; + pstring file; + fstring architecture; + fstring driver_name; + char **dependentfiles; + + /* create a file in the dir lp_nt_driver_file */ + /* with the full printer DRIVER name */ + /* eg: "/usr/local/samba/lib/NTdriver_HP LaserJet 6MP" */ + /* each name is really defining an *unique* printer model */ + /* I don't want to mangle the name to find it back when enumerating */ + + /* il faut substituer les / par 1 autre caractere d'abord */ + /* dans le nom de l'imprimante par un # ???*/ + + StrnCpy(driver_name, driver->name, sizeof(driver_name)-1); + + all_string_sub(driver_name, "/", "#", 0); + + get_short_archi(architecture, driver->environment); + + slprintf(file, sizeof(file)-1, "%s/NTdriver_%s_%s", + lp_nt_drivers_file(), architecture, driver_name); + + unlink(file); + if((fd = sys_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644)) == -1) + { + DEBUG(0, ("add_a_printer_driver_3: Cannot create driver file [%s]. Error was %s\n", file, strerror(errno) )); + return(2); + } + + /* + * cversion must be 2. + * when adding a printer ON the SERVER + * rpcAddPrinterDriver defines it to zero + * which is wrong !!! + * + * JFM, 4/14/99 + */ + driver->version=2; + + fdprintf(fd, "version: %d\n", driver->version); + fdprintf(fd, "name: %s\n", driver->name); + fdprintf(fd, "environment: %s\n", driver->environment); + fdprintf(fd, "driverpath: %s\n", driver->driverpath); + fdprintf(fd, "datafile: %s\n", driver->datafile); + fdprintf(fd, "configfile: %s\n", driver->configfile); + fdprintf(fd, "helpfile: %s\n", driver->helpfile); + fdprintf(fd, "monitorname: %s\n", driver->monitorname); + fdprintf(fd, "defaultdatatype: %s\n", driver->defaultdatatype); + + /* and the dependants files */ + + dependentfiles=driver->dependentfiles; + + while ( **dependentfiles != '\0' ) + { + fdprintf(fd, "dependentfile: %s\n", *dependentfiles); + dependentfiles++; + } + + close(fd); + return(0); +} + +/**************************************************************************** +****************************************************************************/ static uint32 get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring in_prt, fstring in_arch) { char **lines; @@ -1307,6 +1376,12 @@ uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level) success=add_a_printer_driver_3(driver.info_3); break; } + + case 6: + { + success=add_a_printer_driver_6(driver.info_6); + break; + } default: success=1; break; @@ -1335,7 +1410,7 @@ uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, break; } - dump_a_printer_driver(*driver, level); + if (success == 0) dump_a_printer_driver(*driver, level); return (success); } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index d19fe47a0d..b12688d362 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1380,3 +1380,15 @@ BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) return True; } + + +/******************************************************************* + Stream a uint64_struct + ********************************************************************/ +BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) +{ + return prs_uint32(name, ps, depth+1, &data64->low) && + prs_uint32(name, ps, depth+1, &data64->high); +} + + diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 64c1590b7d..2edd080a0e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -27,6 +27,25 @@ extern int DEBUGLEVEL; /******************************************************************* +dump a prs to a file + ********************************************************************/ +void prs_dump(char *name, int level, prs_struct *ps) +{ + int fd; + pstring fname; + if (DEBUGLEVEL < 50) return; + slprintf(fname,sizeof(fname), "/tmp/%s_%d.prs", name, level); + fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + if (fd != -1) { + write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); + close(fd); + DEBUG(0,("created %s\n", fname)); + } +} + + + +/******************************************************************* debug output for parsing info. XXXX side-effect of this function is to increase the debug depth XXXX @@ -428,7 +447,6 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) return True; } - /****************************************************************** Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c5aba9aba7..62dbc16277 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3575,6 +3575,146 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ /******************************************************************* +parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure +********************************************************************/ +BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, + prs_struct *ps, int depth) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; + + prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6"); + depth++; + + /* reading */ + if (UNMARSHALLING(ps)) { + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6)); + if(il == NULL) + return False; + ZERO_STRUCTP(il); + *q_u=il; + } + else { + il=*q_u; + } + + if(!prs_align(ps)) + return False; + + + /* 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)) + return False; + if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) + return False; + if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr)) + return False; + if(!prs_uint32("datafile_ptr", ps, depth, &il->datafile_ptr)) + return False; + if(!prs_uint32("configfile_ptr", ps, depth, &il->configfile_ptr)) + return False; + if(!prs_uint32("helpfile_ptr", ps, depth, &il->helpfile_ptr)) + return False; + if(!prs_uint32("monitorname_ptr", ps, depth, &il->monitorname_ptr)) + return False; + if(!prs_uint32("defaultdatatype_ptr", ps, depth, &il->defaultdatatype_ptr)) + return False; + if(!prs_uint32("dependentfiles_len", ps, depth, &il->dependentfiles_len)) + return False; + if(!prs_uint32("dependentfiles_ptr", ps, depth, &il->dependentfiles_ptr)) + return False; + if(!prs_uint32("previousnames_len", ps, depth, &il->previousnames_len)) + return False; + if(!prs_uint32("previousnames_ptr", ps, depth, &il->previousnames_ptr)) + return False; + if(!smb_io_time("driverdate", &il->driverdate, ps, depth)) + return False; + if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) + return False; + if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + return False; + if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr)) + return False; + if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr)) + return False; + if(!prs_uint32("hardwareid_ptr", ps, depth, &il->hardwareid_ptr)) + return False; + if(!prs_uint32("provider_ptr", ps, depth, &il->provider_ptr)) + return False; + + /* parse the structures in the packet */ + + if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, 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)) + return False; + if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + + return True; +} + + +/******************************************************************* convert a buffer of UNICODE strings null terminated the buffer is terminated by a NULL @@ -3680,6 +3820,13 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE if(!spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth)) return False; break; + case 6: + if(!spool_io_printer_driver_info_level_6("", &(il->info_6), ps, depth)) + return False; + break; + default: + prs_dump("spool_io_printer_driver_info_level", il->level, ps); + return False; } return True; @@ -3770,6 +3917,52 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, return True; } +/******************************************************************* +********************************************************************/ +BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc) +{ + NT_PRINTER_DRIVER_INFO_LEVEL_6 *d; + + DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_6)); + if(*asc == NULL) + return False; + ZERO_STRUCTP(*asc); + } + + d=*asc; + + 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); + + DEBUGADD(8,( "version: %d\n", d->version)); + DEBUGADD(8,( "name: %s\n", d->name)); + DEBUGADD(8,( "environment: %s\n", d->environment)); + DEBUGADD(8,( "driverpath: %s\n", d->driverpath)); + DEBUGADD(8,( "datafile: %s\n", d->datafile)); + DEBUGADD(8,( "configfile: %s\n", d->configfile)); + DEBUGADD(8,( "helpfile: %s\n", d->helpfile)); + DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); + DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); + + uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); + uniarray_2_ascarray(&(uni->previousnames), &(d->previousnames) ); + + return True; +} + BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc) { diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 34e459d72b..95d7b7fdff 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -571,7 +571,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)); break; default: break; @@ -2378,6 +2382,9 @@ static void construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, NT_PRINTER_INFO_LEVEL printer; NT_PRINTER_DRIVER_INFO_LEVEL driver; + ZERO_STRUCT(driver); + ZERO_STRUCT(printer); + get_a_printer(&printer, 2, lp_servicename(snum) ); get_a_printer_driver(&driver, 3, printer.info_2->drivername, architecture); @@ -2431,7 +2438,10 @@ static void construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, fstri { NT_PRINTER_INFO_LEVEL printer; NT_PRINTER_DRIVER_INFO_LEVEL driver; - + + ZERO_STRUCT(printer); + ZERO_STRUCT(driver); + get_a_printer(&printer, 2, lp_servicename(snum) ); get_a_printer_driver(&driver, 3, printer.info_2->drivername, architecture); @@ -2525,7 +2535,10 @@ static void construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, { NT_PRINTER_INFO_LEVEL printer; NT_PRINTER_DRIVER_INFO_LEVEL driver; - + + ZERO_STRUCT(printer); + ZERO_STRUCT(driver); + get_a_printer(&printer, 2, lp_servicename(snum) ); get_a_printer_driver(&driver, 3, printer.info_2->drivername, architecture); @@ -3245,6 +3258,8 @@ static uint32 enumprinterdrivers_level1(fstring *list, fstring servername, fstri NT_PRINTER_DRIVER_INFO_LEVEL driver; DRIVER_INFO_1 *driver_info_1=NULL; + ZERO_STRUCT(driver); + if((driver_info_1=(DRIVER_INFO_1 *)malloc(*returned * sizeof(DRIVER_INFO_1))) == NULL) return ERROR_NOT_ENOUGH_MEMORY; @@ -3292,6 +3307,8 @@ static uint32 enumprinterdrivers_level2(fstring *list, fstring servername, fstri NT_PRINTER_DRIVER_INFO_LEVEL driver; DRIVER_INFO_2 *driver_info_2=NULL; + ZERO_STRUCT(driver); + if (*returned > 0 && !(driver_info_2=(DRIVER_INFO_2 *)malloc(*returned * sizeof(DRIVER_INFO_2)))) return ERROR_NOT_ENOUGH_MEMORY; @@ -3340,6 +3357,8 @@ static uint32 enumprinterdrivers_level3(fstring *list, fstring servername, fstri NT_PRINTER_DRIVER_INFO_LEVEL driver; DRIVER_INFO_3 *driver_info_3=NULL; + ZERO_STRUCT(driver); + if((driver_info_3=(DRIVER_INFO_3 *)malloc((*returned)*sizeof(DRIVER_INFO_3))) == NULL) return ERROR_NOT_ENOUGH_MEMORY; @@ -3736,6 +3755,8 @@ uint32 _spoolss_addprinterdriver( const UNISTR2 *server_name, const SPOOL_PRINTER_DRIVER_INFO_LEVEL *info) { NT_PRINTER_DRIVER_INFO_LEVEL driver; + + ZERO_STRUCT(driver); convert_printer_driver_info(info, &driver, level); @@ -3743,6 +3764,7 @@ uint32 _spoolss_addprinterdriver( const UNISTR2 *server_name, return ERROR_ACCESS_DENIED; safe_free(driver.info_3); + safe_free(driver.info_6); return NT_STATUS_NO_PROBLEMO; } @@ -3775,7 +3797,7 @@ static uint32 getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen fill_driverdir_1(info, chaine); - *needed += spoolss_size_driverdir_info_1(info); + *needed += spoolss_size_driverdir_info_1(info); if (!alloc_buffer_size(buffer, *needed)) { safe_free(info); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index f713b18562..fa3bc3cb10 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -281,7 +281,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int /* shall we let them in? */ if (!authorise_login(snum,user,password,pwlen,&guest,&force,vuid)) { - DEBUG( 2, ( "Invalid username/password for %s\n", service ) ); + DEBUG( 2, ( "Invalid username/password for %s [%s]\n", service, user ) ); *ecode = ERRbadpw; return NULL; } |