*************** *** 1132,1137 **** sigaction(SIGINT, &sa, NULL); while(wait(NULL) == -1 && errno == EINTR) /**/ ; openlog("login", LOG_ODELAY, LOG_AUTHPRIV); PAM_END; exit(0); } --- 1253,1272 ---- sigaction(SIGINT, &sa, NULL); while(wait(NULL) == -1 && errno == EINTR) /**/ ; openlog("login", LOG_ODELAY, LOG_AUTHPRIV); + #ifdef WITH_SELINUX + if (selinux_enabled) + { + /* We need to change the contexts of the terminal devices back to + the system when the user's session ends. */ + security_restorelabel_tty(ttyn,ttyn_context); + #ifdef CHOWNVCS + if (consoletty(0)) { + security_restorelabel_tty(vcsn,vcsn_context); + security_restorelabel_tty(vcsan.vcsan_context); + } + #endif + } + #endif PAM_END; exit(0); }