Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.unix.wizards Subject: Re: lpr output filters Summary: isatty() is not the whole solution Message-ID: <8402@xanth.cs.odu.edu> Date: 10 Apr 89 19:02:16 GMT References: <1158@novavax.UUCP> Distribution: usa Organization: Old Dominion University, Norfolk, Va. Lines: 41 In article <8185@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >*In article <1159@novavax.UUCP> gls@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 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