printjob.c (68401) | printjob.c (68467) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 29 unchanged lines hidden (view full) --- 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint 42/* 43static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95"; 44*/ 45static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 29 unchanged lines hidden (view full) --- 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint 42/* 43static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95"; 44*/ 45static const char rcsid[] = |
46 "$FreeBSD: head/usr.sbin/lpr/lpd/printjob.c 68401 2000-11-06 19:36:38Z gad $"; | 46 "$FreeBSD: head/usr.sbin/lpr/lpd/printjob.c 68467 2000-11-08 00:52:11Z gad $"; |
47#endif /* not lint */ 48 49 50/* 51 * printjob -- print jobs in the queue. 52 * 53 * NOTE: the lock file is used to pass information to lpq and lprm. 54 * it does not need to be removed because file locks are dynamic. --- 279 unchanged lines hidden (view full) --- 334 * and performing the various actions. 335 */ 336static int 337printit(pp, file) 338 struct printer *pp; 339 char *file; 340{ 341 register int i; | 47#endif /* not lint */ 48 49 50/* 51 * printjob -- print jobs in the queue. 52 * 53 * NOTE: the lock file is used to pass information to lpq and lprm. 54 * it does not need to be removed because file locks are dynamic. --- 279 unchanged lines hidden (view full) --- 334 * and performing the various actions. 335 */ 336static int 337printit(pp, file) 338 struct printer *pp; 339 char *file; 340{ 341 register int i; |
342 char *cp; 343 int bombed = OK; | 342 char *cp; 343 int bombed = OK; 344 int didignorehdr = 0; |
344 345 /* 346 * open control file; ignore if no longer there. 347 */ 348 if ((cfp = fopen(file, "r")) == NULL) { 349 syslog(LOG_INFO, "%s: %s: %m", pp->printer, file); 350 return(OK); 351 } --- 132 unchanged lines hidden (view full) --- 484 continue; 485 486 case 'Z': /* locale for pr */ 487 strncpy(locale, line+1, sizeof(locale) - 1); 488 locale[sizeof(locale) - 1] = '\0'; 489 continue; 490 491 default: /* some file to print */ | 345 346 /* 347 * open control file; ignore if no longer there. 348 */ 349 if ((cfp = fopen(file, "r")) == NULL) { 350 syslog(LOG_INFO, "%s: %s: %m", pp->printer, file); 351 return(OK); 352 } --- 132 unchanged lines hidden (view full) --- 485 continue; 486 487 case 'Z': /* locale for pr */ 488 strncpy(locale, line+1, sizeof(locale) - 1); 489 locale[sizeof(locale) - 1] = '\0'; 490 continue; 491 492 default: /* some file to print */ |
492 switch (i = print(pp, line[0], line+1)) { | 493 /* only lowercase cmd-codes include a file-to-print */ 494 if ((line[0] < 'a') || (line[0] > 'z')) { 495 /* ignore any other lines */ 496 if (lflag <= 1) 497 continue; 498 if (!didignorehdr) { 499 syslog(LOG_INFO, "%s: in %s :", 500 pp->printer, file); 501 didignorehdr = 1; 502 } 503 syslog(LOG_INFO, "%s: ignoring line: '%c' %s", 504 pp->printer, line[0], &line[1]); 505 continue; 506 } 507 i = print(pp, line[0], line+1); 508 switch (i) { |
493 case ERROR: 494 if (bombed == OK) 495 bombed = FATALERR; 496 break; 497 case REPRINT: 498 (void) fclose(cfp); 499 return(REPRINT); 500 case FILTERERR: --- 60 unchanged lines hidden (view full) --- 561 register char *prog; 562 int fi, fo; 563 FILE *fp; 564 char *av[15], buf[BUFSIZ]; 565 int pid, p[2], stopped = 0; 566 union wait status; 567 struct stat stb; 568 | 509 case ERROR: 510 if (bombed == OK) 511 bombed = FATALERR; 512 break; 513 case REPRINT: 514 (void) fclose(cfp); 515 return(REPRINT); 516 case FILTERERR: --- 60 unchanged lines hidden (view full) --- 577 register char *prog; 578 int fi, fo; 579 FILE *fp; 580 char *av[15], buf[BUFSIZ]; 581 int pid, p[2], stopped = 0; 582 union wait status; 583 struct stat stb; 584 |
569 if (lstat(file, &stb) < 0 || (fi = open(file, O_RDONLY)) < 0) | 585 if (lstat(file, &stb) < 0 || (fi = open(file, O_RDONLY)) < 0) { 586 syslog(LOG_INFO, "%s: unable to open %s ('%c' line)", 587 pp->printer, file, format); |
570 return(ERROR); | 588 return(ERROR); |
589 } |
|
571 /* 572 * Check to see if data file is a symbolic link. If so, it should 573 * still point to the same file or someone is trying to print 574 * something he shouldn't. 575 */ 576 if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(fi, &stb) == 0 && 577 (stb.st_dev != fdev || stb.st_ino != fino)) 578 return(ACCESS); --- 1116 unchanged lines hidden --- | 590 /* 591 * Check to see if data file is a symbolic link. If so, it should 592 * still point to the same file or someone is trying to print 593 * something he shouldn't. 594 */ 595 if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(fi, &stb) == 0 && 596 (stb.st_dev != fdev || stb.st_ino != fino)) 597 return(ACCESS); --- 1116 unchanged lines hidden --- |