SSH is not cleaning up the wtmp files when SIGTERM is passed to user session process with Privilegeseparation disabled.
Created attachment 895 [details] SIGTERM handler for user sshd process The attached patch handles the SIGTERM to cleanup the wtmp files with privilegeseparation disabled.
Created attachment 897 [details] cleanup with less code in signal handler It's generally a bad idea to do too much in signal handlers since it's prone to races. (Some of the existing handlers break this rule, but we shouldn't add any more, and should fix the existing ones if possible.) Does the attached patch solve the problem?
The attachment id 897 is not cleaning the wtmp entries when SIGTERM is issued to user session process (Priv sep=no). My understanding is that, for Priv sep no, shell pid is logged for utmp/wtmp in OpenSSH code but when SIGTERM is issued, while doing do_cleanup() it may try to cleanup the entry for user sshd process.
Created attachment 909 [details] Patch for Protocol 2 support The patch (id=897) works for Protocol 1 but my environment strictly adheres to Protocol 2. I simply added the protocol 2 support and it is working fine. Let me know if the patch has any problems. With this Patch, the problem gets solved in HP-UX. Also when parent process exits from the loop and while doing cleanup the SIGCHLD handler is set to do its default for server_loop() but not in server_loop2(). Is there any specific reason? Is such a thing necessary for SIGTERM?
Created attachment 1016 [details] Updated patch I think this is better: check for SIGTERM, SIGINT and SIGQUIT and only activate these signal handlers for the !use_privsep case.
put this on the radar
patch applied, will be in 4.3. thanks!
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.