summaryrefslogtreecommitdiffstats
path: root/debian/patches-applied/update-motd
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-applied/update-motd')
-rw-r--r--debian/patches-applied/update-motd108
1 files changed, 108 insertions, 0 deletions
diff --git a/debian/patches-applied/update-motd b/debian/patches-applied/update-motd
new file mode 100644
index 0000000..dececee
--- /dev/null
+++ b/debian/patches-applied/update-motd
@@ -0,0 +1,108 @@
+Provide a more dynamic MOTD, based on the short-lived update-motd project.
+
+Authors: Dustin Kirkland <kirkland@canonical.com>
+
+Last-Update: 2019-02-12
+Forwarded: no
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/399071
+
+Index: pam/modules/pam_motd/pam_motd.c
+===================================================================
+--- pam.orig/modules/pam_motd/pam_motd.c
++++ pam/modules/pam_motd/pam_motd.c
+@@ -101,8 +101,10 @@
+ int argc, const char **argv)
+ {
+ int retval = PAM_IGNORE;
++ int do_update = 1;
+ const char *motd_path = NULL;
+ const char *motd_dir_path = NULL;
++ struct stat st;
+
+ if (flags & PAM_SILENT) {
+ return retval;
+@@ -131,6 +133,9 @@
+ "motd_dir= specification missing argument - ignored");
+ }
+ }
++ else if (!strcmp(*argv,"noupdate")) {
++ do_update = 0;
++ }
+ else
+ pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv);
+ }
+@@ -140,6 +145,19 @@
+ motd_dir_path = default_motd_dir;
+ }
+
++ /* Run the update-motd dynamic motd scripts, outputting to /run/motd.dynamic.
++ This will be displayed only when calling pam_motd with
++ motd=/run/motd.dynamic; current /etc/pam.d/login and /etc/pam.d/sshd
++ display both this file and /etc/motd. */
++ if (do_update && (stat("/etc/update-motd.d", &st) == 0)
++ && S_ISDIR(st.st_mode))
++ {
++ mode_t old_mask = umask(0022);
++ if (!system("/usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin run-parts --lsbsysinit /etc/update-motd.d > /run/motd.dynamic.new"))
++ rename("/run/motd.dynamic.new", "/run/motd.dynamic");
++ umask(old_mask);
++ }
++
+ if (motd_path != NULL) {
+ int fd = open(motd_path, O_RDONLY, 0);
+
+Index: pam/modules/pam_motd/pam_motd.8.xml
+===================================================================
+--- pam.orig/modules/pam_motd/pam_motd.8.xml
++++ pam/modules/pam_motd/pam_motd.8.xml
+@@ -63,6 +63,17 @@
+ </para>
+ </listitem>
+ </varlistentry>
++ <varlistentry>
++ <term>
++ <option>noupdate</option>
++ </term>
++ <listitem>
++ <para>
++ Don't run the scripts in <filename>/etc/update-motd.d</filename>
++ to refresh the motd file.
++ </para>
++ </listitem>
++ </varlistentry>
+ </variablelist>
+ <para>
+ When no options are given, the default is to display both
+Index: pam/modules/pam_motd/pam_motd.8
+===================================================================
+--- pam.orig/modules/pam_motd/pam_motd.8
++++ pam/modules/pam_motd/pam_motd.8
+@@ -53,6 +53,13 @@
+ directory is scanned and each file contained inside of it is displayed\&.
+ .RE
+ .PP
++\fBnoupdate\fR
++.RS 4
++Don\*(Aqt run the scripts in
++/etc/update\-motd\&.d
++to refresh the motd file\&.
++.RE
++.PP
+ When no options are given, the default is to display both
+ /etc/motd
+ and the contents of
+Index: pam/modules/pam_motd/README
+===================================================================
+--- pam.orig/modules/pam_motd/README
++++ pam/modules/pam_motd/README
+@@ -19,6 +19,10 @@
+ The /path/dirname.d directory is scanned and each file contained inside of
+ it is displayed.
+
++noupdate
++
++ Don't run the scripts in /etc/update-motd.d to refresh the motd file.
++
+ When no options are given, the default is to display both /etc/motd and the
+ contents of /etc/motd.d. Specifying either option (or both) will disable this
+ default behavior.