Path: utzoo!attcan!uunet!ginosko!ctrsol!cica!iuvax!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.bugs.4bsd Subject: rshd depends on risky assumption Keywords: 4.3BSD rshd bug Message-ID: <10803@smoke.BRL.MIL> Date: 23 Aug 89 07:18:43 GMT Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 The 4.3BSD rshd (normally in its child branch) unconditionally closes an FD named "f" in the source code without checking whether f = 0, 1, or 2. If inetd always starts the slave process with all three FDs open, this will work, but it seems an unsafe assumption. (Only FD 0 is documented as being set up by inetd.) There's no particular reason FD "f" shouldn't have been closed back where the dup2(f,*)s occur, being careful not to close(f) unless f > 2. By the way, to anyone who studies the rsh/rshd implementation, it should be apparent that it would be really useful to have a way to ask the kernel to "pump" data from one socket into another, instead of having to spawn a child process to do the pumping. With the kernel doing it, there would be far fewer context switches. Yours for improved plumbing...