From c81280b16e1831ab0bdd0383486c7e2d1eaf1b5e Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Wed, 4 Dec 2019 18:12:49 +0100 Subject: pam_motd: Export MOTD_SHOWN=pam after showing MOTD This is a useful indication for update-motd profile.d snippet which can also try to show MOTD when it is not already shown. The use-case for that is showing MOTD in shells in containers without PAM being involved. * modules/pam_motd/pam_motd.c: Export MOTD_SHOWN=pam after showing MOTD * modules/pam_motd/pam_motd.8.xml: Mention setting MOTD_SHOWN=pam in the man page --- modules/pam_motd/pam_motd.8.xml | 5 +++++ modules/pam_motd/pam_motd.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/modules/pam_motd/pam_motd.8.xml b/modules/pam_motd/pam_motd.8.xml index 4e2110c1..d939ad7e 100644 --- a/modules/pam_motd/pam_motd.8.xml +++ b/modules/pam_motd/pam_motd.8.xml @@ -77,6 +77,11 @@ ln -s /dev/null /etc/motd.d/my_motd + + The MOTD_SHOWN=pam environment variable + is set after showing the motd files, even when all of them were silenced + using symbolic links. + diff --git a/modules/pam_motd/pam_motd.c b/modules/pam_motd/pam_motd.c index dbd718b6..51b0168b 100644 --- a/modules/pam_motd/pam_motd.c +++ b/modules/pam_motd/pam_motd.c @@ -396,6 +396,8 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags, _pam_drop(motd_dir_path_copy); _pam_drop(motd_dir_path_split); + retval = pam_putenv(pamh, "MOTD_SHOWN=pam"); + return retval; } -- cgit v1.2.3