summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-02-14 00:45:51 +1100
committerDamien Miller <djm@mindrot.org>2001-02-14 00:45:51 +1100
commit6b4146ad739da603a298474db67824532508c3b8 (patch)
tree827aa4bbbd6920b55649fb03016847a2a51bab2c /session.c
parent3dfeee46d710c74f48919c827b2403dc7a63c591 (diff)
- (djm) Move PAM session initialisation until after fork in sshd. Patch
from Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'session.c')
-rw-r--r--session.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/session.c b/session.c
index 9b860c29..7319df3d 100644
--- a/session.c
+++ b/session.c
@@ -484,10 +484,6 @@ do_exec_no_pty(Session *s, const char *command, struct passwd * pw)
session_proctitle(s);
-#ifdef USE_PAM
- do_pam_setcred();
-#endif /* USE_PAM */
-
/* Fork the child. */
if ((pid = fork()) == 0) {
/* Child. Reinitialize the log since the pid has changed. */
@@ -600,11 +596,6 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
ptyfd = s->ptyfd;
ttyfd = s->ttyfd;
-#ifdef USE_PAM
- do_pam_session(pw->pw_name, s->tty);
- do_pam_setcred();
-#endif /* USE_PAM */
-
/* Fork the child. */
if ((pid = fork()) == 0) {
/* Child. Reinitialize the log because the pid has changed. */
@@ -1156,6 +1147,11 @@ do_child(const char *command, struct passwd * pw, const char *term,
shell = login_getcapstr(lc, "shell", (char *)shell, (char *)shell);
#endif
+#ifdef USE_PAM
+ do_pam_session(pw->pw_name, ttyname);
+ do_pam_setcred();
+#endif /* USE_PAM */
+
#ifdef AFS
/* Try to get AFS tokens for the local cell. */
if (k_hasafs()) {