[ssh.c ssh_config.5]
     fallback gracefully if client cannot connect to ControlPath. ok djm@
This commit is contained in:
Damien Miller 2005-05-26 12:07:13 +10:00
parent ac7a0059e2
commit dadfd4dd38
3 changed files with 26 additions and 15 deletions

View File

@ -38,6 +38,9 @@
- jmc@cvs.openbsd.org 2005/04/26 12:59:02
[sftp-client.h]
spelling correction in comment from wiz@netbsd;
- jakob@cvs.openbsd.org 2005/04/26 13:08:37
[ssh.c ssh_config.5]
fallback gracefully if client cannot connect to ControlPath. ok djm@
20050524
- (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
@ -2537,4 +2540,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3771 2005/05/26 02:05:49 djm Exp $
$Id: ChangeLog,v 1.3772 2005/05/26 02:07:13 djm Exp $

29
ssh.c
View File

@ -40,7 +40,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: ssh.c,v 1.236 2005/04/21 11:47:19 djm Exp $");
RCSID("$OpenBSD: ssh.c,v 1.237 2005/04/26 13:08:37 jakob Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@ -613,7 +613,7 @@ again:
options.control_path, original_real_uid);
}
if (options.control_path != NULL && options.control_master == 0)
control_client(options.control_path); /* This doesn't return */
control_client(options.control_path);
/* Open a connection to the remote host. */
if (ssh_connect(host, &hostaddr, options.port,
@ -1290,15 +1290,6 @@ control_client(const char *path)
extern char **environ;
u_int flags;
if (stdin_null_flag) {
if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
fatal("open(/dev/null): %s", strerror(errno));
if (dup2(fd, STDIN_FILENO) == -1)
fatal("dup2: %s", strerror(errno));
if (fd > STDERR_FILENO)
close(fd);
}
memset(&addr, '\0', sizeof(addr));
addr.sun_family = AF_UNIX;
addr_len = offsetof(struct sockaddr_un, sun_path) +
@ -1311,8 +1302,20 @@ control_client(const char *path)
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
fatal("%s socket(): %s", __func__, strerror(errno));
if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1)
fatal("Couldn't connect to %s: %s", path, strerror(errno));
if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) {
debug("Couldn't connect to %s: %s", path, strerror(errno));
close(sock);
return;
}
if (stdin_null_flag) {
if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
fatal("open(/dev/null): %s", strerror(errno));
if (dup2(fd, STDIN_FILENO) == -1)
fatal("dup2: %s", strerror(errno));
if (fd > STDERR_FILENO)
close(fd);
}
if ((term = getenv("TERM")) == NULL)
term = "";

View File

@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: ssh_config.5,v 1.50 2005/04/21 06:17:50 djm Exp $
.\" $OpenBSD: ssh_config.5,v 1.51 2005/04/26 13:08:37 jakob Exp $
.Dd September 25, 1999
.Dt SSH_CONFIG 5
.Os
@ -270,6 +270,11 @@ to listen for control connections, but require confirmation using the
program before they are accepted (see
.Xr ssh-add 1
for details).
If the
.Cm ControlPath
can not be opened,
.Nm ssh
will continue without connecting to a master instance.
.It Cm ControlPath
Specify the path to the control socket used for connection sharing.
See