diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-07-20 19:04:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-07-20 19:04:35 +0000 |
commit | 3f44510e292a3d9003bd794b6929b3e83cc0ea78 (patch) | |
tree | bae7d71513a71391e2905820f67a5e52b1ae56d6 /usr.sbin | |
parent | 6ca7dc94b8bcbf8dd19d92d8c70a636e16cec9fa (diff) |
careful with usernames; oliver
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index d5dfd927726..58a3418b467 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printjob.c,v 1.12 1997/07/19 07:11:44 deraadt Exp $ */ +/* $OpenBSD: printjob.c,v 1.13 1997/07/20 19:04:34 deraadt Exp $ */ /* $NetBSD: printjob.c,v 1.9.4.3 1996/07/12 22:31:39 jtc Exp $ */ /* @@ -185,7 +185,7 @@ printjob() /* * write process id for others to know */ - sprintf(line, "%u\n", pid); + sprintf(line, "%d\n", pid); pidoff = i = strlen(line); if (write(lfd, line, i) != i) { syslog(LOG_ERR, "%s: %s: %m", printer, LO); @@ -1048,6 +1048,8 @@ sendmail(user, bombed) struct stat stb; FILE *fp; + if (user[0] == '-' || user[0] == '/' || !isprint(user[0])) + return; pipe(p); if ((s = dofork(DORETURN)) == 0) { /* child */ dup2(p[0], 0); @@ -1105,9 +1107,12 @@ sendmail(user, bombed) } (void) close(p[0]); (void) close(p[1]); - wait(NULL); - syslog(LOG_INFO, "mail sent to user %s about job %s on printer %s (%s)", - user, *jobname ? jobname : "<unknown>", printer, cp); + if (s != -1) { + wait(NULL); + syslog(LOG_INFO, + "mail sent to user %s about job %s on printer %s (%s)", + user, *jobname ? jobname : "<unknown>", printer, cp); + } } /* |