Arkadiusz Miskiewicz
2001-Feb-17 13:54 UTC
Important fix (sshd && binding). Portable version only.
If bind() fails we _always_ should close socket. I sent this patch while ago to djm but I still don't see this fix in openssh_cvs. diff -urN openssh-2.3.0p1.org/sshd.c openssh-2.3.0p1/sshd.c --- openssh-2.3.0p1.org/sshd.c Sat Jan 6 19:54:11 2001 +++ openssh-2.3.0p1/sshd.c Sat Jan 6 19:55:48 2001 @@ -782,10 +782,10 @@ debug("Bind to port %s on %s.", strport, ntop); /* Bind the socket to the desired port. */ - if ((bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) && - (!ai->ai_next)) { - error("Bind to port %s on %s failed: %.200s.", - strport, ntop, strerror(errno)); + if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { + if (!ai->ai_next) + error("Bind to port %s on %s failed: %.200s.", + strport, ntop, strerror(errno)); close(listen_sock); continue; } -- Arkadiusz Mi?kiewicz, AM2-6BONE [ PLD GNU/Linux IPv6 ] http://www.t17.ds.pwr.wroc.pl/~misiek/ipv6/ [ enabled ]
Kevin Steves
2001-Feb-17 15:44 UTC
Important fix (sshd && binding). Portable version only.
On Sat, 17 Feb 2001, Arkadiusz Miskiewicz wrote: : If bind() fails we _always_ should close socket. I sent this patch while ago : to djm but I still don't see this fix in openssh_cvs. i don't know why the test for !ai->ai_next was added? anyone? let's just sync with openbsd. commit? Index: sshd.c ==================================================================RCS file: /var/cvs/openssh/sshd.c,v retrieving revision 1.120 diff -u -r1.120 sshd.c --- sshd.c 2001/02/15 03:17:13 1.120 +++ sshd.c 2001/02/17 15:41:54 @@ -849,8 +849,7 @@ debug("Bind to port %s on %s.", strport, ntop); /* Bind the socket to the desired port. */ - if ((bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) && - (!ai->ai_next)) { + if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { error("Bind to port %s on %s failed: %.200s.", strport, ntop, strerror(errno)); close(listen_sock);
Damien Miller
2001-Feb-18 01:36 UTC
Important fix (sshd && binding). Portable version only.
On Sat, 17 Feb 2001, Arkadiusz Miskiewicz wrote:> If bind() fails we _always_ should close socket. I sent this patch > while ago to djm but I still don't see this fix in openssh_cvs.I don't recall seeing this, but thanks - applied. -d -- | Damien Miller <djm at mindrot.org> \ ``E-mail attachments are the poor man's | http://www.mindrot.org / distributed filesystem'' - Dan Geer