Refactor PAM support.
PAM clean up.
Merge branch 'pam_refactor'