diff options
author | Damien Miller <djm@mindrot.org> | 2000-01-26 11:07:22 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-01-26 11:07:22 +1100 |
commit | fa51a83f544bf84f3721fdc02f1cd568f96aee42 (patch) | |
tree | 86144d213f8a2dcc087394ceb6b637fab67b0796 | |
parent | d89c24b57edf335a69ba20421e2fe52b5f817d19 (diff) |
- Reorder PAM initialisation so it does not mess up lastlog. Reported
by Andre Lucas <andre.lucas@dial.pipex.com>
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | sshd.c | 21 |
2 files changed, 11 insertions, 12 deletions
@@ -1,6 +1,8 @@ | |||
1 | 20000125 | 1 | 20000125 |
2 | - Fix NULL pointer dereference in login.c. Fix from Andre Lucas | 2 | - Fix NULL pointer dereference in login.c. Fix from Andre Lucas |
3 | <andre.lucas@dial.pipex.com> | 3 | <andre.lucas@dial.pipex.com> |
4 | - Reorder PAM initialisation so it does not mess up lastlog. Reported | ||
5 | by Andre Lucas <andre.lucas@dial.pipex.com> | ||
4 | 6 | ||
5 | 20000124 | 7 | 20000124 |
6 | - Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number | 8 | - Pick up version 1.2.2 from OpenBSD CVS (no changes, just version number |
@@ -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(); |