summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/serverloop.c b/serverloop.c
index ea468c954..340b19a5a 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.216 2019/06/28 13:35:04 deraadt Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.222 2020/01/30 07:21:38 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -184,7 +184,8 @@ client_alive_check(struct ssh *ssh)
184 int r, channel_id; 184 int r, channel_id;
185 185
186 /* timeout, check to see how many we have had */ 186 /* timeout, check to see how many we have had */
187 if (ssh_packet_inc_alive_timeouts(ssh) > 187 if (options.client_alive_count_max > 0 &&
188 ssh_packet_inc_alive_timeouts(ssh) >
188 options.client_alive_count_max) { 189 options.client_alive_count_max) {
189 sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id)); 190 sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
190 logit("Timeout, client not responding from %s", remote_id); 191 logit("Timeout, client not responding from %s", remote_id);
@@ -358,9 +359,10 @@ process_output(struct ssh *ssh, fd_set *writeset, int connection_out)
358 359
359 /* Send any buffered packet data to the client. */ 360 /* Send any buffered packet data to the client. */
360 if (FD_ISSET(connection_out, writeset)) { 361 if (FD_ISSET(connection_out, writeset)) {
361 if ((r = ssh_packet_write_poll(ssh)) != 0) 362 if ((r = ssh_packet_write_poll(ssh)) != 0) {
362 fatal("%s: ssh_packet_write_poll: %s", 363 sshpkt_fatal(ssh, r, "%s: ssh_packet_write_poll",
363 __func__, ssh_err(r)); 364 __func__);
365 }
364 } 366 }
365} 367}
366 368
@@ -402,15 +404,15 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
402 404
403 debug("Entering interactive session for SSH2."); 405 debug("Entering interactive session for SSH2.");
404 406
405 signal(SIGCHLD, sigchld_handler); 407 ssh_signal(SIGCHLD, sigchld_handler);
406 child_terminated = 0; 408 child_terminated = 0;
407 connection_in = ssh_packet_get_connection_in(ssh); 409 connection_in = ssh_packet_get_connection_in(ssh);
408 connection_out = ssh_packet_get_connection_out(ssh); 410 connection_out = ssh_packet_get_connection_out(ssh);
409 411
410 if (!use_privsep) { 412 if (!use_privsep) {
411 signal(SIGTERM, sigterm_handler); 413 ssh_signal(SIGTERM, sigterm_handler);
412 signal(SIGINT, sigterm_handler); 414 ssh_signal(SIGINT, sigterm_handler);
413 signal(SIGQUIT, sigterm_handler); 415 ssh_signal(SIGQUIT, sigterm_handler);
414 } 416 }
415 417
416 notify_setup(); 418 notify_setup();
@@ -685,9 +687,7 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
685 debug("%s: ctype %s rchan %u win %u max %u", __func__, 687 debug("%s: ctype %s rchan %u win %u max %u", __func__,
686 ctype, rchan, rwindow, rmaxpack); 688 ctype, rchan, rwindow, rmaxpack);
687 689
688 if (rchan > INT_MAX) { 690 if (strcmp(ctype, "session") == 0) {
689 error("%s: invalid remote channel ID", __func__);
690 } else if (strcmp(ctype, "session") == 0) {
691 c = server_request_session(ssh); 691 c = server_request_session(ssh);
692 } else if (strcmp(ctype, "direct-tcpip") == 0) { 692 } else if (strcmp(ctype, "direct-tcpip") == 0) {
693 c = server_request_direct_tcpip(ssh, &reason, &errmsg); 693 c = server_request_direct_tcpip(ssh, &reason, &errmsg);
@@ -698,7 +698,7 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
698 } 698 }
699 if (c != NULL) { 699 if (c != NULL) {
700 debug("%s: confirm %s", __func__, ctype); 700 debug("%s: confirm %s", __func__, ctype);
701 c->remote_id = (int)rchan; 701 c->remote_id = rchan;
702 c->have_remote_id = 1; 702 c->have_remote_id = 1;
703 c->remote_window = rwindow; 703 c->remote_window = rwindow;
704 c->remote_maxpacket = rmaxpack; 704 c->remote_maxpacket = rmaxpack;