diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: ssh.c,v 1.214 2004/06/13 15:03:02 djm Exp $"); | 43 | RCSID("$OpenBSD: ssh.c,v 1.215 2004/06/17 14:52:48 djm Exp $"); |
44 | 44 | ||
45 | #include <openssl/evp.h> | 45 | #include <openssl/evp.h> |
46 | #include <openssl/err.h> | 46 | #include <openssl/err.h> |
@@ -1080,6 +1080,8 @@ ssh_control_listener(void) | |||
1080 | static void | 1080 | static void |
1081 | ssh_session2_setup(int id, void *arg) | 1081 | ssh_session2_setup(int id, void *arg) |
1082 | { | 1082 | { |
1083 | extern char **environ; | ||
1084 | |||
1083 | int interactive = tty_flag; | 1085 | int interactive = tty_flag; |
1084 | if (options.forward_x11 && getenv("DISPLAY") != NULL) { | 1086 | if (options.forward_x11 && getenv("DISPLAY") != NULL) { |
1085 | char *proto, *data; | 1087 | char *proto, *data; |
@@ -1100,7 +1102,7 @@ ssh_session2_setup(int id, void *arg) | |||
1100 | } | 1102 | } |
1101 | 1103 | ||
1102 | client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"), | 1104 | client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"), |
1103 | NULL, fileno(stdin), &command, &ssh_subsystem_reply); | 1105 | NULL, fileno(stdin), &command, environ, &ssh_subsystem_reply); |
1104 | 1106 | ||
1105 | packet_set_interactive(interactive); | 1107 | packet_set_interactive(interactive); |
1106 | } | 1108 | } |
@@ -1230,9 +1232,10 @@ static void | |||
1230 | control_client(const char *path) | 1232 | control_client(const char *path) |
1231 | { | 1233 | { |
1232 | struct sockaddr_un addr; | 1234 | struct sockaddr_un addr; |
1233 | int r, sock, exitval, addr_len; | 1235 | int i, r, sock, exitval, addr_len; |
1234 | Buffer m; | 1236 | Buffer m; |
1235 | char *cp; | 1237 | char *cp; |
1238 | extern char **environ; | ||
1236 | 1239 | ||
1237 | memset(&addr, '\0', sizeof(addr)); | 1240 | memset(&addr, '\0', sizeof(addr)); |
1238 | addr.sun_family = AF_UNIX; | 1241 | addr.sun_family = AF_UNIX; |
@@ -1265,8 +1268,6 @@ control_client(const char *path) | |||
1265 | fatal("%s: wrong version", __func__); | 1268 | fatal("%s: wrong version", __func__); |
1266 | control_server_pid = buffer_get_int(&m); | 1269 | control_server_pid = buffer_get_int(&m); |
1267 | 1270 | ||
1268 | /* XXX: env passing */ | ||
1269 | |||
1270 | buffer_clear(&m); | 1271 | buffer_clear(&m); |
1271 | buffer_put_int(&m, tty_flag); | 1272 | buffer_put_int(&m, tty_flag); |
1272 | buffer_put_int(&m, subsystem_flag); | 1273 | buffer_put_int(&m, subsystem_flag); |
@@ -1275,6 +1276,13 @@ control_client(const char *path) | |||
1275 | buffer_append(&command, "\0", 1); | 1276 | buffer_append(&command, "\0", 1); |
1276 | buffer_put_cstring(&m, buffer_ptr(&command)); | 1277 | buffer_put_cstring(&m, buffer_ptr(&command)); |
1277 | 1278 | ||
1279 | /* Pass environment */ | ||
1280 | for (i = 0; environ != NULL && environ[i] != NULL; i++) | ||
1281 | ; | ||
1282 | buffer_put_int(&m, i); | ||
1283 | for (i = 0; environ != NULL && environ[i] != NULL; i++) | ||
1284 | buffer_put_cstring(&m, environ[i]); | ||
1285 | |||
1278 | if (ssh_msg_send(sock, /* version */0, &m) == -1) | 1286 | if (ssh_msg_send(sock, /* version */0, &m) == -1) |
1279 | fatal("%s: msg_send", __func__); | 1287 | fatal("%s: msg_send", __func__); |
1280 | 1288 | ||