- Really fix broken default path. Fix from Jim Knoble
<jmknoble@pobox.com>
- Remove test for quad_t. No longer needed.
+ - Released 1.2.1pre24
+
+ - Added support for directory-based lastlogs
+ - Really fix typedefs, patch from Ben Taylor <bent@clark.net>
+ - Prevent multiple inclusion of config.h and defines.h. Suggested
+ by Andre Lucas <andre.lucas@dial.pipex.com>
19991230
- OpenBSD CVS updates:
+#ifndef _DEFINES_H
+#define _DEFINES_H
+
/* Necessary headers */
#include <sys/types.h> /* For u_intXX_t */
# else
# if (SIZEOF_LONG_LONG_INT == 8)
typedef long long int int64_t;
-# define HAVE_INTXX_T
+# define HAVE_INTXX_T 1
# else
# error "64 bit int type not found."
# endif
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
+# define HAVE_U_INTXX_T 1
# else
# if (SIZEOF_SHORT_INT == 2)
typedef unsigned short int u_int16_t;
# else
# if (SIZEOF_LONG_LONG_INT == 8)
typedef unsigned long long int u_int64_t;
-# define HAVE_U_INTXX_T
+# define HAVE_U_INTXX_T 1
# else
# error "64 bit int type not found."
# endif
# define PAM_STRERROR(a,b) pam_strerror((a),(b))
#endif
+#endif /* _DEFINES_H */
struct lastlog ll;
char *lastlog;
int fd;
+#ifdef LASTLOG_IS_DIR
+ char buf[1024];
+#endif /* LASTLOG_IS_DIR */
lastlog = _PATH_LASTLOG;
buf[0] = '\0';
+#ifdef 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);
+ if (fd < 0)
+ return 0;
+#endif /* LASTLOG_IS_DIR */
if (read(fd, &ll, sizeof(ll)) != sizeof(ll)) {
close(fd);
return 0;
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG)
struct lastlog ll;
char *lastlog;
+#ifdef LASTLOG_IS_DIR
+ char buf[1024];
+#endif /* LASTLOG_IS_DIR */
#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
struct utmp u;
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
ll.ll_time = time(NULL);
strncpy(ll.ll_line, ttyname + 5, sizeof(ll.ll_line));
strncpy(ll.ll_host, host, sizeof(ll.ll_host));
+#ifdef LASTLOG_IS_DIR
+ snprintf(buf, sizeof(buf), "%s/%s", lastlog, logname);
+ fd = open(buf, O_RDWR);
+ if (fd >= 0) {
+#else /* LASTLOG_IS_DIR */
fd = open(lastlog, O_RDWR);
if (fd >= 0) {
lseek(fd, (off_t) ((long) uid * sizeof(ll)), SEEK_SET);
+#endif /* LASTLOG_IS_DIR */
if (write(fd, &ll, sizeof(ll)) != sizeof(ll))
log("Could not write %.100s: %.100s", lastlog, strerror(errno));
close(fd);