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

Collapse All | Expand All

(-)a/session.c (-1 / +56 lines)
Lines 2018-2023 session_env_req(struct ssh *ssh, Session *s) Link Here
2018
	return (0);
2018
	return (0);
2019
}
2019
}
2020
2020
2021
/*
2022
 * For conversion of signals to/from ssh channel request names.
2023
 * List of signals from RFC 4254 section 6.10.
2024
 */
2025
static int
2026
name2sig(char *name)
2027
{
2028
#define SSH_SIG(x) if (strcmp(name, #x) == 0) return SIG ## x
2029
	SSH_SIG(ABRT);
2030
	SSH_SIG(ALRM);
2031
	SSH_SIG(FPE);
2032
	SSH_SIG(HUP);
2033
	SSH_SIG(ILL);
2034
	SSH_SIG(INT);
2035
	SSH_SIG(KILL);
2036
	SSH_SIG(PIPE);
2037
	SSH_SIG(QUIT);
2038
	SSH_SIG(SEGV);
2039
	SSH_SIG(TERM);
2040
	SSH_SIG(USR1);
2041
	SSH_SIG(USR2);
2042
#undef	SSH_SIG
2043
	return -1;
2044
}
2045
2046
static int
2047
session_signal_req(struct ssh *ssh, Session *s)
2048
{
2049
	char *signame;
2050
	int sig, success = 0;
2051
2052
	signame = packet_get_string(NULL);
2053
	sig = name2sig(signame);
2054
	packet_check_eom();
2055
2056
	if (sig >= 0) {
2057
		if (s->pid > 0) {
2058
			debug("session_signal_req: signal %s, killpg(%d, %d)",
2059
			    signame, s->pid, sig);
2060
			temporarily_use_uid(s->pw);
2061
			if (killpg(s->pid, sig) < 0)
2062
				error("session_signal_req: killpg(%d, %d): %s",
2063
				    s->pid, sig, strerror(errno));
2064
			else
2065
				success = 1;
2066
			restore_uid();
2067
		}
2068
	} else
2069
		debug("session_signal_req: unknown signal %s", signame);
2070
2071
	free(signame);
2072
	return success;
2073
}
2074
2021
static int
2075
static int
2022
session_auth_agent_req(struct ssh *ssh, Session *s)
2076
session_auth_agent_req(struct ssh *ssh, Session *s)
2023
{
2077
{
Lines 2072-2077 session_input_channel_req(struct ssh *ssh, Channel *c, const char *rtype) Link Here
2072
		success = session_window_change_req(ssh, s);
2126
		success = session_window_change_req(ssh, s);
2073
	} else if (strcmp(rtype, "break") == 0) {
2127
	} else if (strcmp(rtype, "break") == 0) {
2074
		success = session_break_req(ssh, s);
2128
		success = session_break_req(ssh, s);
2129
	} else if (strcmp(rtype, "signal") == 0) {
2130
		success = session_signal_req(ssh, s);
2075
	}
2131
	}
2076
2132
2077
	return success;
2133
	return success;
2078
- 

Return to bug 1424