diff options
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 16 |
1 files changed, 13 insertions, 3 deletions
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" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.134 2002/09/13 19:23:09 stevesk Exp $"); | 16 | RCSID("$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; | |||
41 | extern char *__progname; | 41 | extern char *__progname; |
42 | extern uid_t original_real_uid; | 42 | extern uid_t original_real_uid; |
43 | extern uid_t original_effective_uid; | 43 | extern uid_t original_effective_uid; |
44 | extern 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]); |