summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2007-09-17 12:04:08 +1000
committerDamien Miller <djm@mindrot.org>2007-09-17 12:04:08 +1000
commit54fd7cf2db5327f304825e0f9aaf9af5a490a75f (patch)
tree37d1a37a4ff6a5a7b6e774937ba3703edca7bc1a /clientloop.c
parent1d824ab2e72daf8563f6dc72f4b3638da3b91dce (diff)
- djm@cvs.openbsd.org 2007/09/04 03:21:03
[clientloop.c monitor.c monitor_fdpass.c monitor_fdpass.h] [monitor_wrap.c ssh.c] make file descriptor passing code return an error rather than call fatal() when it encounters problems, and use this to make session multiplexing masters survive slaves failing to pass all stdio FDs; ok markus@
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/clientloop.c b/clientloop.c
index b57fda042..7a61cb74d 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.181 2007/08/15 08:14:46 markus Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.182 2007/09/04 03:21:03 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -722,7 +722,7 @@ client_process_control(fd_set *readset)
722 struct sockaddr_storage addr; 722 struct sockaddr_storage addr;
723 struct confirm_ctx *cctx; 723 struct confirm_ctx *cctx;
724 char *cmd; 724 char *cmd;
725 u_int i, len, env_len, command, flags; 725 u_int i, j, len, env_len, command, flags;
726 uid_t euid; 726 uid_t euid;
727 gid_t egid; 727 gid_t egid;
728 728
@@ -870,9 +870,22 @@ client_process_control(fd_set *readset)
870 xfree(cmd); 870 xfree(cmd);
871 871
872 /* Gather fds from client */ 872 /* Gather fds from client */
873 new_fd[0] = mm_receive_fd(client_fd); 873 for(i = 0; i < 3; i++) {
874 new_fd[1] = mm_receive_fd(client_fd); 874 if ((new_fd[i] = mm_receive_fd(client_fd)) == -1) {
875 new_fd[2] = mm_receive_fd(client_fd); 875 error("%s: failed to receive fd %d from slave",
876 __func__, i);
877 for (j = 0; j < i; j++)
878 close(new_fd[j]);
879 for (j = 0; j < env_len; j++)
880 xfree(cctx->env[j]);
881 if (env_len > 0)
882 xfree(cctx->env);
883 xfree(cctx->term);
884 buffer_free(&cctx->cmd);
885 xfree(cctx);
886 return;
887 }
888 }
876 889
877 debug2("%s: got fds stdin %d, stdout %d, stderr %d", __func__, 890 debug2("%s: got fds stdin %d, stdout %d, stderr %d", __func__,
878 new_fd[0], new_fd[1], new_fd[2]); 891 new_fd[0], new_fd[1], new_fd[2]);