Important fix (sshd && binding). Portable version only.

Arkadiusz Miskiewicz misiek at pld.ORG.PL
Sun Feb 18 00:54:28 EST 2001


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 ]





More information about the openssh-unix-dev mailing list