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

Arkadiusz Miskiewicz misiek at pld.ORG.PL
Sun Feb 18 03:04:49 EST 2001


On/Dnia Sat, Feb 17, 2001 at 04:44:44PM +0100, Kevin Steves wrote/napisał(a)
> 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?
It's to avoid error message

> let's just sync with openbsd.  commit?
this will cause error message displayed with _proper_ sshd_config.
On Linux you can't do:
s1 = socket(AF_INET, ...)
bind(s1, INADDR_ANY, port 22 ...);
s2 = socket(AF_INET6, ...)
bind(s2, in6addr_any, port22 ...);

while on *BSD you can. BSD treats ipv4 and ipv6 separately while linux not.

>  			/* 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);

-- 
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