summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libxrdp/libxrdp.c8
-rw-r--r--libxrdp/libxrdp.h4
-rw-r--r--libxrdp/libxrdpinc.h3
-rw-r--r--libxrdp/xrdp_channel.c87
-rw-r--r--libxrdp/xrdp_mcs.c6
5 files changed, 22 insertions, 86 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index d46b0a08..2517c245 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -687,7 +687,8 @@ libxrdp_get_channel_id(struct xrdp_session* session, char* name)
/*****************************************************************************/
int EXPORT_CC
libxrdp_send_to_channel(struct xrdp_session* session, int channel_id,
- char* data, int data_len)
+ char* data, int data_len,
+ int total_data_len, int flags)
{
struct xrdp_rdp* rdp;
struct xrdp_sec* sec;
@@ -704,11 +705,10 @@ libxrdp_send_to_channel(struct xrdp_session* session, int channel_id,
free_stream(s);
return 1;
}
- /* here we make a copy of the data, xrdp_channel_send is
- going to alter it if its bigger that 8192 or something */
+ /* here we make a copy of the data */
out_uint8a(s, data, data_len);
s_mark_end(s);
- if (xrdp_channel_send(chan, s, channel_id) != 0)
+ if (xrdp_channel_send(chan, s, channel_id, total_data_len, flags) != 0)
{
free_stream(s);
return 1;
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h
index d4aff1bb..70590912 100644
--- a/libxrdp/libxrdp.h
+++ b/libxrdp/libxrdp.h
@@ -58,7 +58,6 @@ struct mcs_channel_item
char name[16];
int flags;
int chanid;
- struct stream* in_s;
};
/* mcs */
@@ -402,7 +401,8 @@ xrdp_channel_delete(struct xrdp_channel* self);
int APP_CC
xrdp_channel_init(struct xrdp_channel* self, struct stream* s);
int APP_CC
-xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id);
+xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id,
+ int total_data_len, int flags);
int APP_CC
xrdp_channel_process(struct xrdp_channel* self, struct stream* s,
int chanid);
diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h
index 8e12642d..ceef3faf 100644
--- a/libxrdp/libxrdpinc.h
+++ b/libxrdp/libxrdpinc.h
@@ -208,7 +208,8 @@ int DEFAULT_CC
libxrdp_get_channel_id(struct xrdp_session* session, char* name);
int DEFAULT_CC
libxrdp_send_to_channel(struct xrdp_session* session, int channel_id,
- char* data, int data_len);
+ char* data, int data_len,
+ int total_data_len, int flags);
int DEFAULT_CC
libxrdp_orders_send_brush(struct xrdp_session* session,
int width, int height, int bpp, int type,
diff --git a/libxrdp/xrdp_channel.c b/libxrdp/xrdp_channel.c
index cfe8a4dd..da6c046c 100644
--- a/libxrdp/xrdp_channel.c
+++ b/libxrdp/xrdp_channel.c
@@ -80,16 +80,11 @@ xrdp_channel_init(struct xrdp_channel* self, struct stream* s)
/*****************************************************************************/
/* returns error */
-/* This sends data out to the secure layer, breaking up the data to
- CHANNEL_CHUNK_LENGTH as needed. This can end up sending many packets. */
+/* This sends data out to the secure layer. */
int APP_CC
-xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id)
+xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id,
+ int total_data_len, int flags)
{
- int length;
- int flags;
- int thislength;
- int remaining;
- char* data;
struct mcs_channel_item* channel;
channel = xrdp_channel_get_item(self, channel_id);
@@ -98,47 +93,16 @@ xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id)
return 1;
}
s_pop_layer(s, channel_hdr);
- length = (int)((s->end - s->p) - 8);
- thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
- remaining = length - thislength;
- flags = (remaining == 0) ?
- CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST : CHANNEL_FLAG_FIRST;
+ out_uint32_le(s, total_data_len);
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
{
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
}
- out_uint32_le(s, length);
out_uint32_le(s, flags);
- s->end = s->p + thislength;
- data = s->end;
if (xrdp_sec_send(self->sec_layer, s, channel->chanid) != 0)
{
return 1;
}
- while (remaining > 0)
- {
- thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
- remaining -= thislength;
- flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
- if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
- {
- flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
- }
- if (xrdp_sec_init(self->sec_layer, s) != 0)
- {
- return 1;
- }
- out_uint32_le(s, length);
- out_uint32_le(s, flags);
- /* this is copying a later part of the stream up to the front */
- out_uint8a(s, data, thislength);
- s_mark_end(s);
- if (xrdp_sec_send(self->sec_layer, s, channel->chanid) != 0)
- {
- return 1;
- }
- data += thislength;
- }
return 0;
}
@@ -148,7 +112,8 @@ xrdp_channel_send(struct xrdp_channel* self, struct stream* s, int channel_id)
ready. the default for this is a call to xrdp_wm.c. */
static int APP_CC
xrdp_channel_call_callback(struct xrdp_channel* self, struct stream* s,
- int channel_id)
+ int channel_id,
+ int total_data_len, int flags)
{
struct xrdp_session* session;
int rv;
@@ -162,17 +127,18 @@ xrdp_channel_call_callback(struct xrdp_channel* self, struct stream* s,
{
size = (int)(s->end - s->p);
/* in xrdp_wm.c */
- rv = session->callback(session->id, 0x5555, channel_id, size,
- (long)s->p, 0);
+ rv = session->callback(session->id, 0x5555,
+ MAKELONG(channel_id, flags),
+ size, (tbus)(s->p), total_data_len);
}
else
{
- g_writeln("in xrdp_channel_process1, session->callback is nil");
+ g_writeln("in xrdp_channel_call_callback, session->callback is nil");
}
}
else
{
- g_writeln("in xrdp_channel_process1, session is nil");
+ g_writeln("in xrdp_channel_call_callback, session is nil");
}
return rv;
}
@@ -180,9 +146,7 @@ xrdp_channel_call_callback(struct xrdp_channel* self, struct stream* s,
/*****************************************************************************/
/* returns error */
/* This is called from the secure layer to process an incomming non global
- channel packet. It copies the channel data to a special stream contained
- in the channel struct(the one in xrdp_mcs->channel_list) untill the
- whole data message is ready.
+ channel packet.
'chanid' passed in here is the mcs channel id so it MCS_GLOBAL_CHANNEL
plus something. */
int APP_CC
@@ -191,10 +155,8 @@ xrdp_channel_process(struct xrdp_channel* self, struct stream* s,
{
int length;
int flags;
- int thislength;
int rv;
int channel_id;
- struct stream* in_s;
struct mcs_channel_item* channel;
/* this assumes that the channels are in order of chanid(mcs channel id)
@@ -211,29 +173,6 @@ xrdp_channel_process(struct xrdp_channel* self, struct stream* s,
rv = 0;
in_uint32_le(s, length);
in_uint32_le(s, flags);
- if ((flags & CHANNEL_FLAG_FIRST) && (flags & CHANNEL_FLAG_LAST))
- {
- rv = xrdp_channel_call_callback(self, s, channel_id);
- }
- else
- {
- if (channel->in_s == 0)
- {
- make_stream(channel->in_s);
- }
- in_s = channel->in_s;
- if (flags & CHANNEL_FLAG_FIRST)
- {
- init_stream(in_s, length);
- }
- thislength = MIN(s->end - s->p, (in_s->data + in_s->size) - in_s->p);
- out_uint8a(in_s, s->p, thislength);
- if (flags & CHANNEL_FLAG_LAST)
- {
- in_s->end = in_s->p;
- in_s->p = in_s->data;
- rv = xrdp_channel_call_callback(self, in_s, channel_id);
- }
- }
+ rv = xrdp_channel_call_callback(self, s, channel_id, length, flags);
return rv;
}
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c
index d8fb1804..04275d56 100644
--- a/libxrdp/xrdp_mcs.c
+++ b/libxrdp/xrdp_mcs.c
@@ -61,11 +61,7 @@ xrdp_mcs_delete(struct xrdp_mcs* self)
{
channel_item = (struct mcs_channel_item*)
list_get_item(self->channel_list, index);
- if (channel_item != 0)
- {
- free_stream(channel_item->in_s);
- g_free(channel_item);
- }
+ g_free(channel_item);
}
list_delete(self->channel_list);
xrdp_iso_delete(self->iso_layer);