]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
usermod: conditionally build lastlog functionality
authorIker Pedrosa <ipedrosa@redhat.com>
Thu, 13 Jul 2023 13:25:03 +0000 (15:25 +0200)
committerSerge Hallyn <serge@hallyn.com>
Sat, 15 Jul 2023 12:39:53 +0000 (07:39 -0500)
Resolves: https://github.com/shadow-maint/shadow/issues/674

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
src/usermod.c

index f198f2db1fbe98285f4cbf6739fdfdb9fa0a40bf..bf01881ac912f3993d0a339a4cc0cba3c4f04acb 100644 (file)
@@ -17,7 +17,9 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
+#ifdef ENABLE_LASTLOG
 #include <lastlog.h>
+#endif /* ENABLE_LASTLOG */
 #include <pwd.h>
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM
@@ -182,7 +184,9 @@ static void close_files (void);
 static void open_files (void);
 static void usr_update (void);
 static void move_home (void);
+#ifdef ENABLE_LASTLOG
 static void update_lastlog (void);
+#endif /* ENABLE_LASTLOG */
 static void update_faillog (void);
 
 #ifndef NO_MOVE_MAILBOX
@@ -1905,6 +1909,7 @@ static void move_home (void)
  * left alone in case the UID was shared. It doesn't hurt anything
  * to just leave it be.
  */
+#ifdef ENABLE_LASTLOG
 static void update_lastlog (void)
 {
        struct lastlog ll;
@@ -1963,6 +1968,7 @@ static void update_lastlog (void)
 
        (void) close (fd);
 }
+#endif /* ENABLE_LASTLOG */
 
 /*
  * update_faillog - update the faillog file
@@ -2360,7 +2366,9 @@ int main (int argc, char **argv)
 #endif                         /* NO_MOVE_MAILBOX */
 
        if (uflg) {
+#ifdef ENABLE_LASTLOG
                update_lastlog ();
+#endif /* ENABLE_LASTLOG */
                update_faillog ();
        }