diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 41 |
1 files changed, 40 insertions, 1 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: ssh.c,v 1.211 2004/04/19 21:51:49 djm Exp $"); | 43 | RCSID("$OpenBSD: ssh.c,v 1.212 2004/04/27 09:46:37 djm Exp $"); |
44 | 44 | ||
45 | #include <openssl/evp.h> | 45 | #include <openssl/evp.h> |
46 | #include <openssl/err.h> | 46 | #include <openssl/err.h> |
@@ -68,6 +68,7 @@ RCSID("$OpenBSD: ssh.c,v 1.211 2004/04/19 21:51:49 djm Exp $"); | |||
68 | #include "kex.h" | 68 | #include "kex.h" |
69 | #include "mac.h" | 69 | #include "mac.h" |
70 | #include "sshtty.h" | 70 | #include "sshtty.h" |
71 | #include "match.h" | ||
71 | 72 | ||
72 | #ifdef SMARTCARD | 73 | #ifdef SMARTCARD |
73 | #include "scard.h" | 74 | #include "scard.h" |
@@ -1057,6 +1058,44 @@ ssh_session2_setup(int id, void *arg) | |||
1057 | packet_send(); | 1058 | packet_send(); |
1058 | } | 1059 | } |
1059 | 1060 | ||
1061 | /* Transfer any environment variables from client to server */ | ||
1062 | if (options.num_send_env != 0) { | ||
1063 | int i, j, matched; | ||
1064 | extern char **environ; | ||
1065 | char *name, *val; | ||
1066 | |||
1067 | debug("Sending environment."); | ||
1068 | for (i = 0; environ && environ[i] != NULL; i++) { | ||
1069 | /* Split */ | ||
1070 | name = xstrdup(environ[i]); | ||
1071 | if ((val = strchr(name, '=')) == NULL) { | ||
1072 | free(name); | ||
1073 | continue; | ||
1074 | } | ||
1075 | *val++ = '\0'; | ||
1076 | |||
1077 | matched = 0; | ||
1078 | for (j = 0; j < options.num_send_env; j++) { | ||
1079 | if (match_pattern(name, options.send_env[j])) { | ||
1080 | matched = 1; | ||
1081 | break; | ||
1082 | } | ||
1083 | } | ||
1084 | if (!matched) { | ||
1085 | debug3("Ignored env %s", name); | ||
1086 | free(name); | ||
1087 | continue; | ||
1088 | } | ||
1089 | |||
1090 | debug("Sending env %s = %s", name, val); | ||
1091 | channel_request_start(id, "env", 0); | ||
1092 | packet_put_cstring(name); | ||
1093 | packet_put_cstring(val); | ||
1094 | packet_send(); | ||
1095 | free(name); | ||
1096 | } | ||
1097 | } | ||
1098 | |||
1060 | len = buffer_len(&command); | 1099 | len = buffer_len(&command); |
1061 | if (len > 0) { | 1100 | if (len > 0) { |
1062 | if (len > 900) | 1101 | if (len > 900) |