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
This commit is contained in:
parent
e2cec5ba2c
commit
a812a5cacb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user