1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
$NetBSD: patch-af,v 1.4 2003/08/12 19:08:58 seb Exp $
--- lib/sshsession/wtmp.c.orig 2003-06-30 12:22:13.000000000 +0000
+++ lib/sshsession/wtmp.c
@@ -34,6 +34,13 @@ In particular, this updates:
# include <sys/mkdev.h> /* for minor() */
# endif /* HAVE_SYS_MKDEV_H */
# endif /* !SCO */
+# if !defined(WTMPX_FILE)
+# if defined(_WTMPX_FILE) /* Solaris without _XPG4_2 or with __EXTENSIONS__ */
+# define WTMPX_FILE _WTMPX_FILE
+# elif defined(_PATH_WTMPX) /* NetBSD at least */
+# define WTMPX_FILE _PATH_WTMPX
+# endif
+# endif
#endif /* HAVE_UTMPX_H */
#ifdef HAVE_USERSEC_H
# include <usersec.h>
@@ -62,9 +69,15 @@ void login(const struct utmp *);
#ifndef HAVE_PROTO_LOGOUT
int logout(const char *);
#endif /* !HAVE_PROTO_LOGOUT */
+#ifndef HAVE_PROTO_LOGOUTX
+int logoutx(const char *, int, int);
+#endif /* !HAVE_PROTO_LOGOUTX */
#ifndef HAVE_PROTO_LOGWTMP
void logwtmp(const char *, const char *, const char *);
#endif /* !HAVE_PROTO_LOGWTMP */
+#ifndef HAVE_PROTO_LOGWTMPX
+void logwtmpx(const char *, const char *, const char *, int, int);
+#endif /* !HAVE_PROTO_LOGWTMPX */
/* Returns the time when the user last logged in, and name of the host
from which the user logged in from. Returns 0 if the information
@@ -217,7 +230,7 @@ void ssh_user_record_login(SshUser user,
# endif /* LASTLOG_IS_DIR */
#endif /* HAVE_LASTLOG_H || HAVE_LASTLOG */
-#if defined(HAVE_UTMP_H) && !defined(HAVE_UTMPX_H)
+#if defined(HAVE_UTMP_H) && (!defined(HAVE_UTMPX_H) || defined(SSH_UTMP_UTMPX))
struct utmp u;
const char *utmp, *wtmp;
@@ -587,6 +600,10 @@ void ssh_user_record_logout(pid_t pid, c
const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */
if (logout((char *)line))
logwtmp((char *)line, "", "");
+# ifdef HAVE_LIBUTIL_LOGINX
+ if (logoutx((char *)line, 0, DEAD_PROCESS))
+ logwtmpx((char *)line, "", "", 0, DEAD_PROCESS);
+# endif
#else /* HAVE_LIBUTIL_LOGIN */
ssh_user_record_login(NULL, pid, ttyname, "", "");
#endif /* HAVE_LIBUTIL_LOGIN */
|