In xdm (and kdm) move code calling pam_close_session to top of function it is in. Make sure it is called with root privs. pam_console takes a "debug" argument that you can use to make sure that it works correctly. Should depend on pam >= 0.66-19
*** This bug has been marked as a duplicate of 3743 ***