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