From e8b6e4ea9ccfb2ce29ba85704c0f1ee7a8085826 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 2 Feb 2024 18:46:40 +0100 Subject: [PATCH] added build option login-lastlogin --- configure.ac | 10 ++++++++++ login-utils/login.c | 4 ++++ meson.build | 4 ++++ meson_options.txt | 3 +++ 4 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index b6434fd0fc..7a0c4f2917 100644 --- a/configure.ac +++ b/configure.ac @@ -2403,6 +2403,16 @@ AS_IF([test "x$enable_login_stat_mail" = xyes], [ AC_DEFINE([LOGIN_STAT_MAIL], [1], [Should login stat() the mailbox?]) ]) +AC_ARG_ENABLE([login-lastlog], + AS_HELP_STRING([--enable-login-lastlog], [program login writes lastlog entries]), + [], [enable_login_lastlogin=no] +) + +AS_IF([test "x$enable_login_lastlogin" != xno], [ + AC_DEFINE([USE_LOGIN_LASTLOG], + [1], + [Define if program login writes lastlog entries]) +]) AC_ARG_ENABLE([nologin], AS_HELP_STRING([--disable-nologin], [do not build nologin]), diff --git a/login-utils/login.c b/login-utils/login.c index c8544f6a17..c3fb1b258f 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -662,6 +662,7 @@ static void log_audit(struct login_context *cxt, int status) # define log_audit(cxt, status) #endif /* HAVE_LIBAUDIT */ +#ifdef USE_LOGIN_LASTLOG static void log_lastlog(struct login_context *cxt) { struct sigaction sa, oldsa_xfsz; @@ -728,6 +729,9 @@ done: sigaction(SIGXFSZ, &oldsa_xfsz, NULL); /* restore original setting */ } +#else +# define log_lastlog(cxt) +#endif /* USE_LOGIN_LASTLOG */ /* * Update wtmp and utmp logs. diff --git a/meson.build b/meson.build index 05c0c992c0..f3fab22c86 100644 --- a/meson.build +++ b/meson.build @@ -84,6 +84,10 @@ build_liblastlog2 = not get_option('build-liblastlog2').disabled() conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false) summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components') +login_lastlogin = get_option('login-lastlogin') +conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false) +summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components') + have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include ') > 0 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false) conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false) diff --git a/meson_options.txt b/meson_options.txt index b3cdc2dd3e..f6d8adfdda 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -222,3 +222,6 @@ option('pamlibdir', type : 'string', option('lastlog-compat-symlink', type : 'boolean', value : 'false', description : 'create lastlog compat symlink') +option('login-lastlogin', type : 'boolean', + value : 'false', + description : 'program login writes lastlog entries') -- 2.47.3