Exemplo n.º 1
0
static void
client_alive_check(void)
{
	static int had_channel = 0;
	int id;

	id = channel_find_open();
	if (id == -1) {
		if (!had_channel)
			return;
		packet_disconnect("No open channels after timeout!");
	}
	had_channel = 1;

	/* timeout, check to see how many we have had */
	if (++client_alive_timeouts > options.client_alive_count_max)
		packet_disconnect("Timeout, your session not responding.");

	/*
	 * send a bogus channel request with "wantreply",
	 * we should get back a failure
	 */
	channel_request_start(id, "*****@*****.**", 1);
	packet_send();
}
Exemplo n.º 2
0
static void
client_alive_check(struct ssh *ssh)
{
	u_int channel_id;
	int r;

	/* timeout, check to see how many we have had */
	if (ssh_packet_inc_alive_timeouts(ssh) > options.client_alive_count_max) {
		logit("Timeout, client not responding.");
		cleanup_exit(255);
	}

	/*
	 * send a bogus global/channel request with "wantreply",
	 * we should get back a failure
	 */
	if ((channel_id = channel_find_open()) == CHANNEL_ID_NONE) {
		if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 ||
		    (r = sshpkt_put_cstring(ssh, "*****@*****.**"))
		    != 0 ||
		    (r = sshpkt_put_u8(ssh, 1)) != 0) /* boolean: want reply */
			fatal("%s: %s", __func__, ssh_err(r));
	} else {
		channel_request_start(channel_id, "*****@*****.**", 1);
	}
	if ((r = sshpkt_send(ssh)) != 0)
		fatal("%s: %s", __func__, ssh_err(r));
}
Exemplo n.º 3
0
static void
client_alive_check(void)
{
	int channel_id;

	/* timeout, check to see how many we have had */
	if (packet_inc_alive_timeouts() > options.client_alive_count_max) {
		logit("Timeout, client not responding.");
		cleanup_exit(255);
	}

	/*
	 * send a bogus global/channel request with "wantreply",
	 * we should get back a failure
	 */
	if ((channel_id = channel_find_open()) == -1) {
		packet_start(SSH2_MSG_GLOBAL_REQUEST);
		packet_put_cstring("*****@*****.**");
		packet_put_char(1);	/* boolean: want reply */
	} else {
		channel_request_start(channel_id, "*****@*****.**", 1);
	}
	packet_send();
}