summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2001-03-25 13:16:12 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2001-03-25 13:16:12 +0000
commit2489267ca550718467dd157ab067b7d2b5c035d4 (patch)
tree84badf216de5d4bed058f4611683f8ac9adc96bf /usr.bin
parente062b2ded8bea4b44e6b5782a79fabbebb2eb929 (diff)
PrintLastLog option; from chip@valinux.com with some minor
changes by me. ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/servconf.c13
-rw-r--r--usr.bin/ssh/servconf.h3
-rw-r--r--usr.bin/ssh/session.c12
-rw-r--r--usr.bin/ssh/sshd.88
-rw-r--r--usr.bin/ssh/sshd_config3
5 files changed, 29 insertions, 10 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index 075eed400e8..681878615a9 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/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 @@ 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/usr.bin/ssh/servconf.h b/usr.bin/ssh/servconf.h
index 1009ce217ac..57d4370f1c5 100644
--- a/usr.bin/ssh/servconf.h
+++ b/usr.bin/ssh/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/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 5b01a4d23aa..4d7e24c9c3b 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/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"
@@ -661,9 +661,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,
@@ -679,7 +681,7 @@ do_login(Session *s, const char *command)
if (stat(buf, &st) >= 0)
#endif
return;
- 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/usr.bin/ssh/sshd.8 b/usr.bin/ssh/sshd.8
index f59bf31997d..1592db5919b 100644
--- a/usr.bin/ssh/sshd.8
+++ b/usr.bin/ssh/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/usr.bin/ssh/sshd_config b/usr.bin/ssh/sshd_config
index 60e4e11c33a..24e8f336ba5 100644
--- a/usr.bin/ssh/sshd_config
+++ b/usr.bin/ssh/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 is the sshd server system-wide configuration file. See sshd(8)
# for more information.
@@ -23,6 +23,7 @@ StrictModes yes
X11Forwarding no
X11DisplayOffset 10
PrintMotd yes
+#PrintLastLog no
KeepAlive yes
# Logging