Index: xdm-1.1.10/dm.h =================================================================== --- xdm-1.1.10.orig/dm.h +++ xdm-1.1.10/dm.h @@ -434,6 +434,7 @@ extern void DeleteXloginResources (struc extern void LoadXloginResources (struct display *d); extern void ManageSession (struct display *d); extern void SecureDisplay (struct display *d, Display *dpy); +extern void PamCloseSession(void); extern void SessionExit (struct display *d, int status, int removeAuth); extern void SessionPingFailed (struct display *d); extern void SetupDisplay (struct display *d); Index: xdm-1.1.10/session.c =================================================================== --- xdm-1.1.10.orig/session.c +++ xdm-1.1.10/session.c @@ -290,6 +290,8 @@ SessionPingFailed (struct display *d) AbortClient (clientPid); source (verify.systemEnviron, d->reset); } + + PamCloseSession(); SessionExit (d, RESERVER_DISPLAY, TRUE); } @@ -417,6 +419,7 @@ ManageSession (struct display *d) */ Debug ("Source reset program %s\n", d->reset); source (verify.systemEnviron, d->reset); + PamCloseSession(); SessionExit (d, OBEYSESS_DISPLAY, TRUE); } @@ -480,6 +483,7 @@ SecureDisplay (struct display *d, Displa if (Setjmp (syncJump)) { LogError ("WARNING: display %s could not be secured\n", d->name); + PamCloseSession(); SessionExit (d, RESERVER_DISPLAY, FALSE); } (void) alarm ((unsigned) d->grabTimeout); @@ -491,6 +495,7 @@ SecureDisplay (struct display *d, Displa (void) Signal (SIGALRM, SIG_DFL); LogError ("WARNING: keyboard on display %s could not be secured\n", d->name); + PamCloseSession(); SessionExit (d, RESERVER_DISPLAY, FALSE); } Debug ("XGrabKeyboard succeeded %s\n", d->name); @@ -516,7 +521,6 @@ UnsecureDisplay (struct display *d, Disp void -SessionExit (struct display *d, int status, int removeAuth) -{ +PamCloseSession(void) { #ifdef USE_PAM pam_handle_t *pamh = thepamh(); @@ -530,4 +534,8 @@ SessionExit (struct display *d, int stat +} +void +SessionExit (struct display *d, int status, int removeAuth) +{ /* make sure the server gets reset after the session is over */ if (d->serverPid >= 2 && d->resetSignal) kill (d->serverPid, d->resetSignal); Index: xdm-1.1.10/greeter/greet.c =================================================================== --- xdm-1.1.10.orig/greeter/greet.c +++ xdm-1.1.10/greeter/greet.c @@ -582,6 +582,7 @@ greet_user_rtn GreetUser( pam_done: if (code != 0) { + PamCloseSession(); CloseGreet (d); SessionExit (d, code, FALSE); } @@ -610,6 +611,7 @@ greet_user_rtn GreetUser( code = Greet (d, greet); if (code != 0) { + PamCloseSession(); CloseGreet (d); SessionExit (d, code, FALSE); } @@ -632,6 +634,7 @@ greet_user_rtn GreetUser( { Debug ("Startup program %s exited with non-zero status\n", d->startup); + PamCloseSession(); SessionExit (d, OBEYSESS_DISPLAY, FALSE); } /*