diff options
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/load.c | 4 | ||||
-rw-r--r-- | source3/printing/lpq_parse.c | 6 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 7 | ||||
-rw-r--r-- | source3/printing/print_aix.c | 3 | ||||
-rw-r--r-- | source3/printing/print_generic.c | 4 | ||||
-rw-r--r-- | source3/printing/printing.c | 2 |
6 files changed, 20 insertions, 6 deletions
diff --git a/source3/printing/load.c b/source3/printing/load.c index f8aba3996d..23144d5a95 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -28,6 +28,7 @@ static void add_auto_printers(void) const char *p; int pnum = lp_servicenumber(PRINTERS_NAME); char *str; + char *saveptr; if (pnum < 0) return; @@ -35,7 +36,8 @@ static void add_auto_printers(void) if ((str = SMB_STRDUP(lp_auto_services())) == NULL) return; - for (p = strtok(str, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) { + for (p = strtok_r(str, LIST_SEP, &saveptr); p; + p = strtok_r(NULL, LIST_SEP, &saveptr)) { if (lp_servicenumber(p) >= 0) continue; diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 6dcddb6f1b..afa3b4850a 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -127,6 +127,7 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first) int count = 0; TALLOC_CTX *ctx = talloc_tos(); char *line2 = NULL; + char *saveptr; line2 = talloc_strdup(ctx, line); if (!line2) { @@ -144,10 +145,11 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first) #endif /* OSF1 */ /* FIXME: Use next_token_talloc rather than strtok! */ - tok[0] = strtok(line2," \t"); + tok[0] = strtok_r(line2," \t", &saveptr); count++; - while ((count < MAXTOK) && ((tok[count] = strtok(NULL," \t")) != NULL)) { + while ((count < MAXTOK) + && ((tok[count] = strtok_r(NULL, " \t", &saveptr)) != NULL)) { count++; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index bba55c0e4a..d5803b711b 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -3315,8 +3315,13 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads, /* publish it */ ads_rc = ads_mod_printer_entry(ads, prt_dn, ctx, &mods); - if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) + if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) { + int i; + for (i=0; mods[i] != 0; i++) + ; + mods[i] = (LDAPMod *)-1; ads_rc = ads_add_printer_entry(ads, prt_dn, ctx, &mods); + } if (!ADS_ERR_OK(ads_rc)) DEBUG(3, ("error publishing %s: %s\n", printer->info_2->sharename, ads_errstr(ads_rc))); diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c index fd85ca0833..57590cc39e 100644 --- a/source3/printing/print_aix.c +++ b/source3/printing/print_aix.c @@ -59,8 +59,9 @@ bool aix_cache_reload(void) continue; if ((p = strchr_m(line, ':'))) { + char *saveptr; *p = '\0'; - p = strtok(line, ":"); + p = strtok_r(line, ":", &saveptr); if (strcmp(p, "bsh") != 0) { name = talloc_strdup(ctx, p); if (!name) { diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index cc4b744a11..2a324fdd5c 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -41,15 +41,18 @@ static int print_run_command(int snum, const char* printername, bool do_sub, /* check for a valid system printername and valid command to run */ if ( !printername || !*printername ) { + va_end(ap); return -1; } if (!command || !*command) { + va_end(ap); return -1; } syscmd = talloc_strdup(ctx, command); if (!syscmd) { + va_end(ap); return -1; } @@ -57,6 +60,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub, char *value = va_arg(ap,char *); syscmd = talloc_string_sub(ctx, syscmd, arg, value); if (!syscmd) { + va_end(ap); return -1; } } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 9f2c08629d..221e79b337 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -2575,7 +2575,7 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type) fail: - /* The print job was not succesfully started. Cleanup */ + /* The print job was not successfully started. Cleanup */ /* Still need to add proper error return propagation! 010122:JRR */ unlink(pjob->filename); pjob_delete(sharename, jobid); |