]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lastlog: stop building by default
authorIker Pedrosa <ipedrosa@redhat.com>
Thu, 13 Jul 2023 10:54:04 +0000 (12:54 +0200)
committerSerge Hallyn <serge@hallyn.com>
Sat, 15 Jul 2023 12:39:53 +0000 (07:39 -0500)
Created a new configuration option `--enable-lastlog` to conditionally
build the lastlog binary. By default the option is disabled.

Resolves: https://github.com/shadow-maint/shadow/issues/674

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
configure.ac
src/Makefile.am

index 4b40be7263a58ee303c86dca57ab06ed5cd9e698..5bd837e9934128b582ec7f9a40fb092a60c50177 100644 (file)
@@ -68,23 +68,6 @@ AC_CHECK_MEMBERS([struct utmp.ut_type,
                   struct utmp.ut_xtime,
                   struct utmp.ut_tv],,,[[#include <utmp.h>]])
 
-if test "$ac_cv_header_lastlog_h" = "yes"; then
-       AC_CACHE_CHECK(for ll_host in struct lastlog,
-               ac_cv_struct_lastlog_ll_host,
-               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
-                                       [struct lastlog ll; char *cp = ll.ll_host;]
-                               )],
-                       [ac_cv_struct_lastlog_ll_host=yes],
-                       [ac_cv_struct_lastlog_ll_host=no]
-               )
-       )
-
-       if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
-               AC_DEFINE(HAVE_LL_HOST, 1,
-                       [Define if struct lastlog has ll_host])
-       fi
-fi
-
 dnl Checks for library functions.
 AC_TYPE_GETGROUPS
 AC_FUNC_UTIME_NULL
@@ -222,6 +205,13 @@ AC_ARG_ENABLE(subordinate-ids,
        [enable_subids="maybe"]
 )
 
+AC_ARG_ENABLE(lastlog,
+       [AS_HELP_STRING([--enable-lastlog],
+               [enable lastlog @<:@default=no@:>@])],
+       [enable_lastlog="${enableval}"],
+       [enable_lastlog="no"]
+)
+
 AC_ARG_WITH(audit,
        [AS_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
        [with_audit=$withval], [with_audit=maybe])
@@ -374,6 +364,28 @@ if test "$enable_subids" != "no"; then
 fi
 AM_CONDITIONAL(ENABLE_SUBIDS, test "x$enable_subids" != "xno")
 
+if test "x$enable_lastlog" = "yes" && test "$ac_cv_header_lastlog_h" = "yes"; then
+       AC_CACHE_CHECK(for ll_host in struct lastlog,
+               ac_cv_struct_lastlog_ll_host,
+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
+                                       [struct lastlog ll; char *cp = ll.ll_host;]
+                               )],
+                       [ac_cv_struct_lastlog_ll_host=yes],
+                       [ac_cv_struct_lastlog_ll_host=no]
+               )
+       )
+
+       if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
+               AC_DEFINE(HAVE_LL_HOST, 1,
+                       [Define if struct lastlog has ll_host])
+               enable_lastlog="yes"
+       else
+               AC_MSG_ERROR([Cannot enable support for lastlog on systems where the data structures aren't available])
+               enable_subids="no"
+       fi
+fi
+AM_CONDITIONAL(ENABLE_LASTLOG, test "x$enable_lastlog" != "xno")
+
 AC_SUBST(LIBCRYPT)
 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
        [AC_MSG_ERROR([crypt() not found])])
@@ -746,6 +758,7 @@ echo "      yescrypt passwords encryption:  $with_yescrypt"
 echo " nscd support:                   $with_nscd"
 echo " sssd support:                   $with_sssd"
 echo " subordinate IDs support:        $enable_subids"
+echo " enable lastlog:                 $enable_lastlog"
 echo " use file caps:                  $with_fcaps"
 echo " install su:                     $with_su"
 echo " enabled vendor dir:             $enable_vendordir"
index 48c9065b6d1311f5c8ec8c0d16ef905f80621199..b0c356d03040d325162addba775dd74239609979 100644 (file)
@@ -29,10 +29,13 @@ AM_CFLAGS = $(LIBBSD_CFLAGS)
 
 bin_PROGRAMS   = groups login
 sbin_PROGRAMS  = nologin
-ubin_PROGRAMS  = faillog lastlog chage chfn chsh expiry gpasswd newgrp passwd
+ubin_PROGRAMS  = faillog chage chfn chsh expiry gpasswd newgrp passwd
 if ENABLE_SUBIDS
 ubin_PROGRAMS += newgidmap newuidmap
 endif
+if ENABLE_LASTLOG
+ubin_PROGRAMS += lastlog
+endif
 if WITH_SU
 bin_PROGRAMS  += su
 endif