summaryrefslogtreecommitdiffstats
path: root/login.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-12-09 10:16:54 +1100
committerDamien Miller <djm@mindrot.org>1999-12-09 10:16:54 +1100
commitbf1c9b2012fadab02392126bece5d21e9ddffda6 (patch)
tree371e5f27669fa28773e2b2bb008a81a03715cf2e /login.c
parentfce1648681a20b99f569d4bfd9335bc4a956b119 (diff)
- Import of patch from Ben Taylor <bent@clark.net>:
- Improved PAM support - "uninstall" rule for Makefile - utmpx support - Should fix PAM problems on Solaris
Diffstat (limited to 'login.c')
-rw-r--r--login.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/login.c b/login.c
index 81bae820..ff418457 100644
--- a/login.c
+++ b/login.c
@@ -18,9 +18,14 @@
*/
#include "includes.h"
-RCSID("$Id: login.c,v 1.5 1999/11/25 02:08:31 damien Exp $");
+RCSID("$Id: login.c,v 1.6 1999/12/08 23:16:55 damien Exp $");
-#include <utmp.h>
+#ifdef HAVE_UTMPX_H
+# include <utmpx.h>
+#endif
+#ifdef HAVE_UTMP_H
+# include <utmp.h>
+#endif
#include "ssh.h"
#ifdef HAVE_UTIL_H
@@ -83,15 +88,20 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
int fd;
struct lastlog ll;
char *lastlog;
- struct utmp u;
+ struct UTMP_STR u;
const char *utmp, *wtmp;
/* Construct an utmp/wtmp entry. */
memset(&u, 0, sizeof(u));
strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
+#ifdef HAVE_UTMPX_H
+ u.ut_tv.tv_sec = time(NULL);
+ strncpy(u.ut_user, user, sizeof(u.ut_name));
+#else
u.ut_time = time(NULL);
strncpy(u.ut_name, user, sizeof(u.ut_name));
-#ifdef HAVE_HOST_IN_UTMP
+#endif
+#if defined(HAVE_HOST_IN_UTMP) || defined(HAVE_HOST_IN_UTMPX)
strncpy(u.ut_host, host, sizeof(u.ut_host));
#endif