Debian Bug report logs - #569018
openssh-client: recreate mux control socket

version graph

Package: openssh-client; Maintainer for openssh-client is Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>; Source for openssh-client is src:openssh (PTS, buildd, popcon).

Reported by: "Andrew O. Shadoura" <bugzilla@tut.by>

Date: Tue, 9 Feb 2010 14:12:01 UTC

Severity: normal

Tags: fixed-upstream, patch

Merged with 523250

Found in versions openssh/1:5.1p1-5, openssh/1:5.3p1-1

Fixed in versions openssh/1:5.7p1-1, openssh/1:5.8p1-2

Done: Colin Watson <cjwatson@debian.org>

Bug is archived. No further changes may be made.

Forwarded to https://bugzilla.mindrot.org/show_bug.cgi?id=1711

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>:
Bug#569018; Package openssh-client. (Tue, 09 Feb 2010 14:12:04 GMT) (full text, mbox, link).


Acknowledgement sent to "Andrew O. Shadoura" <bugzilla@tut.by>:
New Bug report received and forwarded. Copy sent to Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>. (Tue, 09 Feb 2010 14:12:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: "Andrew O. Shadoura" <bugzilla@tut.by>
To: submit@bugs.debian.org
Subject: openssh-client: recreate mux control socket
Date: Tue, 9 Feb 2010 14:45:41 +0200
[Message part 1 (text/plain, inline)]
Package: openssh-client
Version: 1:5.3p1-1

Hello.

This patch enables re-creation of the control socket for multiplexing. Without 
it, if ssh dies, it leaves socket in place, and newly started ssh cannot bind 
to it.

-- 
WBR, Andrew
[mux.c.patch (text/x-patch, inline)]
--- openssh-5.3p1.orig/mux.c	2010-02-09 14:35:32.000000000 +0200
+++ openssh-5.3p1/mux.c	2010-02-09 11:03:25.000000000 +0200
@@ -143,16 +143,23 @@
 
 	old_umask = umask(0177);
 	if (bind(muxserver_sock, (struct sockaddr *)&addr, addr_len) == -1) {
-		muxserver_sock = -1;
 		if (errno == EINVAL || errno == EADDRINUSE) {
 			error("ControlSocket %s already exists, "
-			    "disabling multiplexing", options.control_path);
-			close(muxserver_sock);
-			muxserver_sock = -1;
-			xfree(options.control_path);
-			options.control_path = NULL;
-			options.control_master = SSHCTL_MASTER_NO;
-			return;
+			    "recreating socket", options.control_path);
+			unlink(options.control_path);
+			if (bind(muxserver_sock, (struct sockaddr *)&addr, addr_len) == -1) {
+				if (errno == EINVAL || errno == EADDRINUSE) {
+					error("ControlSocket %s already exists, "
+							"disabling multiplexing", options.control_path);
+					close(muxserver_sock);
+					muxserver_sock = -1;
+					xfree(options.control_path);
+					options.control_path = NULL;
+					options.control_master = SSHCTL_MASTER_NO;
+					return;
+				} else
+					fatal("%s bind(): %s", __func__, strerror(errno));
+			}
 		} else
 			fatal("%s bind(): %s", __func__, strerror(errno));
 	}
[signature.asc (application/pgp-signature, inline)]

Forcibly Merged 523250 569018. Request was from "Andrew O. Shadoura" <bugzilla@tut.by> to control@bugs.debian.org. (Tue, 09 Feb 2010 16:12:07 GMT) (full text, mbox, link).


Added tag(s) patch. Request was from "Andrew O. Shadoura" <bugzilla@tut.by> to control@bugs.debian.org. (Tue, 09 Feb 2010 16:12:08 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>:
Bug#569018; Package openssh-client. (Tue, 09 Feb 2010 16:27:04 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjwatson@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>. (Tue, 09 Feb 2010 16:27:04 GMT) (full text, mbox, link).


Message #14 received at 569018@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjwatson@debian.org>
To: "Andrew O. Shadoura" <bugzilla@tut.by>, 569018@bugs.debian.org
Subject: Re: Bug#569018: openssh-client: recreate mux control socket
Date: Tue, 9 Feb 2010 16:22:45 +0000
On Tue, Feb 09, 2010 at 02:45:41PM +0200, Andrew O. Shadoura wrote:
> This patch enables re-creation of the control socket for multiplexing. Without 
> it, if ssh dies, it leaves socket in place, and newly started ssh cannot bind 
> to it.

Thanks for your patch.  This has certainly long been an irritating
property of multiplexing.

It seems to me that this patch makes it a bit too easy to accidentally
trash an existing master just by setting ControlMaster to "yes", though.
Wouldn't it be better to do something like pinging the master to find
out if it's dead before recreating the socket, and disable multiplexing
as before if it's still alive?  That way there'd be no question about
whether it's appropriate to recreate the socket.  You could do the same
kind of thing as 'ssh -O check' does.

(Also, it would be best for this to go upstream to bugzilla.mindrot.org.
I can proxy for you if you like, but sometimes it's both better and
quicker for upstream to be able to discuss the patch directly with the
author rather than via an intermediary.)

Regards,

-- 
Colin Watson                                       [cjwatson@debian.org]




Information forwarded to debian-bugs-dist@lists.debian.org, Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>:
Bug#569018; Package openssh-client. (Tue, 09 Feb 2010 17:12:03 GMT) (full text, mbox, link).


Acknowledgement sent to "Andrew O. Shadoura" <bugzilla@tut.by>:
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>. (Tue, 09 Feb 2010 17:12:03 GMT) (full text, mbox, link).


Message #19 received at 569018@bugs.debian.org (full text, mbox, reply):

From: "Andrew O. Shadoura" <bugzilla@tut.by>
To: Colin Watson <cjwatson@debian.org>
Cc: 569018@bugs.debian.org
Subject: Re: Bug#569018: openssh-client: recreate mux control socket
Date: Tue, 9 Feb 2010 18:34:50 +0200
[Message part 1 (text/plain, inline)]
On Tuesday 09 February 2010 18:22:45 Colin Watson wrote:
> On Tue, Feb 09, 2010 at 02:45:41PM +0200, Andrew O. Shadoura wrote:
> > This patch enables re-creation of the control socket for multiplexing.
> > Without it, if ssh dies, it leaves socket in place, and newly started ssh
> > cannot bind to it.

> Thanks for your patch.  This has certainly long been an irritating
> property of multiplexing.

> It seems to me that this patch makes it a bit too easy to accidentally
> trash an existing master just by setting ControlMaster to "yes", though.
> Wouldn't it be better to do something like pinging the master to find
> out if it's dead before recreating the socket, and disable multiplexing
> as before if it's still alive?  That way there'd be no question about
> whether it's appropriate to recreate the socket.  You could do the same
> kind of thing as 'ssh -O check' does.

Doesn't it try to connect to the socket first? I didn't dig into source deeply 
enough, but at least it says on stderr that "connection refused".

> (Also, it would be best for this to go upstream to bugzilla.mindrot.org.
> I can proxy for you if you like, but sometimes it's both better and
> quicker for upstream to be able to discuss the patch directly with the
> author rather than via an intermediary.)

Ok, will try.

-- 
WBR, Andrew
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>:
Bug#569018; Package openssh-client. (Mon, 29 Mar 2010 15:09:08 GMT) (full text, mbox, link).


Acknowledgement sent to "Andrew O. Shadoura" <bugzilla@tut.by>:
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>. (Mon, 29 Mar 2010 15:09:08 GMT) (full text, mbox, link).


Message #24 received at 569018@bugs.debian.org (full text, mbox, reply):

From: "Andrew O. Shadoura" <bugzilla@tut.by>
To: Colin Watson <cjwatson@debian.org>
Cc: 569018@bugs.debian.org
Subject: Re: Bug#569018: openssh-client: recreate mux control socket
Date: Mon, 29 Mar 2010 18:06:23 +0300
[Message part 1 (text/plain, inline)]
Hello Colin.

On Tuesday 09 February 2010 18:22:45 Colin Watson wrote:
> (Also, it would be best for this to go upstream to bugzilla.mindrot.org.
> I can proxy for you if you like, but sometimes it's both better and
> quicker for upstream to be able to discuss the patch directly with the
> author rather than via an intermediary.)

I've posted a bug report there, still got no reply from them. Should I ping 
someone individually there? :)

-- 
WBR, Andrew
[signature.asc (application/pgp-signature, inline)]

Set Bug forwarded-to-address to 'https://bugzilla.mindrot.org/show_bug.cgi?id=1711'. Request was from Colin Watson <cjwatson@debian.org> to control@bugs.debian.org. (Mon, 29 Mar 2010 15:27:09 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>:
Bug#569018; Package openssh-client. (Fri, 24 Sep 2010 14:36:03 GMT) (full text, mbox, link).


Acknowledgement sent to "Andrew O. Shadoura" <bugzilla@tut.by>:
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>. (Fri, 24 Sep 2010 14:36:03 GMT) (full text, mbox, link).


Message #31 received at 569018@bugs.debian.org (full text, mbox, reply):

From: "Andrew O. Shadoura" <bugzilla@tut.by>
To: 569018@bugs.debian.org
Cc: control@bugs.debian.org
Subject: openssh-client: recreate mux control socket
Date: Fri, 24 Sep 2010 17:32:06 +0300
[Message part 1 (text/plain, inline)]
tags 569018 + fixed-upstream
--

Hello.

The bug is fixed by recent upstream commit:

--- Comment #1 from Damien Miller <djm@mindrot.org> 2010-09-24 22:20:14 EST
OpenSSH -current now atomically establishes a listening mux master
socket at the specified location, so a client encountering a mux master
socket that refuses connection can safely delete it and process to
establish its own. This change will be released in OpenSSH 5.7, due in
a couple of months.
---

Here is it:
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/mux.c.diff?r1=1.21;r2=1.22;f=h

-- 
WBR, Andrew
[signature.asc (application/pgp-signature, inline)]

Added tag(s) fixed-upstream. Request was from "Andrew O. Shadoura" <bugzilla@tut.by> to control@bugs.debian.org. (Fri, 24 Sep 2010 14:36:04 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 09 Aug 2011 07:34:21 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Mar 26 00:28:48 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.