lpr output filters
Lloyd Kremer
kremer at cs.odu.edu
Tue Apr 11 05:02:16 AEST 1989
In article <8185 at chinet.chi.il.us> les at chinet.chi.il.us (Leslie Mikesell)
writes:
>*In article <1159 at novavax.UUCP> gls at novavax.UUCP (Gary Schaps) writes:
>*>> > Does it seem reasonable to try to create an lpr output filter which
>*>> > selectively prevents certain files from being printed?
>*
>*>I would like to "protect" certain files by making them "view only".
>
>................................... The best you could do would be
>to make the files unreadable by normal users and provide a setuid program
>that displays the contents only if the output is directly to a terminal.
Even this can be tricky to get right in all cases. I just ran this program
on our AT&T 3B2 running UNIX(tm) System V Release 3:
#include <fcntl.h>
main()
{
int fd;
if((fd = open("/dev/tty15", O_WRONLY)) != -1){
printf("isatty() returns %d\n", isatty(fd));
close(fd);
}
return(0);
}
It produced:
isatty() returns 1
On our system, /dev/tty15 is a NEC Pinwriter P2 parallel printer.
Not all "ttys" are real terminals.
Lloyd Kremer
Brooks Financial Systems
{uunet,sun,...}!xanth!brooks!lloyd
More information about the Comp.unix.wizards
mailing list