From 5a80bba86f60c2ba8447c764ad2fd4e6207b544a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 4 Sep 2002 16:39:02 +1000 Subject: [PATCH] - markus@cvs.openbsd.org 2002/08/22 21:45:41 [session.c] send signal name (not signal number) in "exit-signal" message; noticed by galb@vandyke.com --- ChangeLog | 6 +++++- session.c | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07699b017..ce409160f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,10 @@ [auth1.c auth2.c] auth_root_allowed() is handled by the monitor in the privsep case, so skip this for use_privsep, ok stevesk@, fixes bugzilla #387/325 + - markus@cvs.openbsd.org 2002/08/22 21:45:41 + [session.c] + send signal name (not signal number) in "exit-signal" message; noticed + by galb@vandyke.com 20020820 - OpenBSD CVS Sync @@ -1568,4 +1572,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2434 2002/09/04 06:37:26 djm Exp $ +$Id: ChangeLog,v 1.2435 2002/09/04 06:39:02 djm Exp $ diff --git a/session.c b/session.c index f2a1bf015..0e78aca34 100644 --- a/session.c +++ b/session.c @@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.146 2002/07/30 17:03:55 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.147 2002/08/22 21:45:41 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -1809,6 +1809,27 @@ session_pty_cleanup(void *session) PRIVSEP(session_pty_cleanup2(session)); } +static char * +sig2name(int sig) +{ +#define SSH_SIG(x) if (sig == SIG ## x) return #x + SSH_SIG(ABRT); + SSH_SIG(ALRM); + SSH_SIG(FPE); + SSH_SIG(HUP); + SSH_SIG(ILL); + SSH_SIG(INT); + SSH_SIG(KILL); + SSH_SIG(PIPE); + SSH_SIG(QUIT); + SSH_SIG(SEGV); + SSH_SIG(TERM); + SSH_SIG(USR1); + SSH_SIG(USR2); +#undef SSH_SIG + return "SIG@openssh.com"; +} + static void session_exit_message(Session *s, int status) { @@ -1826,7 +1847,7 @@ session_exit_message(Session *s, int status) packet_send(); } else if (WIFSIGNALED(status)) { channel_request_start(s->chanid, "exit-signal", 0); - packet_put_int(WTERMSIG(status)); + packet_put_cstring(sig2name(WTERMSIG(status))); #ifdef WCOREDUMP packet_put_char(WCOREDUMP(status)); #else /* WCOREDUMP */