Bugzilla – Attachment 3120 Details for
Bug 1424
Cannot signal a process over a channel (rfc 4254, section 6.9)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add server support for signal channel (subset of previous patches)
sshd-signal-chan.patch (text/plain), 2.10 KB, created by
Jay Weisskopf
on 2018-02-16 05:29:35 AEDT
(
hide
)
Description:
Add server support for signal channel (subset of previous patches)
Filename:
MIME Type:
Creator:
Jay Weisskopf
Created:
2018-02-16 05:29:35 AEDT
Size:
2.10 KB
patch
obsolete
>From 444cf5cc678ddf46b607e3078d1ecc4b41cc2e3b Mon Sep 17 00:00:00 2001 >From: Darren Tucker <dtucker@dtucker.net> >Date: Thu, 15 Feb 2018 12:20:22 -0500 >Subject: [PATCH] Add server support for signal channel (RFC 4254, 6.9) > >https://tools.ietf.org/html/rfc4254#section-6.9 >https://bugzilla.mindrot.org/show_bug.cgi?id=1424 >--- > session.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > >diff --git a/session.c b/session.c >index 51c5ea0e..2f12386e 100644 >--- a/session.c >+++ b/session.c >@@ -2018,6 +2018,60 @@ session_env_req(struct ssh *ssh, Session *s) > return (0); > } > >+/* >+ * For conversion of signals to/from ssh channel request names. >+ * List of signals from RFC 4254 section 6.10. >+ */ >+static int >+name2sig(char *name) >+{ >+#define SSH_SIG(x) if (strcmp(name, #x) == 0) return SIG ## 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 -1; >+} >+ >+static int >+session_signal_req(struct ssh *ssh, Session *s) >+{ >+ char *signame; >+ int sig, success = 0; >+ >+ signame = packet_get_string(NULL); >+ sig = name2sig(signame); >+ packet_check_eom(); >+ >+ if (sig >= 0) { >+ if (s->pid > 0) { >+ debug("session_signal_req: signal %s, killpg(%d, %d)", >+ signame, s->pid, sig); >+ temporarily_use_uid(s->pw); >+ if (killpg(s->pid, sig) < 0) >+ error("session_signal_req: killpg(%d, %d): %s", >+ s->pid, sig, strerror(errno)); >+ else >+ success = 1; >+ restore_uid(); >+ } >+ } else >+ debug("session_signal_req: unknown signal %s", signame); >+ >+ free(signame); >+ return success; >+} >+ > static int > session_auth_agent_req(struct ssh *ssh, Session *s) > { >@@ -2072,6 +2126,8 @@ session_input_channel_req(struct ssh *ssh, Channel *c, const char *rtype) > success = session_window_change_req(ssh, s); > } else if (strcmp(rtype, "break") == 0) { > success = session_break_req(ssh, s); >+ } else if (strcmp(rtype, "signal") == 0) { >+ success = session_signal_req(ssh, s); > } > > return success; >-- >2.14.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
jay
:
ok?
Actions:
View
|
Diff
Attachments on
bug 1424
:
1432
|
1438
|
1699
|
1700
|
1709
|
2500
| 3120