Fix auditing when using combination of ForceCommand and PTY

This commit is contained in:
Jakub Jelen 2015-03-10 09:14:44 +01:00
parent 3bc8b8b1ac
commit c8062c4be3

View File

@ -1947,7 +1947,7 @@ index 40a681e..acd87d5 100644
- PRIVSEP(audit_run_command(shell)); - PRIVSEP(audit_run_command(shell));
+ s->command = xstrdup(shell); + s->command = xstrdup(shell);
} }
+ if (s->command != NULL) + if (s->command != NULL && s->ttyfd == -1)
+ s->command_handle = PRIVSEP(audit_run_command(s->command)); + s->command_handle = PRIVSEP(audit_run_command(s->command));
#endif #endif
if (s->ttyfd != -1) if (s->ttyfd != -1)
@ -2000,7 +2000,7 @@ index 40a681e..acd87d5 100644
+void +void
+session_end_command2(Session *s) +session_end_command2(Session *s)
+{ +{
+ if (s->command != NULL) { + if (s->command != NULL && s->ttyfd == -1) {
+ audit_end_command(s->command_handle, s->command); + audit_end_command(s->command_handle, s->command);
+ free(s->command); + free(s->command);
+ s->command = NULL; + s->command = NULL;