(according to the comments) the code started out based on the pam_motd module (included with that package).