hardening: pam: moved some functions out, made it more robust re required/requisite