diff options
author | Damien Miller <djm@mindrot.org> | 1999-10-29 09:57:31 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-10-29 09:57:31 +1000 |
commit | 9438816a5c561fe74a61773aee386cd1deb05ad2 (patch) | |
tree | 090d9895f43a5e550f3c0351391846b65f23112a /sshd.c | |
parent | 792c5113f1ba364680d294806ac0972b3deaceec (diff) |
Integrated PAM environment patch from Nalin Dahyabhai <nalin@thermo.stat.ncsu.edu>
Integrated make install patch from Niels Kristian Bech Jensen <nkbj@image.dk>
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -18,7 +18,7 @@ agent connections. | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: sshd.c,v 1.5 1999/10/28 23:18:29 damien Exp $"); | 21 | RCSID("$Id: sshd.c,v 1.6 1999/10/28 23:57:31 damien Exp $"); |
22 | 22 | ||
23 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
24 | #include "rsa.h" | 24 | #include "rsa.h" |
@@ -2328,6 +2328,28 @@ void do_child(const char *command, struct passwd *pw, const char *term, | |||
2328 | child_set_env(&env, &envsize, "KRBTKFILE", ticket); | 2328 | child_set_env(&env, &envsize, "KRBTKFILE", ticket); |
2329 | #endif /* KRB4 */ | 2329 | #endif /* KRB4 */ |
2330 | 2330 | ||
2331 | #ifdef HAVE_LIBPAM | ||
2332 | /* Pull in any environment variables that may have been set by PAM. */ | ||
2333 | { | ||
2334 | char *equal_sign, var_name[256], var_val[256]; | ||
2335 | long this_var; | ||
2336 | char **pam_env = pam_getenvlist(pamh); | ||
2337 | for(this_var = 0; pam_env && pam_env[this_var]; this_var++) | ||
2338 | { | ||
2339 | if(strlen(pam_env[this_var]) < sizeof(var_name)) | ||
2340 | if((equal_sign = strstr(pam_env[this_var], "=")) != NULL) | ||
2341 | { | ||
2342 | memset(var_name, 0, sizeof(var_name)); | ||
2343 | memset(var_val, 0, sizeof(var_val)); | ||
2344 | strncpy(var_name, pam_env[this_var], | ||
2345 | equal_sign - pam_env[this_var]); | ||
2346 | strcpy(var_val, equal_sign + 1); | ||
2347 | child_set_env(&env, &envsize, var_name, var_val); | ||
2348 | } | ||
2349 | } | ||
2350 | } | ||
2351 | #endif /* HAVE_LIBPAM */ | ||
2352 | |||
2331 | /* Set XAUTHORITY to always be a local file. */ | 2353 | /* Set XAUTHORITY to always be a local file. */ |
2332 | if (xauthfile) | 2354 | if (xauthfile) |
2333 | child_set_env(&env, &envsize, "XAUTHORITY", xauthfile); | 2355 | child_set_env(&env, &envsize, "XAUTHORITY", xauthfile); |