summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index 3ab8ed8a7..cf6742ae3 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.179 2002/06/26 08:55:02 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.180 2002/07/04 08:12:15 deraadt Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -572,6 +572,7 @@ void
572channel_send_open(int id) 572channel_send_open(int id)
573{ 573{
574 Channel *c = channel_lookup(id); 574 Channel *c = channel_lookup(id);
575
575 if (c == NULL) { 576 if (c == NULL) {
576 log("channel_send_open: %d: bad id", id); 577 log("channel_send_open: %d: bad id", id);
577 return; 578 return;
@@ -589,6 +590,7 @@ void
589channel_request_start(int local_id, char *service, int wantconfirm) 590channel_request_start(int local_id, char *service, int wantconfirm)
590{ 591{
591 Channel *c = channel_lookup(local_id); 592 Channel *c = channel_lookup(local_id);
593
592 if (c == NULL) { 594 if (c == NULL) {
593 log("channel_request_start: %d: unknown channel id", local_id); 595 log("channel_request_start: %d: unknown channel id", local_id);
594 return; 596 return;
@@ -603,6 +605,7 @@ void
603channel_register_confirm(int id, channel_callback_fn *fn) 605channel_register_confirm(int id, channel_callback_fn *fn)
604{ 606{
605 Channel *c = channel_lookup(id); 607 Channel *c = channel_lookup(id);
608
606 if (c == NULL) { 609 if (c == NULL) {
607 log("channel_register_comfirm: %d: bad id", id); 610 log("channel_register_comfirm: %d: bad id", id);
608 return; 611 return;
@@ -613,6 +616,7 @@ void
613channel_register_cleanup(int id, channel_callback_fn *fn) 616channel_register_cleanup(int id, channel_callback_fn *fn)
614{ 617{
615 Channel *c = channel_lookup(id); 618 Channel *c = channel_lookup(id);
619
616 if (c == NULL) { 620 if (c == NULL) {
617 log("channel_register_cleanup: %d: bad id", id); 621 log("channel_register_cleanup: %d: bad id", id);
618 return; 622 return;
@@ -623,6 +627,7 @@ void
623channel_cancel_cleanup(int id) 627channel_cancel_cleanup(int id)
624{ 628{
625 Channel *c = channel_lookup(id); 629 Channel *c = channel_lookup(id);
630
626 if (c == NULL) { 631 if (c == NULL) {
627 log("channel_cancel_cleanup: %d: bad id", id); 632 log("channel_cancel_cleanup: %d: bad id", id);
628 return; 633 return;
@@ -633,6 +638,7 @@ void
633channel_register_filter(int id, channel_filter_fn *fn) 638channel_register_filter(int id, channel_filter_fn *fn)
634{ 639{
635 Channel *c = channel_lookup(id); 640 Channel *c = channel_lookup(id);
641
636 if (c == NULL) { 642 if (c == NULL) {
637 log("channel_register_filter: %d: bad id", id); 643 log("channel_register_filter: %d: bad id", id);
638 return; 644 return;
@@ -645,6 +651,7 @@ channel_set_fds(int id, int rfd, int wfd, int efd,
645 int extusage, int nonblock, u_int window_max) 651 int extusage, int nonblock, u_int window_max)
646{ 652{
647 Channel *c = channel_lookup(id); 653 Channel *c = channel_lookup(id);
654
648 if (c == NULL || c->type != SSH_CHANNEL_LARVAL) 655 if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
649 fatal("channel_activate for non-larval channel %d.", id); 656 fatal("channel_activate for non-larval channel %d.", id);
650 channel_register_fds(c, rfd, wfd, efd, extusage, nonblock); 657 channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
@@ -815,6 +822,7 @@ static void
815channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) 822channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset)
816{ 823{
817 int ret = x11_open_helper(&c->output); 824 int ret = x11_open_helper(&c->output);
825
818 if (ret == 1) { 826 if (ret == 1) {
819 /* Start normal processing for the channel. */ 827 /* Start normal processing for the channel. */
820 c->type = SSH_CHANNEL_OPEN; 828 c->type = SSH_CHANNEL_OPEN;
@@ -1400,6 +1408,7 @@ static void
1400channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) 1408channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset)
1401{ 1409{
1402 int len; 1410 int len;
1411
1403 /* Send buffered output data to the socket. */ 1412 /* Send buffered output data to the socket. */
1404 if (FD_ISSET(c->sock, writeset) && buffer_len(&c->output) > 0) { 1413 if (FD_ISSET(c->sock, writeset) && buffer_len(&c->output) > 0) {
1405 len = write(c->sock, buffer_ptr(&c->output), 1414 len = write(c->sock, buffer_ptr(&c->output),
@@ -1477,6 +1486,7 @@ static void
1477channel_handler_init(void) 1486channel_handler_init(void)
1478{ 1487{
1479 int i; 1488 int i;
1489
1480 for (i = 0; i < SSH_CHANNEL_MAX_TYPE; i++) { 1490 for (i = 0; i < SSH_CHANNEL_MAX_TYPE; i++) {
1481 channel_pre[i] = NULL; 1491 channel_pre[i] = NULL;
1482 channel_post[i] = NULL; 1492 channel_post[i] = NULL;
@@ -2610,6 +2620,7 @@ void
2610deny_input_open(int type, u_int32_t seq, void *ctxt) 2620deny_input_open(int type, u_int32_t seq, void *ctxt)
2611{ 2621{
2612 int rchan = packet_get_int(); 2622 int rchan = packet_get_int();
2623
2613 switch (type) { 2624 switch (type) {
2614 case SSH_SMSG_AGENT_OPEN: 2625 case SSH_SMSG_AGENT_OPEN:
2615 error("Warning: ssh server tried agent forwarding."); 2626 error("Warning: ssh server tried agent forwarding.");