diff options
author | imp <imp@FreeBSD.org> | 1997-10-06 03:58:48 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-10-06 03:58:48 +0000 |
commit | 580b436a25f730d9c2a66b5494736e4eab9d77e1 (patch) | |
tree | 016c9c78f7987303f16b4913dc46ef0c2cd3fc27 /usr.sbin/lpr/lpd | |
parent | 6bcfcc579293be49da5cb38468d2cfe9d800380d (diff) | |
download | FreeBSD-src-580b436a25f730d9c2a66b5494736e4eab9d77e1.zip FreeBSD-src-580b436a25f730d9c2a66b5494736e4eab9d77e1.tar.gz |
Be more paranoid about unlinking files. From mhpower@MIT.EDU by way of
Theo de Raadt.
Likely 2.2.5R candidate.
Obtained from: OpenBSD
Diffstat (limited to 'usr.sbin/lpr/lpd')
-rw-r--r-- | usr.sbin/lpr/lpd/recvjob.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c index 192d993..0a10e49 100644 --- a/usr.sbin/lpr/lpd/recvjob.c +++ b/usr.sbin/lpr/lpd/recvjob.c @@ -43,7 +43,7 @@ static const char copyright[] = static char sccsid[] = "@(#)recvjob.c 8.2 (Berkeley) 4/27/95"; #endif static const char rcsid[] = - "$Id$"; + "$Id: recvjob.c,v 1.10 1997/09/24 06:47:55 charnier Exp $"; #endif /* not lint */ /* @@ -263,7 +263,8 @@ readfile(file, size) if (err) frecverr("%s: write error", file); if (noresponse()) { /* file sent had bad data in it */ - (void) unlink(file); + if (strchr(file, '/') == NULL) + (void) unlink(file); return(0); } ack(); @@ -328,15 +329,16 @@ static void rcleanup(signo) int signo; { - if (tfname[0]) + if (tfname[0] && strchr(tfname, '/') == NULL) (void) unlink(tfname); - if (dfname[0]) + if (dfname[0] && strchr(dfname, '/') == NULL) { do { do (void) unlink(dfname); while (dfname[2]-- != 'A'); dfname[2] = 'z'; } while (dfname[0]-- != 'd'); + } dfname[0] = '\0'; } |