summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'libxrdp/xrdp_channel.c')
-rw-r--r--libxrdp/xrdp_channel.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libxrdp/xrdp_channel.c b/libxrdp/xrdp_channel.c
index 00497c35..2b3d23a5 100644
--- a/libxrdp/xrdp_channel.c
+++ b/libxrdp/xrdp_channel.c
@@ -35,7 +35,11 @@ static struct mcs_channel_item* APP_CC
xrdp_channel_get_item(struct xrdp_channel* self, int channel_id)
{
struct mcs_channel_item* channel;
-
+ if(self->mcs_layer->channel_list==NULL)
+ {
+ g_writeln("xrdp_channel_get_item - No channel initialized");
+ return NULL ;
+ }
channel = (struct mcs_channel_item*)
list_get_item(self->mcs_layer->channel_list, channel_id);
return channel;
@@ -62,6 +66,7 @@ xrdp_channel_delete(struct xrdp_channel* self)
{
return;
}
+ g_memset(self,0,sizeof(struct xrdp_channel));
g_free(self);
}
@@ -88,19 +93,21 @@ xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id,
struct mcs_channel_item* channel;
channel = xrdp_channel_get_item(self, channel_id);
- if (channel == 0)
+ if (channel == NULL)
{
+ g_writeln("xrdp_channel_send - no such channel");
return 1;
}
s_pop_layer(s, channel_hdr);
out_uint32_le(s, total_data_len);
- if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
+ if (channel->flags & XR_CHANNEL_OPTION_SHOW_PROTOCOL)
{
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
}
out_uint32_le(s, flags);
if (xrdp_sec_send(self->sec_layer, s, channel->chanid) != 0)
{
+ g_writeln("xrdp_channel_send - failure sending data");
return 1;
}
return 0;
@@ -159,13 +166,14 @@ xrdp_channel_process(struct xrdp_channel* self, struct stream* s,
int channel_id;
struct mcs_channel_item* channel;
+
/* this assumes that the channels are in order of chanid(mcs channel id)
but they should be, see xrdp_sec_process_mcs_data_channels
the first channel should be MCS_GLOBAL_CHANNEL + 1, second
one should be MCS_GLOBAL_CHANNEL + 2, and so on */
channel_id = (chanid - MCS_GLOBAL_CHANNEL) - 1;
channel = xrdp_channel_get_item(self, channel_id);
- if (channel == 0)
+ if (channel == NULL)
{
g_writeln("xrdp_channel_process, channel not found");
return 1;