[servconf.c servconf.h session.c sshd.8 sshd_config]
     PrintLastLog option; from chip@valinux.com with some minor
     changes by me.  ok markus@
This commit is contained in:
Ben Lindstrom 2001-03-26 05:45:53 +00:00
parent 6029432ec5
commit 7bfff36ca3
6 changed files with 34 additions and 11 deletions

View File

@ -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 $

View File

@ -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;

View File

@ -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

View File

@ -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;

8
sshd.8
View File

@ -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

View File

@ -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