- stevesk@cvs.openbsd.org 2001/03/25 13:16:11
[servconf.c servconf.h session.c sshd.8 sshd_config]
PrintLastLog option; from chip@valinux.com with some minor
changes by me. ok markus@
diff --git a/ChangeLog b/ChangeLog
index b5f37e4..10c3704 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
- djm@cvs.openbsd.org 2001/03/25 00:01:34
[session.c]
shorten; ok markus@
+ - stevesk@cvs.openbsd.org 2001/03/25 13:16:11
+ [servconf.c servconf.h session.c sshd.8 sshd_config]
+ PrintLastLog option; from chip@valinux.com with some minor
+ changes by me. ok markus@
20010324
- Fixed permissions ssh-keyscan. Thanks to Christopher Linn <celinn@mtu.edu>.
@@ -4714,4 +4718,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1018 2001/03/26 05:38:25 mouring Exp $
+$Id: ChangeLog,v 1.1019 2001/03/26 05:45:53 mouring Exp $
diff --git a/servconf.c b/servconf.c
index 075eed4..6818786 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: servconf.c,v 1.71 2001/03/05 15:44:51 stevesk Exp $");
+RCSID("$OpenBSD: servconf.c,v 1.72 2001/03/25 13:16:10 stevesk Exp $");
#ifdef KRB4
#include <krb.h>
@@ -55,6 +55,7 @@
options->ignore_rhosts = -1;
options->ignore_user_known_hosts = -1;
options->print_motd = -1;
+ options->print_lastlog = -1;
options->check_mail = -1;
options->x11_forwarding = -1;
options->x11_display_offset = -1;
@@ -132,6 +133,8 @@
options->check_mail = 0;
if (options->print_motd == -1)
options->print_motd = 1;
+ if (options->print_lastlog == -1)
+ options->print_lastlog = 1;
if (options->x11_forwarding == -1)
options->x11_forwarding = 0;
if (options->x11_display_offset == -1)
@@ -208,7 +211,8 @@
#endif
sChallengeResponseAuthentication,
sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress,
- sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
+ sPrintMotd, sPrintLastLog, sIgnoreRhosts,
+ sX11Forwarding, sX11DisplayOffset,
sStrictModes, sEmptyPasswd, sKeepAlives, sCheckMail,
sUseLogin, sAllowTcpForwarding,
sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
@@ -253,6 +257,7 @@
{ "checkmail", sCheckMail },
{ "listenaddress", sListenAddress },
{ "printmotd", sPrintMotd },
+ { "printlastlog", sPrintLastLog },
{ "ignorerhosts", sIgnoreRhosts },
{ "ignoreuserknownhosts", sIgnoreUserKnownHosts },
{ "x11forwarding", sX11Forwarding },
@@ -551,6 +556,10 @@
intptr = &options->print_motd;
goto parse_flag;
+ case sPrintLastLog:
+ intptr = &options->print_lastlog;
+ goto parse_flag;
+
case sX11Forwarding:
intptr = &options->x11_forwarding;
goto parse_flag;
diff --git a/servconf.h b/servconf.h
index 1009ce2..57d4370 100644
--- a/servconf.h
+++ b/servconf.h
@@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell".
*/
-/* RCSID("$OpenBSD: servconf.h,v 1.38 2001/02/12 16:16:23 markus Exp $"); */
+/* RCSID("$OpenBSD: servconf.h,v 1.39 2001/03/25 13:16:10 stevesk Exp $"); */
#ifndef SERVCONF_H
#define SERVCONF_H
@@ -51,6 +51,7 @@
int ignore_user_known_hosts; /* Ignore ~/.ssh/known_hosts
* for RhostsRsaAuth */
int print_motd; /* If true, print /etc/motd. */
+ int print_lastlog; /* If true, print lastlog */
int check_mail; /* If true, check for new mail. */
int x11_forwarding; /* If true, permit inet (spoofing) X11 fwd. */
int x11_display_offset; /* What DISPLAY number to start
diff --git a/session.c b/session.c
index 70d3e32..dfe1498 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.68 2001/03/25 00:01:34 djm Exp $");
+RCSID("$OpenBSD: session.c,v 1.69 2001/03/25 13:16:11 stevesk Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -718,9 +718,11 @@
}
/* Get the time and hostname when the user last logged in. */
- hostname[0] = '\0';
- last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name,
- hostname, sizeof(hostname));
+ if (options.print_lastlog) {
+ hostname[0] = '\0';
+ last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name,
+ hostname, sizeof(hostname));
+ }
/* Record that there was a login on that tty from the remote host. */
record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
@@ -757,7 +759,7 @@
printf("%s\n", aixloginmsg);
#endif /* WITH_AIXAUTHENTICATE */
- if (last_login_time != 0) {
+ if (options.print_lastlog && last_login_time != 0) {
time_string = ctime(&last_login_time);
if (strchr(time_string, '\n'))
*strchr(time_string, '\n') = 0;
diff --git a/sshd.8 b/sshd.8
index f59bf31..1592db5 100644
--- a/sshd.8
+++ b/sshd.8
@@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: sshd.8,v 1.107 2001/03/19 12:10:17 djm Exp $
+.\" $OpenBSD: sshd.8,v 1.108 2001/03/25 13:16:11 stevesk Exp $
.Dd September 25, 1999
.Dt SSHD 8
.Os
@@ -593,6 +593,12 @@
listens on.
The default is 22.
Multiple options of this type are permitted.
+.It Cm PrintLastLog
+Specifies whether
+.Nm
+should print the date and time when the user last logged in.
+The default is
+.Dq yes .
.It Cm PrintMotd
Specifies whether
.Nm
diff --git a/sshd_config b/sshd_config
index c122558..3ef9b92 100644
--- a/sshd_config
+++ b/sshd_config
@@ -1,4 +1,4 @@
-# $OpenBSD: sshd_config,v 1.34 2001/02/24 10:37:26 deraadt Exp $
+# $OpenBSD: sshd_config,v 1.35 2001/03/25 13:16:11 stevesk Exp $
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
@@ -25,6 +25,7 @@
X11Forwarding no
X11DisplayOffset 10
PrintMotd yes
+#PrintLastLog no
KeepAlive yes
# Logging