- Fix lastlog support, patch from Andre Lucas <andre.lucas@dial.pipex.com>

This commit is contained in:
Damien Miller 2000-01-23 20:18:35 +11:00
parent 641a63f7a3
commit def0dc9bcc
2 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@
getsockname() requires initialized tolen; andy@guildsoftware.com
- AIX patch from Matt Richards <v2matt@btv.ibm.com> and David Rankin
<drankin@bohemians.lexington.ky.us>
- Fix lastlog support, patch from Andre Lucas <andre.lucas@dial.pipex.com>
20000122
- Fix compilation of bsd-snprintf.c on Solaris, fix from Ben Taylor

10
login.c
View File

@ -18,7 +18,7 @@
*/
#include "includes.h"
RCSID("$Id: login.c,v 1.18 2000/01/14 04:45:50 damien Exp $");
RCSID("$Id: login.c,v 1.19 2000/01/23 09:18:36 damien Exp $");
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
# include <utmpx.h>
@ -58,20 +58,20 @@ get_last_login_time(uid_t uid, const char *logname,
char *lastlog;
int fd;
#ifdef LASTLOG_IS_DIR
char buf[1024];
char lbuf[1024];
#endif /* LASTLOG_IS_DIR */
lastlog = _PATH_LASTLOG;
buf[0] = '\0';
#ifdef LASTLOG_IS_DIR
#ifndef LASTLOG_IS_DIR
fd = open(lastlog, O_RDONLY);
if (fd < 0)
return 0;
lseek(fd, (off_t) ((long) uid * sizeof(ll)), SEEK_SET);
#else /* LASTLOG_IS_DIR */
snprintf(buf, sizeof(buf), "%s/%s", lastlog, logname);
fd = open(buf, O_RDONLY);
snprintf(lbuf, sizeof(buf), "%s/%s", lastlog, logname);
fd = open(lbuf, O_RDONLY);
if (fd < 0)
return 0;
#endif /* LASTLOG_IS_DIR */