From 4f4648f9dec5d54cf4598c1a6c2bb40ec1461615 Mon Sep 17 00:00:00 2001 From: mouring Date: Mon, 26 Mar 2001 05:45:53 +0000 Subject: [PATCH] - 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@ --- ChangeLog | 4 ++++ servconf.c | 13 +++++++++++-- servconf.h | 3 ++- session.c | 12 +++++++----- sshd.8 | 8 +++++++- sshd_config | 3 ++- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6063ec9..e5987eb8 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 . diff --git a/servconf.c b/servconf.c index 075eed40..68187861 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 @@ -55,6 +55,7 @@ initialize_server_options(ServerOptions *options) 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 @@ fill_default_server_options(ServerOptions *options) 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 @@ typedef enum { #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 @@ static struct { { "checkmail", sCheckMail }, { "listenaddress", sListenAddress }, { "printmotd", sPrintMotd }, + { "printlastlog", sPrintLastLog }, { "ignorerhosts", sIgnoreRhosts }, { "ignoreuserknownhosts", sIgnoreUserKnownHosts }, { "x11forwarding", sX11Forwarding }, @@ -551,6 +556,10 @@ parse_flag: 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 1009ce21..57d4370f 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 @@ typedef struct { 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 70d3e327..dfe1498a 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 @@ do_login(Session *s, const char *command) } /* 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 @@ do_login(Session *s, const char *command) 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 f59bf319..1592db59 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 @@ Specifies the port number that 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 c122558b..3ef9b929 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 @@ StrictModes yes X11Forwarding no X11DisplayOffset 10 PrintMotd yes +#PrintLastLog no KeepAlive yes # Logging -- 2.45.2