diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | loginrec.c | 10 | ||||
-rw-r--r-- | session.c | 2 | ||||
-rw-r--r-- | sshlogin.c | 4 | ||||
-rw-r--r-- | sshlogin.h | 7 |
5 files changed, 17 insertions, 11 deletions
@@ -4,6 +4,9 @@ | |||
4 | coming). | 4 | coming). |
5 | - (bal) Part two.. Drop unused AIX header, fix up missing char *cp. All | 5 | - (bal) Part two.. Drop unused AIX header, fix up missing char *cp. All |
6 | that is left is handling aix_usrinfo(). | 6 | that is left is handling aix_usrinfo(). |
7 | - (tim) [loginrec.c session.c sshlogin.c sshlogin.h] Bug 84 | ||
8 | patch by wknox@mitre.org (William Knox). | ||
9 | [sshlogin.h] declare record_utmp_only for session.c | ||
7 | 10 | ||
8 | 20020221 | 11 | 20020221 |
9 | - (bal) Minor session.c fixup for cygwin. mispelt 'is_winnt' variable. | 12 | - (bal) Minor session.c fixup for cygwin. mispelt 'is_winnt' variable. |
@@ -7663,4 +7666,4 @@ | |||
7663 | - Wrote replacements for strlcpy and mkdtemp | 7666 | - Wrote replacements for strlcpy and mkdtemp |
7664 | - Released 1.0pre1 | 7667 | - Released 1.0pre1 |
7665 | 7668 | ||
7666 | $Id: ChangeLog,v 1.1872 2002/02/24 20:42:46 mouring Exp $ | 7669 | $Id: ChangeLog,v 1.1873 2002/02/25 01:56:46 tim Exp $ |
diff --git a/loginrec.c b/loginrec.c index d7105ed7b..ea3ec4f2b 100644 --- a/loginrec.c +++ b/loginrec.c | |||
@@ -163,7 +163,7 @@ | |||
163 | #include "log.h" | 163 | #include "log.h" |
164 | #include "atomicio.h" | 164 | #include "atomicio.h" |
165 | 165 | ||
166 | RCSID("$Id: loginrec.c,v 1.38 2001/10/30 02:50:40 tim Exp $"); | 166 | RCSID("$Id: loginrec.c,v 1.39 2002/02/25 01:56:47 tim Exp $"); |
167 | 167 | ||
168 | #ifdef HAVE_UTIL_H | 168 | #ifdef HAVE_UTIL_H |
169 | # include <util.h> | 169 | # include <util.h> |
@@ -701,6 +701,8 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx) | |||
701 | line_stripname(utx->ut_line, li->line, sizeof(utx->ut_line)); | 701 | line_stripname(utx->ut_line, li->line, sizeof(utx->ut_line)); |
702 | set_utmpx_time(li, utx); | 702 | set_utmpx_time(li, utx); |
703 | utx->ut_pid = li->pid; | 703 | utx->ut_pid = li->pid; |
704 | /* strncpy(): Don't necessarily want null termination */ | ||
705 | strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username)); | ||
704 | 706 | ||
705 | if (li->type == LTYPE_LOGOUT) | 707 | if (li->type == LTYPE_LOGOUT) |
706 | return; | 708 | return; |
@@ -710,8 +712,6 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx) | |||
710 | * for logouts. | 712 | * for logouts. |
711 | */ | 713 | */ |
712 | 714 | ||
713 | /* strncpy(): Don't necessarily want null termination */ | ||
714 | strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username)); | ||
715 | # ifdef HAVE_HOST_IN_UTMPX | 715 | # ifdef HAVE_HOST_IN_UTMPX |
716 | strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname)); | 716 | strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname)); |
717 | # endif | 717 | # endif |
@@ -942,9 +942,7 @@ utmpx_perform_logout(struct logininfo *li) | |||
942 | { | 942 | { |
943 | struct utmpx utx; | 943 | struct utmpx utx; |
944 | 944 | ||
945 | memset(&utx, '\0', sizeof(utx)); | 945 | construct_utmpx(li, &utx); |
946 | set_utmpx_time(li, &utx); | ||
947 | line_stripname(utx.ut_line, li->line, sizeof(utx.ut_line)); | ||
948 | # ifdef HAVE_ID_IN_UTMPX | 946 | # ifdef HAVE_ID_IN_UTMPX |
949 | line_abbrevname(utx.ut_id, li->line, sizeof(utx.ut_id)); | 947 | line_abbrevname(utx.ut_id, li->line, sizeof(utx.ut_id)); |
950 | # endif | 948 | # endif |
@@ -1677,7 +1677,7 @@ session_pty_cleanup(void *session) | |||
1677 | 1677 | ||
1678 | /* Record that the user has logged out. */ | 1678 | /* Record that the user has logged out. */ |
1679 | if (s->pid != 0) | 1679 | if (s->pid != 0) |
1680 | record_logout(s->pid, s->tty); | 1680 | record_logout(s->pid, s->tty, s->pw->pw_name); |
1681 | 1681 | ||
1682 | /* Release the pseudo-tty. */ | 1682 | /* Release the pseudo-tty. */ |
1683 | pty_release(s->tty); | 1683 | pty_release(s->tty); |
diff --git a/sshlogin.c b/sshlogin.c index 2fb96bb6c..78c51abd6 100644 --- a/sshlogin.c +++ b/sshlogin.c | |||
@@ -94,11 +94,11 @@ record_utmp_only(pid_t pid, const char *ttyname, const char *user, | |||
94 | /* Records that the user has logged out. */ | 94 | /* Records that the user has logged out. */ |
95 | 95 | ||
96 | void | 96 | void |
97 | record_logout(pid_t pid, const char *ttyname) | 97 | record_logout(pid_t pid, const char *ttyname, const char *user) |
98 | { | 98 | { |
99 | struct logininfo *li; | 99 | struct logininfo *li; |
100 | 100 | ||
101 | li = login_alloc_entry(pid, NULL, NULL, ttyname); | 101 | li = login_alloc_entry(pid, user, NULL, ttyname); |
102 | login_logout(li); | 102 | login_logout(li); |
103 | login_free_entry(li); | 103 | login_free_entry(li); |
104 | } | 104 | } |
diff --git a/sshlogin.h b/sshlogin.h index 79d42a982..bd30278e0 100644 --- a/sshlogin.h +++ b/sshlogin.h | |||
@@ -17,7 +17,12 @@ | |||
17 | void | 17 | void |
18 | record_login(pid_t, const char *, const char *, uid_t, | 18 | record_login(pid_t, const char *, const char *, uid_t, |
19 | const char *, struct sockaddr *); | 19 | const char *, struct sockaddr *); |
20 | void record_logout(pid_t, const char *); | 20 | void record_logout(pid_t, const char *, const char *); |
21 | u_long get_last_login_time(uid_t, const char *, char *, u_int); | 21 | u_long get_last_login_time(uid_t, const char *, char *, u_int); |
22 | 22 | ||
23 | #ifdef LOGIN_NEEDS_UTMPX | ||
24 | void record_utmp_only(pid_t, const char *, const char *, const char *, | ||
25 | struct sockaddr *); | ||
26 | #endif | ||
27 | |||
23 | #endif | 28 | #endif |