[patch] sshd with re-exec disabled causes stdin to get closed.

Dave Johnson dave-openssh-post-20040825 at centerclick.org
Thu Aug 26 22:25:23 EST 2004


Dave Johnson writes:
> 
> I ran into a bug while testing 3.9p1.
> 
> If you start sshd with -r (re-exec disabled), once the daemon is
> forked to handle a client, the child closes stdin by accident.
> 
> This causes FD 0 to get re-used by the next open call which eventually
> you end up with a mess.  In the perticual case I saw, the pty fd
> ended up on FD 0 was closed by do_exec_pty(),
> pty_make_controlling_tty() then opened a new ttyfd as 0, and
> do_exec_pty() duped it dup2(0,0), dup2(0,1), dup2(0,2), then called
> close(ttyfd); which closed 0!
> 
> Patch against openssh-3.9p1 is attached.

Patch is now also at:

http://centerclick.org/reexec.patch

-- 
Dave




More information about the openssh-unix-dev mailing list