diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 38 |
1 files changed, 34 insertions, 4 deletions
@@ -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" |
11 | RCSID("$OpenBSD: session.c,v 1.35 2000/09/04 19:07:21 markus Exp $"); | 36 | RCSID("$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 |