From: Alejandro Colomar Date: Sun, 31 Aug 2025 11:53:54 +0000 (+0200) Subject: configure.ac, lib/, src/: Use _PATH_LASTLOG from X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72a2b8a10d50d917c7905eba9c7f17382f7b7cc6;p=thirdparty%2Fshadow.git configure.ac, lib/, src/: Use _PATH_LASTLOG from That's the libc macro for this file. Signed-off-by: Alejandro Colomar --- diff --git a/configure.ac b/configure.ac index 4821c1e81..b52402961 100644 --- a/configure.ac +++ b/configure.ac @@ -100,8 +100,6 @@ AC_CACHE_CHECK([location of faillog/lastlog/wtmp], [shadow_cv_logdir], done]) AC_DEFINE_UNQUOTED([_WTMP_FILE], ["$shadow_cv_logdir/wtmp"], [Path for wtmp file.]) -AC_DEFINE_UNQUOTED([LASTLOG_FILE], ["$shadow_cv_logdir/lastlog"], - [Path for lastlog file.]) AC_DEFINE_UNQUOTED([FAILLOG_FILE], ["$shadow_cv_logdir/faillog"], [Path for faillog file.]) diff --git a/lib/log.c b/lib/log.c index 44415c73f..fb09615ea 100644 --- a/lib/log.c +++ b/lib/log.c @@ -9,14 +9,14 @@ #include "config.h" -#ident "$Id$" - -#include +#include +#include #include #include +#include #include + #include "defines.h" -#include #include "prototypes.h" #include "string/memset/memzero.h" #include "string/strcpy/strncpy.h" @@ -45,7 +45,7 @@ void dolastlog ( * If the file does not exist, don't create it. */ - fd = open (LASTLOG_FILE, O_RDWR); + fd = open(_PATH_LASTLOG, O_RDWR); if (-1 == fd) { return; } @@ -60,7 +60,7 @@ void dolastlog ( if (lseek (fd, offset, SEEK_SET) != offset) { SYSLOG ((LOG_WARN, "Can't read last lastlog entry for UID %lu in %s. Entry not updated.", - (unsigned long) pw->pw_uid, LASTLOG_FILE)); + (unsigned long) pw->pw_uid, _PATH_LASTLOG)); (void) close (fd); return; } @@ -105,5 +105,5 @@ err_write: err_close: SYSLOG ((LOG_WARN, "Can't write lastlog entry for UID %lu in %s: %m", - (unsigned long) pw->pw_uid, LASTLOG_FILE)); + (unsigned long) pw->pw_uid, _PATH_LASTLOG)); } diff --git a/src/lastlog.c b/src/lastlog.c index 7413f6a43..0f8793c52 100644 --- a/src/lastlog.c +++ b/src/lastlog.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -35,14 +36,6 @@ #include "string/strftime.h" - -/* - * Needed for MkLinux DR1/2/2.1 - J. - */ -#ifndef LASTLOG_FILE -#define LASTLOG_FILE "/var/log/lastlog" -#endif - /* * Global variables */ @@ -433,9 +426,9 @@ int main (int argc, char **argv) } } - lastlogfile = fopen (LASTLOG_FILE, (Cflg || Sflg)?"r+":"r"); + lastlogfile = fopen(_PATH_LASTLOG, (Cflg || Sflg)?"r+":"r"); if (NULL == lastlogfile) { - perror (LASTLOG_FILE); + perror(_PATH_LASTLOG); exit (EXIT_FAILURE); } @@ -443,7 +436,7 @@ int main (int argc, char **argv) if (fstat (fileno (lastlogfile), &statbuf) != 0) { fprintf (stderr, _("%s: Cannot get the size of %s: %s\n"), - Prog, LASTLOG_FILE, strerror (errno)); + Prog, _PATH_LASTLOG, strerror(errno)); exit (EXIT_FAILURE); } diff --git a/src/login.c b/src/login.c index ce2076dec..ff6b98e07 100644 --- a/src/login.c +++ b/src/login.c @@ -63,14 +63,6 @@ static pam_handle_t *pamh = NULL; #endif /* USE_PAM */ -#ifndef USE_PAM -/* - * Needed for MkLinux DR1/2/2.1 - J. - */ -#ifndef LASTLOG_FILE -#define LASTLOG_FILE "/var/log/lastlog" -#endif -#endif /* !USE_PAM */ /* * Global variables diff --git a/src/useradd.c b/src/useradd.c index 2b3b42b68..5b6a9d273 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -28,6 +28,7 @@ #include "pam_defs.h" #endif /* USE_PAM */ #endif /* ACCT_TOOLS_SETUID */ +#include #include #include #include @@ -86,12 +87,8 @@ #define USER_DEFAULTS_FILE "/etc/default/useradd" #define NEW_USER_FILE "/etc/default/nuaddXXXXXX" #endif -/* - * Needed for MkLinux DR1/2/2.1 - J. - */ -#ifndef LASTLOG_FILE -#define LASTLOG_FILE "/var/log/lastlog" -#endif + + /* * Global variables */ @@ -1984,7 +1981,7 @@ static void lastlog_reset (uid_t uid) uid_t max_uid; struct stat st; - if (stat (LASTLOG_FILE, &st) != 0 || st.st_size <= offset_uid) { + if (stat(_PATH_LASTLOG, &st) != 0 || st.st_size <= offset_uid) { return; } @@ -1996,7 +1993,7 @@ static void lastlog_reset (uid_t uid) memzero (&ll, sizeof (ll)); - fd = open (LASTLOG_FILE, O_RDWR); + fd = open(_PATH_LASTLOG, O_RDWR); if (-1 == fd) { fprintf (stderr, _("%s: failed to open the lastlog file for UID %lu: %s\n"), diff --git a/src/usermod.c b/src/usermod.c index ceb0ad60e..8295165a5 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -26,6 +26,7 @@ #include "pam_defs.h" #endif /* USE_PAM */ #endif /* ACCT_TOOLS_SETUID */ +#include #include #include #include @@ -1927,7 +1928,7 @@ static void update_lastlog (void) off_t off_newuid = (off_t) user_newid * sizeof ll; uid_t max_uid; - if (access (LASTLOG_FILE, F_OK) != 0) { + if (access(_PATH_LASTLOG, F_OK) != 0) { return; } @@ -1937,7 +1938,7 @@ static void update_lastlog (void) return; } - fd = open (LASTLOG_FILE, O_RDWR); + fd = open(_PATH_LASTLOG, O_RDWR); if (-1 == fd) { fprintf (stderr,