From acf98854cae6ba7d555b89a18ee0cef7bb182068 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 20 Mar 2015 15:06:06 +0100 Subject: [PATCH] Resolve segfault with auditing commands (#1203900) --- openssh-6.7p1-audit.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openssh-6.7p1-audit.patch b/openssh-6.7p1-audit.patch index cb8e778..735c9c7 100644 --- a/openssh-6.7p1-audit.patch +++ b/openssh-6.7p1-audit.patch @@ -1895,7 +1895,7 @@ diff -up openssh-6.8p1/session.c.audit openssh-6.8p1/session.c - PRIVSEP(audit_run_command(shell)); + s->command = xstrdup(shell); } -+ if (s->command != NULL && s->ttyfd == -1) ++ if (s->command != NULL && s->ptyfd == -1) + s->command_handle = PRIVSEP(audit_run_command(s->command)); #endif if (s->ttyfd != -1) @@ -1940,7 +1940,7 @@ diff -up openssh-6.8p1/session.c.audit openssh-6.8p1/session.c session_by_tty(char *tty) { int i; -@@ -2532,6 +2561,30 @@ session_exit_message(Session *s, int sta +@@ -2532,6 +2561,31 @@ session_exit_message(Session *s, int sta chan_write_failed(c); } @@ -1948,8 +1948,9 @@ diff -up openssh-6.8p1/session.c.audit openssh-6.8p1/session.c +void +session_end_command2(Session *s) +{ -+ if (s->command != NULL && s->ttyfd == -1) { -+ audit_end_command(s->command_handle, s->command); ++ if (s->command != NULL) { ++ if (s->ptyfd == -1) ++ audit_end_command(s->command_handle, s->command); + free(s->command); + s->command = NULL; + s->command_handle = -1;