motd 0.2.2

motd interrogates pam_motd.so in order to determine the current message of the day. It only works on linux and it is a component of the shpool tool, though you can also use the dump-motd wrapper CLI tool directly. Through feature selection, you can also use a pure rust impl with no dlopen shennigans.
Documentation
//
// You can test that this builds and examine the exported symbols with
//
// ```
// gcc -Wl,--version-script=./motd/src/pam_motd_overlay_versions.map -shared -fPIC ./motd/src/pam_motd_overlay.c -o /tmp/pam_motd_overlay.so
// nm -D /tmp/pam_motd_overlay.so
// ```
//

#include <pwd.h>
#include <security/_pam_types.h>
#include <stdio.h>
#include <sys/types.h>

static struct passwd fake_passwd = {
  .pw_name = "",
  .pw_passwd = "",
  .pw_uid = 0,
  .pw_gid = 0,
  .pw_gecos = "",
  .pw_dir = "",
  .pw_shell = "",
};
struct passwd* pam_modutil_getpwnam(pam_handle_t *pamh, const char *user) {
  (void)pamh;
  (void)user;
  return &fake_passwd;
}