Here's another version of that patch... with a free(dotdir) after we're done with it.
-- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0
Description: avoid NO_MODULE_DATA error Author: Chad Wallace <cwall...@lodgingcompany.com> Last-Update: 2015-12-27 --- a/pam_ssh.c 2015-12-27 12:08:42.851136447 -0800 +++ b/pam_ssh.c 2015-12-27 12:12:47.619240920 -0800 @@ -1089,6 +1089,7 @@ const struct passwd *pwent; /* user's passwd entry */ struct stat sb; /* to check st_nlink */ const char *user; /* username */ + char *dotdir; /* .ssh dir name */ pam_ssh_log(LOG_DEBUG, "close session"); @@ -1108,6 +1109,21 @@ return retval; } + /* handle the per-user configuration directory and check its existence */ + + if (asprintf(&dotdir, "%s/%s", pwent->pw_dir, SSH_DIR) == -1) { + pam_ssh_log(LOG_CRIT, "out of memory"); + openpam_restore_cred(pamh); + return PAM_SERVICE_ERR; + } + if ((access(dotdir,F_OK)) == -1) { + pam_ssh_log(LOG_DEBUG, "inexistent configuration directory"); + free(dotdir); + openpam_restore_cred(pamh); + return PAM_SUCCESS; + } + free(dotdir); + if (pam_get_data(pamh, "ssh_agent_env_session", (const void **)(void *)&env_file) == PAM_SUCCESS && env_file) unlink(env_file);