diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | sshd.c | 25 |
2 files changed, 14 insertions, 14 deletions
@@ -1,3 +1,6 @@ | |||
1 | 19991204 | ||
2 | - Small cleanup of PAM code in sshd.c | ||
3 | |||
1 | 19991126 | 4 | 19991126 |
2 | - Add definition for __P() | 5 | - Add definition for __P() |
3 | - Added [v]snprintf() replacement for systems that lack it | 6 | - Added [v]snprintf() replacement for systems that lack it |
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "includes.h" | 13 | #include "includes.h" |
14 | RCSID("$Id: sshd.c,v 1.32 1999/11/25 00:54:59 damien Exp $"); | 14 | RCSID("$Id: sshd.c,v 1.33 1999/12/04 09:24:48 damien Exp $"); |
15 | 15 | ||
16 | #include "xmalloc.h" | 16 | #include "xmalloc.h" |
17 | #include "rsa.h" | 17 | #include "rsa.h" |
@@ -138,8 +138,7 @@ void do_child(const char *command, struct passwd * pw, const char *term, | |||
138 | #ifdef HAVE_LIBPAM | 138 | #ifdef HAVE_LIBPAM |
139 | static int pamconv(int num_msg, const struct pam_message **msg, | 139 | static int pamconv(int num_msg, const struct pam_message **msg, |
140 | struct pam_response **resp, void *appdata_ptr); | 140 | struct pam_response **resp, void *appdata_ptr); |
141 | void do_pam_account_and_session(char *username, char *remote_user, | 141 | void do_pam_account_and_session(char *username, char *remote_user); |
142 | const char *remote_host); | ||
143 | void pam_cleanup_proc(void *context); | 142 | void pam_cleanup_proc(void *context); |
144 | 143 | ||
145 | static struct pam_conv conv = { | 144 | static struct pam_conv conv = { |
@@ -229,18 +228,16 @@ void pam_cleanup_proc(void *context) | |||
229 | } | 228 | } |
230 | } | 229 | } |
231 | 230 | ||
232 | void do_pam_account_and_session(char *username, char *remote_user, | 231 | void do_pam_account_and_session(char *username, char *remote_user) |
233 | const char *remote_host) | ||
234 | { | 232 | { |
235 | int pam_retval; | 233 | int pam_retval; |
236 | 234 | ||
237 | if (remote_host != NULL) { | 235 | debug("PAM setting rhost to \"%.200s\"", get_canonical_hostname()); |
238 | debug("PAM setting rhost to \"%.200s\"", remote_host); | 236 | pam_retval = pam_set_item((pam_handle_t *)pamh, PAM_RHOST, |
239 | pam_retval = pam_set_item((pam_handle_t *)pamh, PAM_RHOST, remote_host); | 237 | get_canonical_hostname()); |
240 | if (pam_retval != PAM_SUCCESS) { | 238 | if (pam_retval != PAM_SUCCESS) { |
241 | log("PAM set rhost failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); | 239 | log("PAM set rhost failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); |
242 | do_fake_authloop(username); | 240 | do_fake_authloop(username); |
243 | } | ||
244 | } | 241 | } |
245 | 242 | ||
246 | if (remote_user != NULL) { | 243 | if (remote_user != NULL) { |
@@ -1555,8 +1552,7 @@ do_authloop(struct passwd * pw) | |||
1555 | user); | 1552 | user); |
1556 | 1553 | ||
1557 | #ifdef HAVE_LIBPAM | 1554 | #ifdef HAVE_LIBPAM |
1558 | do_pam_account_and_session(pw->pw_name, client_user, | 1555 | do_pam_account_and_session(pw->pw_name, client_user); |
1559 | get_canonical_hostname()); | ||
1560 | 1556 | ||
1561 | /* Clean up */ | 1557 | /* Clean up */ |
1562 | if (client_user != NULL) | 1558 | if (client_user != NULL) |
@@ -2449,6 +2445,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
2449 | equals = strstr(pam_env[i], "="); | 2445 | equals = strstr(pam_env[i], "="); |
2450 | if ((strlen(pam_env[i]) < (sizeof(var_name) - 1)) && (equals != NULL)) | 2446 | if ((strlen(pam_env[i]) < (sizeof(var_name) - 1)) && (equals != NULL)) |
2451 | { | 2447 | { |
2448 | debug("PAM environment: %s=%s", var_name, var_val); | ||
2452 | memset(var_name, '\0', sizeof(var_name)); | 2449 | memset(var_name, '\0', sizeof(var_name)); |
2453 | memset(var_val, '\0', sizeof(var_val)); | 2450 | memset(var_val, '\0', sizeof(var_val)); |
2454 | strncpy(var_name, pam_env[i], equals - pam_env[i]); | 2451 | strncpy(var_name, pam_env[i], equals - pam_env[i]); |