summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-01-26 11:07:22 +1100
committerDamien Miller <djm@mindrot.org>2000-01-26 11:07:22 +1100
commitfa51a83f544bf84f3721fdc02f1cd568f96aee42 (patch)
tree86144d213f8a2dcc087394ceb6b637fab67b0796 /sshd.c
parentd89c24b57edf335a69ba20421e2fe52b5f817d19 (diff)
- Reorder PAM initialisation so it does not mess up lastlog. Reported
by Andre Lucas <andre.lucas@dial.pipex.com>
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sshd.c b/sshd.c
index a5cbbfc43..f12279786 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1740,12 +1740,6 @@ do_authenticated(struct passwd * pw)
1740 1740
1741 /* Indicate that we now have a pty. */ 1741 /* Indicate that we now have a pty. */
1742 have_pty = 1; 1742 have_pty = 1;
1743
1744#ifdef USE_PAM
1745 /* do the pam_open_session since we have the pty */
1746 do_pam_session(pw->pw_name, ttyname);
1747#endif /* USE_PAM */
1748
1749 break; 1743 break;
1750 1744
1751 case SSH_CMSG_X11_REQUEST_FORWARDING: 1745 case SSH_CMSG_X11_REQUEST_FORWARDING:
@@ -1821,9 +1815,6 @@ do_authenticated(struct passwd * pw)
1821 packet_set_interactive(have_pty || display != NULL, 1815 packet_set_interactive(have_pty || display != NULL,
1822 options.keepalives); 1816 options.keepalives);
1823 1817
1824#ifdef USE_PAM
1825 do_pam_setcred();
1826#endif /* USE_PAM */
1827 if (forced_command != NULL) 1818 if (forced_command != NULL)
1828 goto do_forced_command; 1819 goto do_forced_command;
1829 debug("Forking shell."); 1820 debug("Forking shell.");
@@ -1839,9 +1830,6 @@ do_authenticated(struct passwd * pw)
1839 packet_set_interactive(have_pty || display != NULL, 1830 packet_set_interactive(have_pty || display != NULL,
1840 options.keepalives); 1831 options.keepalives);
1841 1832
1842#ifdef USE_PAM
1843 do_pam_setcred();
1844#endif /* USE_PAM */
1845 if (forced_command != NULL) 1833 if (forced_command != NULL)
1846 goto do_forced_command; 1834 goto do_forced_command;
1847 /* Get command from the packet. */ 1835 /* Get command from the packet. */
@@ -1929,6 +1917,10 @@ do_exec_no_pty(const char *command, struct passwd * pw,
1929 1917
1930 setproctitle("%s@notty", pw->pw_name); 1918 setproctitle("%s@notty", pw->pw_name);
1931 1919
1920#ifdef USE_PAM
1921 do_pam_setcred();
1922#endif /* USE_PAM */
1923
1932 /* Fork the child. */ 1924 /* Fork the child. */
1933 if ((pid = fork()) == 0) { 1925 if ((pid = fork()) == 0) {
1934 /* Child. Reinitialize the log since the pid has changed. */ 1926 /* Child. Reinitialize the log since the pid has changed. */
@@ -2067,6 +2059,11 @@ do_exec_pty(const char *command, int ptyfd, int ttyfd,
2067 } 2059 }
2068 setproctitle("%s@%s", pw->pw_name, strrchr(ttyname, '/') + 1); 2060 setproctitle("%s@%s", pw->pw_name, strrchr(ttyname, '/') + 1);
2069 2061
2062#ifdef USE_PAM
2063 do_pam_session(pw->pw_name, ttyname);
2064 do_pam_setcred();
2065#endif /* USE_PAM */
2066
2070 /* Fork the child. */ 2067 /* Fork the child. */
2071 if ((pid = fork()) == 0) { 2068 if ((pid = fork()) == 0) {
2072 pid = getpid(); 2069 pid = getpid();