diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.299 2018/06/09 02:58:02 djm Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.300 2018/06/09 03:03:10 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -1004,7 +1004,7 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) | |||
1004 | char buf[256]; | 1004 | char buf[256]; |
1005 | size_t n; | 1005 | size_t n; |
1006 | u_int i, envsize; | 1006 | u_int i, envsize; |
1007 | char *ocp, *cp, **env, *laddr; | 1007 | char *ocp, *cp, *value, **env, *laddr; |
1008 | struct passwd *pw = s->pw; | 1008 | struct passwd *pw = s->pw; |
1009 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) | 1009 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) |
1010 | char *path = NULL; | 1010 | char *path = NULL; |
@@ -1156,6 +1156,17 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) | |||
1156 | } | 1156 | } |
1157 | #endif /* USE_PAM */ | 1157 | #endif /* USE_PAM */ |
1158 | 1158 | ||
1159 | /* Environment specified by admin */ | ||
1160 | for (i = 0; i < options.num_setenv; i++) { | ||
1161 | cp = xstrdup(options.setenv[i]); | ||
1162 | if ((value = strchr(cp, '=')) == NULL) { | ||
1163 | /* shouldn't happen; vars are checked in servconf.c */ | ||
1164 | fatal("Invalid config SetEnv: %s", options.setenv[i]); | ||
1165 | } | ||
1166 | *value++ = '\0'; | ||
1167 | child_set_env(&env, &envsize, cp, value); | ||
1168 | } | ||
1169 | |||
1159 | /* SSH_CLIENT deprecated */ | 1170 | /* SSH_CLIENT deprecated */ |
1160 | snprintf(buf, sizeof buf, "%.50s %d %d", | 1171 | snprintf(buf, sizeof buf, "%.50s %d %d", |
1161 | ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), | 1172 | ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), |