summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-09-16 13:29:08 +1100
committerDamien Miller <djm@mindrot.org>2000-09-16 13:29:08 +1100
commite4340be5b3ff16f4d9ba5e3ea7e449dc1b6fa7a8 (patch)
treeaba9e2ae234edeb888b922c6a13b755c1248deea /session.c
parentf384c366d33cb435627743f7ea0ed3f966543d40 (diff)
- (djm) Merge OpenBSD changes:
- markus@cvs.openbsd.org 2000/09/05 02:59:57 [session.c] print hostname (not hushlogin) - markus@cvs.openbsd.org 2000/09/05 13:18:48 [authfile.c ssh-add.c] enable ssh-add -d for DSA keys - markus@cvs.openbsd.org 2000/09/05 13:20:49 [sftp-server.c] cleanup - markus@cvs.openbsd.org 2000/09/06 03:46:41 [authfile.h] prototype - deraadt@cvs.openbsd.org 2000/09/07 14:27:56 [ALL] cleanup copyright notices on all files. I have attempted to be accurate with the details. everything is now under Tatu's licence (which I copied from his readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd developers under a 2-term bsd licence. We're not changing any rules, just being accurate. - markus@cvs.openbsd.org 2000/09/07 14:40:30 [channels.c channels.h clientloop.c serverloop.c ssh.c] cleanup window and packet sizes for ssh2 flow control; ok niels - markus@cvs.openbsd.org 2000/09/07 14:53:00 [scp.c] typo - markus@cvs.openbsd.org 2000/09/07 15:13:37 [auth-options.c auth-options.h auth-rh-rsa.c auth-rsa.c auth.c] [authfile.h canohost.c channels.h compat.c hostfile.h log.c match.h] [pty.c readconf.c] some more Copyright fixes - markus@cvs.openbsd.org 2000/09/08 03:02:51 [README.openssh2] bye bye - deraadt@cvs.openbsd.org 2000/09/11 18:38:33 [LICENCE cipher.c] a few more comments about it being ARC4 not RC4 - markus@cvs.openbsd.org 2000/09/12 14:53:11 [log-client.c log-server.c log.c ssh.1 ssh.c ssh.h sshd.8 sshd.c] multiple debug levels - markus@cvs.openbsd.org 2000/09/14 14:25:15 [clientloop.c] typo - deraadt@cvs.openbsd.org 2000/09/15 01:13:51 [ssh-agent.c] check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'session.c')
-rw-r--r--session.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/session.c b/session.c
index a537efdd4..0cc919c6b 100644
--- a/session.c
+++ b/session.c
@@ -1,14 +1,39 @@
1/* 1/*
2 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 2 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
3 * All rights reserved 3 * All rights reserved
4 */ 4 *
5/* 5 * As far as I am concerned, the code I have written for this software
6 * can be used freely for any purpose. Any derived versions of this
7 * software must be clearly marked as such, and if the derived work is
8 * incompatible with the protocol description in the RFC file, it must be
9 * called by a name other than "ssh" or "Secure Shell".
10 *
6 * SSH2 support by Markus Friedl. 11 * SSH2 support by Markus Friedl.
7 * Copyright (c) 2000 Markus Friedl. All rights reserved. 12 * Copyright (c) 2000 Markus Friedl. All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 */ 33 */
9 34
10#include "includes.h" 35#include "includes.h"
11RCSID("$OpenBSD: session.c,v 1.35 2000/09/04 19:07:21 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.37 2000/09/07 20:27:53 deraadt Exp $");
12 37
13#include "xmalloc.h" 38#include "xmalloc.h"
14#include "ssh.h" 39#include "ssh.h"
@@ -684,6 +709,11 @@ do_login(Session *s)
684 last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name, 709 last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name,
685 hostname, sizeof(hostname)); 710 hostname, sizeof(hostname));
686 711
712 /* Get the time and hostname when the user last logged in. */
713 hostname[0] = '\0';
714 last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name,
715 hostname, sizeof(hostname));
716
687 /* Record that there was a login on that tty from the remote host. */ 717 /* Record that there was a login on that tty from the remote host. */
688 record_login(pid, s->tty, pw->pw_name, pw->pw_uid, 718 record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
689 get_remote_name_or_ip(), (struct sockaddr *)&from); 719 get_remote_name_or_ip(), (struct sockaddr *)&from);
@@ -712,7 +742,7 @@ do_login(Session *s)
712 if (strcmp(buf, "") == 0) 742 if (strcmp(buf, "") == 0)
713 printf("Last login: %s\r\n", time_string); 743 printf("Last login: %s\r\n", time_string);
714 else 744 else
715 printf("Last login: %s from %s\r\n", time_string, buf); 745 printf("Last login: %s from %s\r\n", time_string, hostname);
716 } 746 }
717 if (options.print_motd) { 747 if (options.print_motd) {
718#ifdef HAVE_LOGIN_CAP 748#ifdef HAVE_LOGIN_CAP