git: a812a5cacbe0 - main - lpr: remove a.out binary detection
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 15 Apr 2022 19:06:46 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=a812a5cacbe06b6ca6917a1e2c023f1e8fe5df2c commit a812a5cacbe06b6ca6917a1e2c023f1e8fe5df2c Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2022-04-15 19:04:41 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2022-04-15 19:04:41 +0000 lpr: remove a.out binary detection Since the first unattributed commit in 1981, lpr has attempted to prevent users from printing executables (and in earlier versions archives). Archive detection was lost in 1992 when lpr gained a dependency on a.out.h. No corresponding support was added for ELF files with the full transiation to ELF in 1998, but a.out support has been dragged forward to and contaminated platforms that never supported a.out. While this feature isn't unuseful, preventing the printing of a single file format we stopped producing ~20 years ago isn't worth the costs (however minimal). Reviewed by: gad, imp, emaste Differential Revision: https://reviews.freebsd.org/D34901 --- usr.sbin/lpr/lpr/lpr.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index 72ba2b3929f1..9845a3774fbe 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include <dirent.h> #include <fcntl.h> -#include <a.out.h> #include <err.h> #include <locale.h> #include <signal.h> @@ -703,7 +702,6 @@ cleanup(int signo __unused) static int test(const char *file) { - struct exec execb; size_t dlen; int fd; char *cp, *dirpath; @@ -728,14 +726,6 @@ test(const char *file) printf("%s: cannot open %s\n", progname, file); return(-1); } - /* - * XXX Shall we add a similar test for ELF? - */ - if (read(fd, &execb, sizeof(execb)) == sizeof(execb) && - !N_BADMAG(execb)) { - printf("%s: %s is an executable program", progname, file); - goto error1; - } (void) close(fd); if (rflag) { /* @@ -763,11 +753,6 @@ test(const char *file) printf("%s: %s: is not removable by you\n", progname, file); } return(0); - -error1: - printf(" and is unprintable\n"); - (void) close(fd); - return(-1); } static int