diff options
author | Damien Miller <djm@mindrot.org> | 1999-11-11 10:40:23 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-11-11 10:40:23 +1100 |
commit | ab18c412e6773b34e4640e4b9277573fd91a66bf (patch) | |
tree | f0ab48cd9e112a4d866785d2a5b64eda39986b4e /login.c | |
parent | b77870fa7341d95024e55a116a3454e9bfe2f21e (diff) |
- Added (untested) Entropy Gathering Daemon (EGD) support
- Merged several minor fixed:
- ssh-agent commandline parsing
- RPM spec file now installs ssh setuid root
- Makefile creates libdir
- Merged beginnings of Solaris compability from Marc G. Fournier
<marc.fournier@acadiau.ca>
Diffstat (limited to 'login.c')
-rw-r--r-- | login.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -18,9 +18,14 @@ on a tty. */ #include "includes.h" -RCSID("$Id: login.c,v 1.1 1999/10/27 03:42:44 damien Exp $"); +RCSID("$Id: login.c,v 1.2 1999/11/10 23:40:23 damien Exp $"); #include <utmp.h> + +#ifdef HAVE_LASTLOG_H +# include <lastlog.h> +#endif + #include "ssh.h" /* Returns the time when the user last logged in. Returns 0 if the @@ -76,7 +81,9 @@ void record_login(int pid, const char *ttyname, const char *user, uid_t uid, strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); u.ut_time = time(NULL); strncpy(u.ut_name, user, sizeof(u.ut_name)); +#ifdef HAVE_HOST_IN_UTMP strncpy(u.ut_host, host, sizeof(u.ut_host)); +#endif /* Figure out the file names. */ utmp = _PATH_UTMP; @@ -108,11 +115,14 @@ void record_login(int pid, const char *ttyname, const char *user, uid_t uid, } } -/* Records that the user has logged out. */ - void record_logout(int pid, const char *ttyname) { +#ifdef HAVE_LIBUTIL_LOGIN const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */ if (logout(line)) logwtmp(line, "", ""); +#else /* HAVE_LIBUTIL_LOGIN */ + record_login(pid, ttyname, "", -1, "", NULL); +#endif /* HAVE_LIBUTIL_LOGIN */ } + |