Skip to content

Commit

Permalink
Don't skip audit before exitting cleanup_exit
Browse files Browse the repository at this point in the history
This fixes an issue where the SSH_CONNECTION_ABANDON event is not
audited because cleanup_exit overrides the regular _exit too soon and
as a result, failed auth attempts are not logged correctly.

The problem was introduced in 81c1099
where the code from upstream was merged before the audit_event call when
it should have been merged right before the _exit call in order to honor
the comment that just mentions an override of the exit value.
  • Loading branch information
antlarr-suse authored and djmdjm committed Aug 28, 2024
1 parent 16eaf9d commit 05f2b14
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sshd-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1502,13 +1502,13 @@ cleanup_exit(int i)
}
}
}
/* Override default fatal exit value when auth was attempted */
if (i == 255 && auth_attempted)
_exit(EXIT_AUTH_ATTEMPTED);
#ifdef SSH_AUDIT_EVENTS
/* done after do_cleanup so it can cancel the PAM auth 'thread' */
if (the_active_state != NULL && mm_is_monitor())
audit_event(the_active_state, SSH_CONNECTION_ABANDON);
#endif
/* Override default fatal exit value when auth was attempted */
if (i == 255 && auth_attempted)
_exit(EXIT_AUTH_ATTEMPTED);
_exit(i);
}

0 comments on commit 05f2b14

Please sign in to comment.