summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ssh.c13
-rw-r--r--sshconnect.c16
3 files changed, 30 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 64b36b57c..938a39181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,10 @@
24 don't quit while creating X11 listening socket. 24 don't quit while creating X11 listening socket.
25 http://mail-index.netbsd.org/current-users/2002/09/16/0005.html 25 http://mail-index.netbsd.org/current-users/2002/09/16/0005.html
26 got from portable. markus ok 26 got from portable. markus ok
27 - djm@cvs.openbsd.org 2002/09/19 01:58:18
28 [ssh.c sshconnect.c]
29 bugzilla.mindrot.org #223 - ProxyCommands don't exit.
30 Patch from dtucker@zip.com.au; ok markus@
27 31
2820020912 3220020912
29 - (djm) Made GNOME askpass programs return non-zero if cancel button is 33 - (djm) Made GNOME askpass programs return non-zero if cancel button is
@@ -674,4 +678,4 @@
674 save auth method before monitor_reset_key_state(); bugzilla bug #284; 678 save auth method before monitor_reset_key_state(); bugzilla bug #284;
675 ok provos@ 679 ok provos@
676 680
677$Id: ChangeLog,v 1.2470 2002/09/19 01:54:54 djm Exp $ 681$Id: ChangeLog,v 1.2471 2002/09/19 02:05:02 djm Exp $
diff --git a/ssh.c b/ssh.c
index 7cef5e5ac..2c589de82 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.185 2002/09/11 18:27:26 stevesk Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.186 2002/09/19 01:58:18 djm Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -146,6 +146,9 @@ int subsystem_flag = 0;
146/* # of replies received for global requests */ 146/* # of replies received for global requests */
147static int client_global_request_id = 0; 147static int client_global_request_id = 0;
148 148
149/* pid of proxycommand child process */
150pid_t proxy_command_pid = 0;
151
149/* Prints a help message to the user. This function never returns. */ 152/* Prints a help message to the user. This function never returns. */
150 153
151static void 154static void
@@ -722,6 +725,14 @@ again:
722 725
723 exit_status = compat20 ? ssh_session2() : ssh_session(); 726 exit_status = compat20 ? ssh_session2() : ssh_session();
724 packet_close(); 727 packet_close();
728
729 /*
730 * Send SIGHUP to proxy command if used. We don't wait() in
731 * case it hangs and instead rely on init to reap the child
732 */
733 if (proxy_command_pid > 1)
734 kill(proxy_command_pid, SIGHUP);
735
725 return exit_status; 736 return exit_status;
726} 737}
727 738
diff --git a/sshconnect.c b/sshconnect.c
index 0cb824852..776d72065 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.134 2002/09/13 19:23:09 stevesk Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.135 2002/09/19 01:58:18 djm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -41,6 +41,7 @@ extern Options options;
41extern char *__progname; 41extern char *__progname;
42extern uid_t original_real_uid; 42extern uid_t original_real_uid;
43extern uid_t original_effective_uid; 43extern uid_t original_effective_uid;
44extern pid_t proxy_command_pid;
44 45
45#ifndef INET6_ADDRSTRLEN /* for non IPv6 machines */ 46#ifndef INET6_ADDRSTRLEN /* for non IPv6 machines */
46#define INET6_ADDRSTRLEN 46 47#define INET6_ADDRSTRLEN 46
@@ -64,9 +65,16 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
64 /* Convert the port number into a string. */ 65 /* Convert the port number into a string. */
65 snprintf(strport, sizeof strport, "%hu", port); 66 snprintf(strport, sizeof strport, "%hu", port);
66 67
67 /* Build the final command string in the buffer by making the 68 /*
68 appropriate substitutions to the given proxy command. */ 69 * Build the final command string in the buffer by making the
70 * appropriate substitutions to the given proxy command.
71 *
72 * Use "exec" to avoid "sh -c" processes on some platforms
73 * (e.g. Solaris)
74 */
69 buffer_init(&command); 75 buffer_init(&command);
76 buffer_append(&command, "exec ", 5);
77
70 for (cp = proxy_command; *cp; cp++) { 78 for (cp = proxy_command; *cp; cp++) {
71 if (cp[0] == '%' && cp[1] == '%') { 79 if (cp[0] == '%' && cp[1] == '%') {
72 buffer_append(&command, "%", 1); 80 buffer_append(&command, "%", 1);
@@ -134,6 +142,8 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
134 /* Parent. */ 142 /* Parent. */
135 if (pid < 0) 143 if (pid < 0)
136 fatal("fork failed: %.100s", strerror(errno)); 144 fatal("fork failed: %.100s", strerror(errno));
145 else
146 proxy_command_pid = pid; /* save pid to clean up later */
137 147
138 /* Close child side of the descriptors. */ 148 /* Close child side of the descriptors. */
139 close(pin[0]); 149 close(pin[0]);