From: Iker Pedrosa Date: Thu, 13 Jul 2023 10:54:04 +0000 (+0200) Subject: lastlog: stop building by default X-Git-Tag: 4.14.0-rc1~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1bdcfa8d3710bf0a3f180b590017df096d346ade;p=thirdparty%2Fshadow.git lastlog: stop building by default 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 --- diff --git a/configure.ac b/configure.ac index 4b40be726..5bd837e99 100644 --- a/configure.ac +++ b/configure.ac @@ -68,23 +68,6 @@ AC_CHECK_MEMBERS([struct utmp.ut_type, struct utmp.ut_xtime, struct utmp.ut_tv],,,[[#include ]]) -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 ], - [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 ], + [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" diff --git a/src/Makefile.am b/src/Makefile.am index 48c9065b6..b0c356d03 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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