View | Details | Raw Unified | Return to bug 1424 | Differences between
and this patch

Collapse All | Expand All

(-)clientloop.c (-1 / +29 lines)
Lines 875-880 out: Link Here
875
		xfree(fwd.connect_host);
875
		xfree(fwd.connect_host);
876
}
876
}
877
877
878
static void
879
process_signal(void)
880
{
881
	void (*handler)(int);
882
	char *sig;
883
884
	leave_raw_mode();
885
	handler = signal(SIGINT, SIG_IGN);
886
	sig = read_passphrase("SIG", RP_ECHO);
887
	if (sig != NULL && *sig != '\0') {
888
		debug("sending signal %s to session %d", sig, session_ident);
889
		channel_request_start(session_ident, "signal", 0);
890
		packet_put_cstring(sig);
891
		packet_send();
892
		packet_write_wait();
893
	}
894
	if (sig != NULL)
895
		xfree(sig);
896
	signal(SIGINT, handler);
897
	enter_raw_mode();
898
}
899
878
/* 
900
/* 
879
 * Process the characters one by one, call with c==NULL for proto1 case.
901
 * Process the characters one by one, call with c==NULL for proto1 case.
880
 */
902
 */
Lines 1051-1056 Supported escape sequences:\r\n\ Link Here
1051
  %cB  - send a BREAK to the remote system\r\n\
1073
  %cB  - send a BREAK to the remote system\r\n\
1052
  %cC  - open a command line\r\n\
1074
  %cC  - open a command line\r\n\
1053
  %cR  - Request rekey (SSH protocol 2 only)\r\n\
1075
  %cR  - Request rekey (SSH protocol 2 only)\r\n\
1076
  %cS  - Send a signal (SSH protocol 2 only)\r\n\
1054
  %c^Z - suspend ssh\r\n\
1077
  %c^Z - suspend ssh\r\n\
1055
  %c#  - list forwarded connections\r\n\
1078
  %c#  - list forwarded connections\r\n\
1056
  %c&  - background ssh (when waiting for connections to terminate)\r\n\
1079
  %c&  - background ssh (when waiting for connections to terminate)\r\n\
Lines 1062-1068 Supported escape sequences:\r\n\ Link Here
1062
					    escape_char, escape_char,
1085
					    escape_char, escape_char,
1063
					    escape_char, escape_char,
1086
					    escape_char, escape_char,
1064
					    escape_char, escape_char,
1087
					    escape_char, escape_char,
1065
					    escape_char);
1088
					    escape_char, escape_char);
1066
				}
1089
				}
1067
				buffer_append(berr, string, strlen(string));
1090
				buffer_append(berr, string, strlen(string));
1068
				continue;
1091
				continue;
Lines 1074-1079 Supported escape sequences:\r\n\ Link Here
1074
				s = channel_open_message();
1097
				s = channel_open_message();
1075
				buffer_append(berr, s, strlen(s));
1098
				buffer_append(berr, s, strlen(s));
1076
				xfree(s);
1099
				xfree(s);
1100
				continue;
1101
1102
			case 'S':
1103
				if (compat20)
1104
					process_signal();
1077
				continue;
1105
				continue;
1078
1106
1079
			case 'C':
1107
			case 'C':
(-)session.c (+57 lines)
Lines 1830-1835 session_env_req(Session *s) Link Here
1830
	return (0);
1830
	return (0);
1831
}
1831
}
1832
1832
1833
/*
1834
 * For conversion of signals to/from ssh channel request names.
1835
 * List of signals from RFC 4254 section 6.10.
1836
 */
1837
1838
static int
1839
name2sig(char *name)
1840
{
1841
#define SSH_SIG(x) if (strcmp(name, #x) == 0) return SIG ## x
1842
	SSH_SIG(ABRT);
1843
	SSH_SIG(ALRM);
1844
	SSH_SIG(FPE);
1845
	SSH_SIG(HUP);
1846
	SSH_SIG(ILL);
1847
	SSH_SIG(INT);
1848
	SSH_SIG(KILL);
1849
	SSH_SIG(PIPE);
1850
	SSH_SIG(QUIT);
1851
	SSH_SIG(SEGV);
1852
	SSH_SIG(TERM);
1853
	SSH_SIG(USR1);
1854
	SSH_SIG(USR2);
1855
#undef	SSH_SIG
1856
	return -1;
1857
}
1858
1859
static int
1860
session_signal_req(Session *s)
1861
{
1862
	char *signame;
1863
	int sig, success = 0;
1864
1865
	signame = packet_get_string(NULL);
1866
	sig = name2sig(signame);
1867
	packet_check_eom();
1868
1869
	if (sig >= 0) {
1870
		if (s->pid > 0) {
1871
			debug("session_signal_req: signal %s, killpg(%d, %d)",
1872
			    signame, s->pid, sig);
1873
			temporarily_use_uid(s->pw);
1874
			if (killpg(s->pid, sig) < 0)
1875
				error("session_signal_req: killpg(%d, %d): %s",
1876
				    s->pid, sig, strerror(errno));
1877
			else
1878
				success = 1;
1879
			restore_uid();
1880
		}
1881
	} else
1882
		debug("session_signal_req: unknown signal %s", signame);
1883
1884
	xfree(signame);
1885
	return success;
1886
}
1887
1833
static int
1888
static int
1834
session_auth_agent_req(Session *s)
1889
session_auth_agent_req(Session *s)
1835
{
1890
{
Lines 1885-1890 session_input_channel_req(Channel *c, co Link Here
1885
		success = session_window_change_req(s);
1940
		success = session_window_change_req(s);
1886
	} else if (strcmp(rtype, "break") == 0) {
1941
	} else if (strcmp(rtype, "break") == 0) {
1887
		success = session_break_req(s);
1942
		success = session_break_req(s);
1943
	} else if (strcmp(rtype, "signal") == 0) {
1944
		success = session_signal_req(s);
1888
	}
1945
	}
1889
1946
1890
	return success;
1947
	return success;
(-)ssh.1 (+5 lines)
Lines 907-912 option. Link Here
907
.It Cm ~R
907
.It Cm ~R
908
Request rekeying of the connection
908
Request rekeying of the connection
909
(only useful for SSH protocol version 2 and if the peer supports it).
909
(only useful for SSH protocol version 2 and if the peer supports it).
910
.It Cm ~S
911
Send a signal to the remote system
912
(only useful for SSH protocol version 2 and if the peer supports it).
913
The standard signals are ABRT ALRM FPE HUP ILL INT KILL PIPE QUIT SEGV TERM
914
USR1 USR2 but other signals can be sent if the server supports them.
910
.El
915
.El
911
.Sh TCP FORWARDING
916
.Sh TCP FORWARDING
912
Forwarding of arbitrary TCP connections over the secure channel can
917
Forwarding of arbitrary TCP connections over the secure channel can

Return to bug 1424