Bugzilla – Attachment 1699 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]
update, improve the client UI a bit, remove client pass-through of signal
openbsd-ssh-signal2.patch (text/plain), 4.29 KB, created by
Darren Tucker
on 2009-10-18 10:56:25 AEDT
(
hide
)
Description:
update, improve the client UI a bit, remove client pass-through of signal
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2009-10-18 10:56:25 AEDT
Size:
4.29 KB
patch
obsolete
>Index: clientloop.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/clientloop.c,v >retrieving revision 1.213 >diff -u -p -r1.213 clientloop.c >--- clientloop.c 5 Jul 2009 19:28:33 -0000 1.213 >+++ clientloop.c 17 Oct 2009 23:45:30 -0000 >@@ -875,6 +875,28 @@ out: > xfree(fwd.connect_host); > } > >+static void >+process_signal(void) >+{ >+ void (*handler)(int); >+ char *sig; >+ >+ leave_raw_mode(); >+ handler = signal(SIGINT, SIG_IGN); >+ sig = read_passphrase("SIG", RP_ECHO); >+ if (sig != NULL && *sig != '\0') { >+ debug("sending signal %s to session %d", sig, session_ident); >+ channel_request_start(session_ident, "signal", 0); >+ packet_put_cstring(sig); >+ packet_send(); >+ packet_write_wait(); >+ } >+ if (sig != NULL) >+ xfree(sig); >+ signal(SIGINT, handler); >+ enter_raw_mode(); >+} >+ > /* > * Process the characters one by one, call with c==NULL for proto1 case. > */ >@@ -1051,6 +1073,7 @@ Supported escape sequences:\r\n\ > %cB - send a BREAK to the remote system\r\n\ > %cC - open a command line\r\n\ > %cR - Request rekey (SSH protocol 2 only)\r\n\ >+ %cS - Send a signal (SSH protocol 2 only)\r\n\ > %c^Z - suspend ssh\r\n\ > %c# - list forwarded connections\r\n\ > %c& - background ssh (when waiting for connections to terminate)\r\n\ >@@ -1062,7 +1085,7 @@ Supported escape sequences:\r\n\ > escape_char, escape_char, > escape_char, escape_char, > escape_char, escape_char, >- escape_char); >+ escape_char, escape_char); > } > buffer_append(berr, string, strlen(string)); > continue; >@@ -1074,6 +1097,11 @@ Supported escape sequences:\r\n\ > s = channel_open_message(); > buffer_append(berr, s, strlen(s)); > xfree(s); >+ continue; >+ >+ case 'S': >+ if (compat20) >+ process_signal(); > continue; > > case 'C': >Index: session.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/session.c,v >retrieving revision 1.247 >diff -u -p -r1.247 session.c >--- session.c 6 Oct 2009 04:46:40 -0000 1.247 >+++ session.c 17 Oct 2009 23:20:41 -0000 >@@ -1830,6 +1830,61 @@ session_env_req(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(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); >+ >+ xfree(signame); >+ return success; >+} >+ > static int > session_auth_agent_req(Session *s) > { >@@ -1885,6 +1940,8 @@ session_input_channel_req(Channel *c, co > success = session_window_change_req(s); > } else if (strcmp(rtype, "break") == 0) { > success = session_break_req(s); >+ } else if (strcmp(rtype, "signal") == 0) { >+ success = session_signal_req(s); > } > > return success; >Index: ssh.1 >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh.1,v >retrieving revision 1.284 >diff -u -p -r1.284 ssh.1 >--- ssh.1 8 Oct 2009 20:42:12 -0000 1.284 >+++ ssh.1 17 Oct 2009 11:08:03 -0000 >@@ -907,6 +907,11 @@ option. > .It Cm ~R > Request rekeying of the connection > (only useful for SSH protocol version 2 and if the peer supports it). >+.It Cm ~S >+Send a signal to the remote system >+(only useful for SSH protocol version 2 and if the peer supports it). >+The standard signals are ABRT ALRM FPE HUP ILL INT KILL PIPE QUIT SEGV TERM >+USR1 USR2 but other signals can be sent if the server supports them. > .El > .Sh TCP FORWARDING > Forwarding of arbitrary TCP connections over the secure channel can
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
Actions:
View
|
Diff
Attachments on
bug 1424
:
1432
|
1438
| 1699 |
1700
|
1709
|
2500
|
3120