From f43e0eb68f78f5f279f1963224f8e7a2b97c4a4e Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Wed, 8 Aug 2012 17:20:04 -0700 Subject: [PATCH] chansrv: fix for writing to non existing channel goes to first channel --- sesman/chansrv/chansrv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 07ece0d9..365b285c 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -78,6 +78,10 @@ send_channel_data(int chan_id, char* data, int size) int sent; int rv; + if (chan_id == -1) + { + return 1; + } s = trans_get_out_s(g_con_trans, 8192); if (s == 0) { @@ -448,7 +452,10 @@ my_api_trans_data_in(struct trans* trans) { LOG(10, ("my_api_trans_data_in: got data %d", error)); ad = (struct xrdp_api_data*)(trans->callback_data); - send_channel_data(ad->chan_id, s->data, error); + if (send_channel_data(ad->chan_id, s->data, error) != 0) + { + LOG(0, ("my_api_trans_data_in: send_channel_data failed")); + } } else { @@ -540,8 +547,11 @@ my_api_trans_conn_in(struct trans* trans, struct trans* new_trans) break; } } - LOG(10, ("my_api_trans_conn_in: found %d", found)); + if (!found) + { + ad->chan_id = -1; + } new_trans->callback_data = ad;