Merge branch 'master' of git://github.com/FreeRDP/xrdp

ulab-next
LawrenceK 12 years ago
commit 2dfc213abe

@ -352,6 +352,10 @@ g_tcp_set_no_delay(int sck)
{
ret = 0; /* success */
}
else
{
g_writeln("Error setting tcp_nodelay");
}
}
}
else
@ -389,6 +393,10 @@ g_tcp_set_keepalive(int sck)
{
ret = 0; /* success */
}
else
{
g_writeln("Error setting tcp_keepalive");
}
}
}
else

@ -40,7 +40,7 @@ struct xrdp_client_info
int cache3_entries;
int cache3_size;
int bitmap_cache_persist_enable; /* 0 or 2 */
int bitmap_cache_version; /* 0 = original version, 2 = v2, 3 = v3 */
int bitmap_cache_version; /* ored 1 = original version, 2 = v2, 4 = v3 */
/* pointer info */
int pointer_cache_entries;
/* other */
@ -90,6 +90,7 @@ struct xrdp_client_info
int jpeg_codec_id;
int jpeg_prop_len;
char jpeg_prop[64];
int v3_codec_id;
};
#endif

@ -516,6 +516,10 @@
#define XR_CODEC_GUID_REMOTEFX \
"\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
/* CODEC_GUID_JPEG 0x430C9EED1BAF4CE6869ACB8B37B66237*/
#define XR_CODEC_GUID_JPEG \
"\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"
#define RDP_CAPSET_SURFCMDS 0x1c
#define RDP_CAPLEN_SURFCMDS 0x0c
#define RDP_CAPSET_BMPCODECS 0x1d

@ -411,7 +411,7 @@ int APP_CC
xrdp_jpeg_compress(char* in_data, int width, int height,
struct stream* s, int bpp, int byte_limit,
int start_line, struct stream* temp_s,
int e);
int e, int quality);
/* xrdp_channel.c */
struct xrdp_channel* APP_CC

@ -148,9 +148,8 @@ jp_do_compress(char* data, int width, int height, int bpp, int quality,
/*****************************************************************************/
static int APP_CC
jpeg_compress(char* in_data, int width, int height,
struct stream* s, int bpp, int byte_limit,
int start_line, struct stream* temp_s,
int e)
struct stream* s, struct stream* temp_s, int bpp,
int byte_limit, int e, int quality)
{
char* data;
tui32* src32;
@ -164,7 +163,7 @@ jpeg_compress(char* in_data, int width, int height,
int i;
int cdata_bytes;
data = g_malloc((width + e) * height * 3, 0);
data = temp_s->data;
dst8 = data;
if (bpp == 24)
{
@ -192,9 +191,8 @@ jpeg_compress(char* in_data, int width, int height,
g_writeln("bpp wrong %d", bpp);
}
cdata_bytes = byte_limit;
jp_do_compress(data, width + e, height, 24, JP_QUALITY, s->p, &cdata_bytes);
jp_do_compress(data, width + e, height, 24, quality, s->p, &cdata_bytes);
s->p += cdata_bytes;
g_free(data);
return cdata_bytes;
}
@ -203,10 +201,10 @@ int APP_CC
xrdp_jpeg_compress(char* in_data, int width, int height,
struct stream* s, int bpp, int byte_limit,
int start_line, struct stream* temp_s,
int e)
int e, int quality)
{
jpeg_compress(in_data, width, height, s, bpp, byte_limit,
start_line, temp_s, e);
jpeg_compress(in_data, width, height, s, temp_s, bpp, byte_limit,
e, quality);
return height;
}

@ -67,7 +67,7 @@ xrdp_mcs_delete(struct xrdp_mcs* self)
xrdp_iso_delete(self->iso_layer);
/* make sure we get null pointer exception if struct is used again. */
DEBUG(("xrdp_mcs_delete processed"))
g_memset(self,0,sizeof(struct xrdp_mcs)) ;
g_memset(self,0,sizeof(struct xrdp_mcs)) ;
g_free(self);
}
@ -135,7 +135,7 @@ xrdp_mcs_recv(struct xrdp_mcs* self, struct stream* s, int* chan)
/* this is channels getting added from the client */
if (appid == MCS_CJRQ)
{
g_writeln("channel join request received");
g_writeln("channel join request received");
in_uint16_be(s, userid);
in_uint16_be(s, chanid);
DEBUG(("xrdp_mcs_recv adding channel %4.4x", chanid));

@ -26,6 +26,16 @@
#include <freerdp/codec/rfx.h>
#endif
#define LLOG_LEVEL 2
#define LLOGLN(_log_level, _params) \
{ \
if (_log_level < LLOG_LEVEL) \
{ \
g_write("xrdp_orders.c [%10.10u]: ", g_time3()); \
g_writeln _params ; \
} \
}
/*****************************************************************************/
struct xrdp_orders* APP_CC
xrdp_orders_create(struct xrdp_session* session, struct xrdp_rdp* rdp_layer)
@ -1832,30 +1842,6 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders* self,
return 0;
}
/*****************************************************************************/
static int
xrdp_orders_send_as_jpeg(struct xrdp_orders* self,
int width, int height, int bpp, int hints)
{
if (hints & 1)
{
return 0;
}
if (bpp != 24)
{
return 0;
}
if (self->rdp_layer->client_info.jpeg == 0)
{
return 0;
}
if (width * height < 64)
{
return 0;
}
return 1;
}
/*****************************************************************************/
/* returns error */
/* max size width * height * Bpp + 14 */
@ -1871,7 +1857,6 @@ xrdp_orders_send_bitmap2(struct xrdp_orders* self,
int i = 0;
int lines_sending = 0;
int e = 0;
int is_jpeg;
struct stream* s = NULL;
struct stream* temp_s = NULL;
char* p = NULL;
@ -1897,18 +1882,8 @@ xrdp_orders_send_bitmap2(struct xrdp_orders* self,
init_stream(temp_s, 16384);
p = s->p;
i = height;
is_jpeg = 0;
if (xrdp_orders_send_as_jpeg(self, width, height, bpp, hints))
{
lines_sending = xrdp_jpeg_compress(data, width, height, s, bpp, 16384,
i - 1, temp_s, e);
is_jpeg = 1;
}
else
{
lines_sending = xrdp_bitmap_compress(data, width, height, s, bpp, 16384,
lines_sending = xrdp_bitmap_compress(data, width, height, s, bpp, 16384,
i - 1, temp_s, e);
}
if (lines_sending != height)
{
free_stream(s);
@ -1927,10 +1902,6 @@ height(%d)", lines_sending, height);
out_uint16_le(self->out_s, len);
i = (((Bpp + 2) << 3) & 0x38) | (cache_id & 7);
i = i | (0x08 << 7); /* CBR2_NO_BITMAP_COMPRESSION_HDR */
if (is_jpeg)
{
i = i | (0x80 << 7); /* unsed flag, jpeg hack */
}
out_uint16_le(self->out_s, i); /* flags */
out_uint8(self->out_s, RDP_ORDER_BMPCACHE2); /* type */
out_uint8(self->out_s, width + e);
@ -1946,6 +1917,80 @@ height(%d)", lines_sending, height);
return 0;
}
/*****************************************************************************/
static int
xrdp_orders_send_as_jpeg(struct xrdp_orders* self,
int width, int height, int bpp, int hints)
{
if (hints & 1)
{
return 0;
}
if (bpp != 24)
{
return 0;
}
if (width * height < 64)
{
return 0;
}
return 1;
}
#if defined(XRDP_FREERDP1)
/*****************************************************************************/
/* secondary drawing order (bitmap v3) using remotefx compression */
static int APP_CC
xrdp_orders_send_as_rfx(struct xrdp_orders* self,
int width, int height, int bpp,
int hints)
{
if (bpp != 24)
{
return 0;
}
return 1;
}
#endif
/*****************************************************************************/
static int APP_CC
xrdp_orders_out_v3(struct xrdp_orders* self, int cache_id, int cache_idx,
char* buf, int bufsize, int width, int height, int bpp,
int codec_id)
{
int Bpp;
int order_flags;
int len;
int i;
Bpp = (bpp + 7) / 8;
xrdp_orders_check(self, bufsize + 30);
self->order_count++;
order_flags = RDP_ORDER_STANDARD | RDP_ORDER_SECONDARY;
out_uint8(self->out_s, order_flags);
len = (bufsize + 22) - 7; /* length after type minus 7 */
out_uint16_le(self->out_s, len);
i = (((Bpp + 2) << 3) & 0x38) | (cache_id & 7);
out_uint16_le(self->out_s, i); /* flags */
out_uint8(self->out_s, RDP_ORDER_BMPCACHE3); /* type */
/* cache index */
out_uint16_le(self->out_s, cache_idx);
/* persistant cache key 1/2 */
out_uint32_le(self->out_s, 0);
out_uint32_le(self->out_s, 0);
/* bitmap data */
out_uint8(self->out_s, bpp);
out_uint8(self->out_s, 0); /* reserved */
out_uint8(self->out_s, 0); /* reserved */
out_uint8(self->out_s, codec_id);
out_uint16_le(self->out_s, width);
out_uint16_le(self->out_s, height);
out_uint32_le(self->out_s, bufsize);
out_uint8a(self->out_s, buf, bufsize);
return 0;
}
/*****************************************************************************/
/* secondary drawing order (bitmap v3) using remotefx compression */
int APP_CC
@ -1953,6 +1998,90 @@ xrdp_orders_send_bitmap3(struct xrdp_orders* self,
int width, int height, int bpp, char* data,
int cache_id, int cache_idx, int hints)
{
int e;
int bufsize;
int quality;
struct stream* xr_s; /* xrdp stream */
struct stream* temp_s; /* xrdp stream */
struct xrdp_client_info* ci;
#if defined(XRDP_FREERDP1)
STREAM* fr_s; /* FreeRDP stream */
RFX_CONTEXT* context;
RFX_RECT rect;
#endif
ci = &(self->rdp_layer->client_info);
if (ci->v3_codec_id == 0)
{
return 2;
}
if (ci->v3_codec_id == ci->rfx_codec_id)
{
#if defined(XRDP_FREERDP1)
if (!xrdp_orders_send_as_rfx(self, width, height, bpp, hints))
{
return 2;
}
LLOGLN(10, ("xrdp_orders_send_bitmap3: rfx"));
context = (RFX_CONTEXT*)(self->rdp_layer->rfx_enc);
make_stream(xr_s);
init_stream(xr_s, 16384);
fr_s = stream_new(0);
stream_attach(fr_s, (tui8*)(xr_s->data), 16384);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
rfx_compose_message(context, fr_s, &rect, 1, (tui8*)data, width,
height, width * 4);
bufsize = stream_get_length(fr_s);
xrdp_orders_out_v3(self, cache_id, cache_idx, (char*)(fr_s->data), bufsize,
width, height, bpp,ci->v3_codec_id);
stream_detach(fr_s);
stream_free(fr_s);
free_stream(xr_s);
return 0;
#else
return 2;
#endif
}
else if (ci->v3_codec_id == ci->jpeg_codec_id)
{
#if defined(XRDP_JPEG)
if (!xrdp_orders_send_as_jpeg(self, width, height, bpp, hints))
{
LLOGLN(10, ("xrdp_orders_send_bitmap3: jpeg skipped"));
return 2;
}
LLOGLN(10, ("xrdp_orders_send_bitmap3: jpeg"));
e = width % 4;
if (e != 0)
{
e = 4 - e;
}
make_stream(xr_s);
init_stream(xr_s, 16384);
make_stream(temp_s);
init_stream(temp_s, 16384);
quality = ci->jpeg_prop[0];
xrdp_jpeg_compress(data, width, height, xr_s, bpp, 16384,
height - 1, temp_s, e, quality);
s_mark_end(xr_s);
bufsize = (int)(xr_s->end - xr_s->data);
xrdp_orders_out_v3(self, cache_id, cache_idx, (char*)(xr_s->data), bufsize,
width + e, height, bpp,ci->v3_codec_id);
free_stream(xr_s);
free_stream(temp_s);
return 0;
#else
return 2;
#endif
}
else
{
g_writeln("xrdp_orders_send_bitmap3: todo unknown codec");
return 1;
}
return 0;
}

@ -117,7 +117,7 @@ xrdp_rdp_read_config(struct xrdp_client_info* client_info)
else
{
g_writeln("Warning: Your configured crypt level is"
"undefined 'high' will be used");
"undefined 'high' will be used");
client_info->crypt_level = 3;
}
}
@ -559,9 +559,13 @@ xrdp_rdp_send_demand_active(struct xrdp_rdp* self)
struct stream* s;
int caps_count;
int caps_size;
int codec_caps_count;
int codec_caps_size;
char* caps_count_ptr;
char* caps_size_ptr;
char* caps_ptr;
char* codec_caps_count_ptr;
char* codec_caps_size_ptr;
make_stream(s);
init_stream(s, 8192);
@ -684,18 +688,37 @@ xrdp_rdp_send_demand_active(struct xrdp_rdp* self)
/* Output bmpcodecs capability set */
caps_count++;
out_uint16_le(s, RDP_CAPSET_BMPCODECS);
out_uint16_le(s, 302); /* cap len */
out_uint8(s, 2); /* bitmapCodecCount */
codec_caps_size_ptr = s->p;
out_uint8s(s, 2); /* cap len set later */
codec_caps_count = 0;
codec_caps_count_ptr = s->p;
out_uint8s(s, 1); /* bitmapCodecCount set later */
/* nscodec */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_NSCODEC, 16);
out_uint8(s, 1); /* codec id */
out_uint8(s, 1); /* codec id, must be 1 */
out_uint16_le(s, 3);
out_uint8(s, 0x01); /* fAllowDynamicFidelity */
out_uint8(s, 0x01); /* fAllowSubsampling */
out_uint8(s, 0x03); /* colorLossLevel */
/* remotefx */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_REMOTEFX, 16);
out_uint8(s, 0); /* codec id */
out_uint8(s, 0); /* codec id, client sets */
out_uint16_le(s, 256);
out_uint8s(s, 256);
/* jpeg */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_JPEG, 16);
out_uint8(s, 0); /* codec id, client sets */
out_uint16_le(s, 1); /* ext length */
out_uint8(s, 75);
/* calculate and set size and count */
codec_caps_size = (int)(s->p - codec_caps_size_ptr);
codec_caps_size += 2; /* 2 bytes for RDP_CAPSET_BMPCODECS above */
codec_caps_size_ptr[0] = codec_caps_size;
codec_caps_size_ptr[1] = codec_caps_size >> 8;
codec_caps_count_ptr[0] = codec_caps_count;
/* Output color cache capability set */
caps_count++;
@ -734,6 +757,12 @@ xrdp_rdp_send_demand_active(struct xrdp_rdp* self)
out_uint8(s, 3); /* NumIconCaches */
out_uint16_le(s, 12); /* NumIconCacheEntries */
/* 6 - bitmap cache v3 codecid */
caps_count++;
out_uint16_le(s, 0x0006);
out_uint16_le(s, 5);
out_uint8(s, 0); /* client sets */
out_uint8s(s, 4); /* pad */
s_mark_end(s);
@ -816,12 +845,8 @@ xrdp_process_capset_order(struct xrdp_rdp* self, struct stream* s,
in_uint16_le(s, ex_flags); /* Ex flags */
if (ex_flags & XR_ORDERFLAGS_EX_CACHE_BITMAP_REV3_SUPPORT)
{
g_writeln("RDP_CAPSET_BMPCACHE3");
DEBUG(("RDP_CAPSET_BMPCACHE3"));
if (self->client_info.bitmap_cache_version < 3)
{
self->client_info.bitmap_cache_version = 3;
}
g_writeln("xrdp_process_capset_order: bitmap cache v3 supported");
self->client_info.bitmap_cache_version |= 4;
}
in_uint8s(s, 4); /* Pad */
@ -839,6 +864,7 @@ static int APP_CC
xrdp_process_capset_bmpcache(struct xrdp_rdp* self, struct stream* s,
int len)
{
self->client_info.bitmap_cache_version |= 1;
in_uint8s(s, 24);
in_uint16_le(s, self->client_info.cache1_entries);
in_uint16_le(s, self->client_info.cache1_size);
@ -864,19 +890,9 @@ xrdp_process_capset_bmpcache2(struct xrdp_rdp* self, struct stream* s,
int Bpp = 0;
int i = 0;
if (self->client_info.bitmap_cache_version < 2)
{
self->client_info.bitmap_cache_version = 2;
}
self->client_info.bitmap_cache_version |= 2;
Bpp = (self->client_info.bpp + 7) / 8;
in_uint16_le(s, i); /* cache flags */
#if defined(XRDP_JPEG)
if (i & 0x80)
{
g_writeln("xrdp_process_capset_bmpcache2: client supports jpeg");
self->client_info.jpeg = 1;
}
#endif
self->client_info.bitmap_cache_persist_enable = i;
in_uint8s(s, 2); /* number of caches in set, 3 */
in_uint32_le(s, i);
@ -901,6 +917,20 @@ xrdp_process_capset_bmpcache2(struct xrdp_rdp* self, struct stream* s,
return 0;
}
/*****************************************************************************/
static int
xrdp_process_capset_cache_v3_codec_id(struct xrdp_rdp* self, struct stream* s,
int len)
{
int codec_id;
in_uint8(s, codec_id);
g_writeln("xrdp_process_capset_cache_v3_codec_id: cache_v3_codec_id %d",
codec_id);
self->client_info.v3_codec_id = codec_id;
return 0;
}
/*****************************************************************************/
/* get the number of client cursor cache */
static int APP_CC
@ -1036,8 +1066,23 @@ xrdp_process_capset_codecs(struct xrdp_rdp* self, struct stream* s, int len)
g_memcpy(self->client_info.rfx_prop, s->p, i1);
self->client_info.rfx_prop_len = i1;
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_JPEG, 16) == 0)
{
g_writeln("xrdp_process_capset_codecs: jpeg codec id %d prop len %d",
codec_id, codec_properties_length);
self->client_info.jpeg_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
g_memcpy(self->client_info.jpeg_prop, s->p, i1);
self->client_info.jpeg_prop_len = i1;
g_writeln(" jpeg quality %d", self->client_info.jpeg_prop[0]);
}
else
{
g_writeln("xrdp_process_capset_codecs: unknown codec id %d", codec_id);
}
s->p = next_guid;
}
return 0;
}
/*****************************************************************************/
@ -1085,6 +1130,9 @@ xrdp_rdp_process_confirm_active(struct xrdp_rdp* self, struct stream* s)
case RDP_CAPSET_CONTROL: /* 5 */
DEBUG(("RDP_CAPSET_CONTROL"));
break;
case 6:
xrdp_process_capset_cache_v3_codec_id(self, s, len);
break;
case RDP_CAPSET_ACTIVATE: /* 7 */
DEBUG(("RDP_CAPSET_ACTIVATE"));
break;

@ -28,7 +28,9 @@ xrdp_chansrv_SOURCES = \
chansrv.c \
sound.c \
clipboard.c \
devredir.c
devredir.c \
rail.c \
xcommon.c
xrdp_chansrv_LDFLAGS = \
$(EXTRA_FLAGS)

@ -1,21 +1,20 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
xrdp: A Remote Desktop Protocol server.
Copyright (C) Jay Sorg 2009-2010
*/
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arch.h"
#include "os_calls.h"
@ -29,7 +28,6 @@
#include "list.h"
#include "file.h"
#include "file_loc.h"
#include "log.h"
static struct trans* g_lis_trans = 0;
static struct trans* g_con_trans = 0;
@ -108,7 +106,7 @@ send_init_response_message(void)
{
struct stream * s = (struct stream *)NULL;
log_message(LOG_LEVEL_INFO,"send_init_response_message:");
LOGM((LOG_LEVEL_INFO,"send_init_response_message:"))
s = trans_get_out_s(g_con_trans, 8192);
if (s == 0)
{
@ -129,7 +127,7 @@ send_channel_setup_response_message(void)
{
struct stream * s = (struct stream *)NULL;
log_message(LOG_LEVEL_DEBUG, "send_channel_setup_response_message:");
LOGM((LOG_LEVEL_DEBUG, "send_channel_setup_response_message:"));
s = trans_get_out_s(g_con_trans, 8192);
if (s == 0)
{
@ -150,7 +148,7 @@ send_channel_data_response_message(void)
{
struct stream * s = (struct stream *)NULL;
log_message(LOG_LEVEL_DEBUG, "send_channel_data_response_message:");
LOGM((LOG_LEVEL_DEBUG, "send_channel_data_response_message:"));
s = trans_get_out_s(g_con_trans, 8192);
if (s == 0)
{
@ -169,7 +167,7 @@ send_channel_data_response_message(void)
static int APP_CC
process_message_init(struct stream* s)
{
log_message(LOG_LEVEL_DEBUG,"process_message_init:");
LOGM((LOG_LEVEL_DEBUG, "process_message_init:"));
return send_init_response_message();
}
@ -190,9 +188,10 @@ process_message_channel_setup(struct stream* s)
g_cliprdr_chan_id = -1;
g_rdpsnd_chan_id = -1;
g_rdpdr_chan_id = -1;
log_message(LOG_LEVEL_DEBUG, "process_message_channel_setup:");
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:"));
in_uint16_le(s, num_chans);
log_message(LOG_LEVEL_DEBUG,"process_message_channel_setup: num_chans %d", num_chans);
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d",
num_chans));
for (index = 0; index < num_chans; index++)
{
ci = &(g_chan_items[g_num_chan_items]);
@ -200,8 +199,8 @@ process_message_channel_setup(struct stream* s)
in_uint8a(s, ci->name, 8);
in_uint16_le(s, ci->id);
in_uint16_le(s, ci->flags);
log_message(LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' "
"id %d flags %8.8x", ci->name, ci->id, ci->flags);
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' "
"id %d flags %8.8x", ci->name, ci->id, ci->flags));
if (g_strcasecmp(ci->name, "cliprdr") == 0)
{
g_cliprdr_index = g_num_chan_items;
@ -250,8 +249,8 @@ process_message_channel_data(struct stream* s)
in_uint16_le(s, chan_flags);
in_uint16_le(s, length);
in_uint32_le(s, total_length);
log_message(LOG_LEVEL_DEBUG,"process_message_channel_data: chan_id %d "
"chan_flags %d", chan_id, chan_flags);
LOGM((LOG_LEVEL_DEBUG,"process_message_channel_data: chan_id %d "
"chan_flags %d", chan_id, chan_flags));
rv = send_channel_data_response_message();
if (rv == 0)
{
@ -322,17 +321,15 @@ process_message(void)
rv = process_message_channel_data_response(s);
break;
default:
log_message(LOG_LEVEL_ERROR, "process_message: error in process_message ",
"unknown msg %d", id);
LOGM((LOG_LEVEL_ERROR, "process_message: error in process_message ",
"unknown msg %d", id));
break;
}
if (rv != 0)
{
break;
}
else {
s->p = next_msg;
}
s->p = next_msg;
}
return rv;
}
@ -355,7 +352,7 @@ my_trans_data_in(struct trans* trans)
{
return 1;
}
log_message(LOG_LEVEL_DEBUG,"my_trans_data_in:");
LOGM((LOG_LEVEL_DEBUG, "my_trans_data_in:"));
s = trans_get_in_s(trans);
in_uint32_le(s, id);
in_uint32_le(s, size);
@ -388,7 +385,7 @@ my_trans_conn_in(struct trans* trans, struct trans* new_trans)
{
return 1;
}
log_message(LOG_LEVEL_DEBUG, "my_trans_conn_in:");
LOGM((LOG_LEVEL_DEBUG, "my_trans_conn_in:"));
g_con_trans = new_trans;
g_con_trans->trans_data_in = my_trans_data_in;
g_con_trans->header_size = 8;
@ -412,7 +409,8 @@ setup_listen(void)
if (g_use_unix_socket)
{
g_lis_trans = trans_create(2, 8192, 8192);
g_snprintf(port, 255, "/tmp/.xrdp/xrdp_chansrv_socket_%d", 7200 + g_display_num);
g_snprintf(port, 255, "/tmp/.xrdp/xrdp_chansrv_socket_%d",
7200 + g_display_num);
}
else
{
@ -423,7 +421,8 @@ setup_listen(void)
error = trans_listen(g_lis_trans, port);
if (error != 0)
{
log_message(LOG_LEVEL_ERROR, "setup_listen: trans_listen failed for port %s", port);
LOGM((LOG_LEVEL_ERROR, "setup_listen: trans_listen failed for port %s",
port));
return 1;
}
return 0;
@ -439,7 +438,7 @@ channel_thread_loop(void* in_val)
int error = 0;
THREAD_RV rv = 0;
log_message(LOG_LEVEL_INFO, "channel_thread_loop: thread start");
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: thread start"));
rv = 0;
error = setup_listen();
if (error == 0)
@ -453,7 +452,7 @@ channel_thread_loop(void* in_val)
{
if (g_is_wait_obj_set(g_term_event))
{
log_message(LOG_LEVEL_INFO, "channel_thread_loop: g_term_event set");
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: g_term_event set"));
clipboard_deinit();
sound_deinit();
dev_redir_deinit();
@ -463,15 +462,16 @@ channel_thread_loop(void* in_val)
{
if (trans_check_wait_objs(g_lis_trans) != 0)
{
log_message(LOG_LEVEL_INFO, "channel_thread_loop: trans_check_wait_objs error");
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: "
"trans_check_wait_objs error"));
}
}
if (g_con_trans != 0)
{
if (trans_check_wait_objs(g_con_trans) != 0)
{
log_message(LOG_LEVEL_INFO, "channel_thread_loop: "
"trans_check_wait_objs error resetting");
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: "
"trans_check_wait_objs error resetting"));
clipboard_deinit();
sound_deinit();
dev_redir_deinit();
@ -504,7 +504,7 @@ channel_thread_loop(void* in_val)
g_lis_trans = 0;
trans_delete(g_con_trans);
g_con_trans = 0;
log_message(LOG_LEVEL_INFO, "channel_thread_loop: thread stop");
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: thread stop"));
g_set_wait_obj(g_thread_done_event);
return rv;
}
@ -513,7 +513,7 @@ channel_thread_loop(void* in_val)
void DEFAULT_CC
term_signal_handler(int sig)
{
log_message(LOG_LEVEL_INFO,"term_signal_handler: got signal %d", sig);
LOGM((LOG_LEVEL_INFO, "term_signal_handler: got signal %d", sig));
g_set_wait_obj(g_term_event);
}
@ -521,7 +521,7 @@ term_signal_handler(int sig)
void DEFAULT_CC
nil_signal_handler(int sig)
{
log_message(LOG_LEVEL_INFO, "nil_signal_handler: got signal %d", sig);
LOGM((LOG_LEVEL_INFO, "nil_signal_handler: got signal %d", sig));
g_set_wait_obj(g_term_event);
}
@ -637,13 +637,16 @@ main(int argc, char** argv)
int pid = 0;
char text[256] = "";
char* display_text = (char *)NULL;
enum logReturns error;
#if XRDP_CHANNEL_LOG
char cfg_file[256];
enum logReturns error;
#endif
g_init("xrdp-chansrv"); /* os_calls */
read_ini();
pid = g_getpid();
#if XRDP_CHANNEL_LOG
/* starting logging subsystem */
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
error = log_start(cfg_file,"XRDP-Chansrv");
@ -665,22 +668,22 @@ main(int argc, char** argv)
g_deinit();
g_exit(1);
}
log_message(LOG_LEVEL_ALWAYS,"main: app started pid %d(0x%8.8x)", pid, pid);
LOGM((LOG_LEVEL_ALWAYS, "main: app started pid %d(0x%8.8x)", pid, pid));
#endif
/* set up signal handler */
g_signal_kill(term_signal_handler); /* SIGKILL */
g_signal_terminate(term_signal_handler); /* SIGTERM */
g_signal_user_interrupt(term_signal_handler); /* SIGINT */
g_signal_pipe(nil_signal_handler); /* SIGPIPE */
display_text = g_getenv("DISPLAY");
log_message(LOG_LEVEL_INFO, "main: DISPLAY env var set to %s", display_text);
LOGM((LOG_LEVEL_INFO, "main: DISPLAY env var set to %s", display_text));
get_display_num_from_display(display_text);
if (g_display_num == 0)
{
log_message(LOG_LEVEL_ERROR, "main: error, display is zero");
LOGM((LOG_LEVEL_ERROR, "main: error, display is zero"));
return 1;
}
log_message(LOG_LEVEL_INFO,"main: using DISPLAY %d", g_display_num);
LOGM((LOG_LEVEL_INFO, "main: using DISPLAY %d", g_display_num));
g_snprintf(text, 255, "xrdp_chansrv_%8.8x_main_term", pid);
g_term_event = g_create_wait_obj(text);
g_snprintf(text, 255, "xrdp_chansrv_%8.8x_thread_done", pid);
@ -690,7 +693,7 @@ main(int argc, char** argv)
{
if (g_obj_wait(&g_term_event, 1, 0, 0, 0) != 0)
{
log_message(LOG_LEVEL_ERROR, "main: error, g_obj_wait failed");
LOGM((LOG_LEVEL_ERROR, "main: error, g_obj_wait failed"));
break;
}
}
@ -699,13 +702,13 @@ main(int argc, char** argv)
/* wait for thread to exit */
if (g_obj_wait(&g_thread_done_event, 1, 0, 0, 0) != 0)
{
log_message(LOG_LEVEL_ERROR, "main: error, g_obj_wait failed");
LOGM((LOG_LEVEL_ERROR, "main: error, g_obj_wait failed"));
break;
}
}
/* cleanup */
main_cleanup();
log_message(LOG_LEVEL_INFO, "main: app exiting pid %d(0x%8.8x)", pid, pid);
LOGM((LOG_LEVEL_INFO, "main: app exiting pid %d(0x%8.8x)", pid, pid));
g_deinit();
return 0;
}

@ -1,3 +1,20 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(CHANSRV_H)
#define CHANSRV_H
@ -5,6 +22,8 @@
#include "arch.h"
#include "parse.h"
#define XRDP_CHANNEL_LOG 0
struct chan_item
{
int id;
@ -28,4 +47,11 @@ main_cleanup(void);
} \
}
#if XRDP_CHANNEL_LOG
#include "log.h"
#define LOGM(_args) do { log_message _args ; } while (0)
#else
#define LOGM(_args)
#endif
#endif

@ -1,25 +1,24 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
xrdp: A Remote Desktop Protocol server.
Copyright (C) Jay Sorg 2009-2010
for help see
http://tronche.com/gui/x/icccm/sec-2.html#s-2
.../kde/kdebase/workspace/klipper/clipboardpoll.cpp
*/
#include <X11/Xlib.h>
@ -29,7 +28,6 @@
#include "parse.h"
#include "os_calls.h"
#include "chansrv.h"
#include "log.h"
#include "clipboard.h"
static Atom g_clipboard_atom = 0;
@ -80,7 +78,7 @@ clipboard_error_handler(Display* dis, XErrorEvent* xer)
char text[256];
XGetErrorText(dis, xer->error_code, text, 255);
log_message(LOG_LEVEL_ERROR,"error [%s]", text);
LOGM((LOG_LEVEL_ERROR,"error [%s]", text));
return 0;
}
@ -91,7 +89,7 @@ clipboard_error_handler(Display* dis, XErrorEvent* xer)
int DEFAULT_CC
clipboard_fatal_handler(Display* dis)
{
log_message(LOG_LEVEL_ALWAYS,"fatal error, exiting");
LOGM((LOG_LEVEL_ALWAYS, "fatal error, exiting"));
main_cleanup();
return 0;
}
@ -141,7 +139,7 @@ clipboard_init(void)
int ver_min;
Status st;
log_message(LOG_LEVEL_DEBUG,"xrdp-chansrv: in clipboard_init");
LOGM((LOG_LEVEL_DEBUG, "xrdp-chansrv: in clipboard_init"));
if (g_clip_up)
{
return 0;
@ -155,7 +153,7 @@ clipboard_init(void)
g_display = XOpenDisplay(0);
if (g_display == 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: XOpenDisplay failed");
LOGM((LOG_LEVEL_ERROR, "clipboard_init: XOpenDisplay failed"));
rv = 1;
}
if (rv == 0)
@ -163,7 +161,7 @@ clipboard_init(void)
g_x_socket = XConnectionNumber(g_display);
if (g_x_socket == 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: XConnectionNumber failed");
LOGM((LOG_LEVEL_ERROR, "clipboard_init: XConnectionNumber failed"));
rv = 2;
}
g_x_wait_obj = g_create_wait_obj_from_socket(g_x_socket, 0);
@ -173,7 +171,7 @@ clipboard_init(void)
g_clipboard_atom = XInternAtom(g_display, "CLIPBOARD", False);
if (g_clipboard_atom == None)
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: XInternAtom failed");
LOGM((LOG_LEVEL_ERROR, "clipboard_init: XInternAtom failed"));
rv = 3;
}
}
@ -181,15 +179,17 @@ clipboard_init(void)
{
if (!XFixesQueryExtension(g_display, &g_xfixes_event_base, &dummy))
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: no xfixes");
LOGM((LOG_LEVEL_ERROR, "clipboard_init: no xfixes"));
rv = 5;
}
}
if (rv == 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: g_xfixes_event_base %d", g_xfixes_event_base);
LOGM((LOG_LEVEL_ERROR, "clipboard_init: g_xfixes_event_base %d",
g_xfixes_event_base));
st = XFixesQueryVersion(g_display, &ver_maj, &ver_min);
log_message(LOG_LEVEL_ERROR,"clipboard_init st %d, maj %d min %d", st, ver_maj, ver_min);
LOGM((LOG_LEVEL_ERROR, "clipboard_init st %d, maj %d min %d", st,
ver_maj, ver_min));
g_screen_num = DefaultScreen(g_display);
g_screen = ScreenOfDisplay(g_display, g_screen_num);
g_clip_property_atom = XInternAtom(g_display, "XRDP_CLIP_PROPERTY_ATOM",
@ -223,13 +223,13 @@ clipboard_init(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
log_message(LOG_LEVEL_DEBUG,"clipboard_init: data out, sending "
"CLIPRDR_CONNECT (clip_msg_id = 1)");
LOGM((LOG_LEVEL_DEBUG, "clipboard_init: data out, sending "
"CLIPRDR_CONNECT (clip_msg_id = 1)"));
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
if (rv != 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_init: send_channel_data failed "
"rv = %d", rv);
LOGM((LOG_LEVEL_ERROR, "clipboard_init: send_channel_data failed "
"rv = %d", rv));
rv = 4;
}
free_stream(s);
@ -242,7 +242,7 @@ clipboard_init(void)
}
else
{
log_message(LOG_LEVEL_ERROR,"xrdp-chansrv: clipboard_init: error on exit");
LOGM((LOG_LEVEL_ERROR, "xrdp-chansrv: clipboard_init: error on exit"));
}
return rv;
}
@ -284,10 +284,11 @@ clipboard_send_data_request(void)
int size;
int rv;
log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_request:");
LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_request:"));
if (!g_got_format_announce)
{
log_message(LOG_LEVEL_ERROR,"clipboard_send_data_request: error, no format announce");
LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_request: error, "
"no format announce"));
return 0;
}
g_got_format_announce = 0;
@ -299,8 +300,8 @@ clipboard_send_data_request(void)
out_uint32_le(s, 0x0d);
s_mark_end(s);
size = (int)(s->end - s->data);
log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_request: data out, sending "
"CLIPRDR_DATA_REQUEST (clip_msg_id = 4)");
LOGM((LOG_LEVEL_DEBUG,"clipboard_send_data_request: data out, sending "
"CLIPRDR_DATA_REQUEST (clip_msg_id = 4)"));
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@ -322,8 +323,8 @@ clipboard_send_format_ack(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
log_message(LOG_LEVEL_DEBUG,"clipboard_send_format_ack: data out, sending "
"CLIPRDR_FORMAT_ACK (clip_msg_id = 3)");
LOGM((LOG_LEVEL_DEBUG,"clipboard_send_format_ack: data out, sending "
"CLIPRDR_FORMAT_ACK (clip_msg_id = 3)"));
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@ -346,8 +347,8 @@ clipboard_send_format_announce(void)
out_uint8s(s, 0x90);
s_mark_end(s);
size = (int)(s->end - s->data);
log_message(LOG_LEVEL_DEBUG,"clipboard_send_format_announce: data out, sending "
"CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)");
LOGM((LOG_LEVEL_DEBUG,"clipboard_send_format_announce: data out, sending "
"CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)"));
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@ -401,7 +402,7 @@ clipboard_send_data_response(void)
num_chars = g_mbstowcs(0, g_last_clip_data, 0);
if (num_chars < 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_send_data_response: bad string");
LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_response: bad string"));
num_chars = 0;
}
}
@ -415,16 +416,16 @@ clipboard_send_data_response(void)
out_uint32_le(s, num_chars * 2 + 2); /* length */
if (clipboard_out_unicode(s, g_last_clip_data, num_chars) != num_chars * 2)
{
log_message(LOG_LEVEL_ERROR,"clipboard_send_data_response: error "
"clipboard_out_unicode didn't write right number of bytes");
LOGM((LOG_LEVEL_ERROR,"clipboard_send_data_response: error "
"clipboard_out_unicode didn't write right number of bytes"));
}
out_uint16_le(s, 0); /* nil for string */
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_response: data out, sending "
"CLIPRDR_DATA_RESPONSE (clip_msg_id = 5) size %d num_chars %d",
size, num_chars);
LOGM((LOG_LEVEL_DEBUG,"clipboard_send_data_response: data out, sending "
"CLIPRDR_DATA_RESPONSE (clip_msg_id = 5) size %d num_chars %d",
size, num_chars));
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@ -494,14 +495,16 @@ static int APP_CC
clipboard_process_format_announce(struct stream* s, int clip_msg_status,
int clip_msg_len)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_process_format_announce: CLIPRDR_FORMAT_ANNOUNCE");
LOGM((LOG_LEVEL_DEBUG, "clipboard_process_format_announce: "
"CLIPRDR_FORMAT_ANNOUNCE"));
//g_hexdump(s->p, s->end - s->p);
clipboard_send_format_ack();
g_got_format_announce = 1;
g_data_in_up_to_date = 0;
if (clipboard_set_selection_owner() != 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_process_format_announce: XSetSelectionOwner failed");
LOGM((LOG_LEVEL_ERROR, "clipboard_process_format_announce: "
"XSetSelectionOwner failed"));
}
return 0;
}
@ -511,7 +514,7 @@ static int APP_CC
clipboard_prcoess_format_ack(struct stream* s, int clip_msg_status,
int clip_msg_len)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK");
LOGM((LOG_LEVEL_DEBUG,"clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK"));
//g_hexdump(s->p, s->end - s->p);
return 0;
}
@ -521,7 +524,8 @@ static int APP_CC
clipboard_process_data_request(struct stream* s, int clip_msg_status,
int clip_msg_len)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_request: CLIPRDR_DATA_REQUEST");
LOGM((LOG_LEVEL_DEBUG,"clipboard_process_data_request: "
"CLIPRDR_DATA_REQUEST"));
//g_hexdump(s->p, s->end - s->p);
clipboard_send_data_response();
return 0;
@ -539,7 +543,8 @@ clipboard_process_data_response(struct stream* s, int clip_msg_status,
int index;
int data_in_len;
log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_response: CLIPRDR_DATA_RESPONSE");
LOGM((LOG_LEVEL_DEBUG,"clipboard_process_data_response: "
"CLIPRDR_DATA_RESPONSE"));
g_waiting_for_data_response = 0;
len = (int)(s->end - s->p);
if (len < 1)
@ -590,8 +595,8 @@ clipboard_process_data_response(struct stream* s, int clip_msg_status,
lxev = &(g_selection_request_event[index]);
clipboard_provide_selection(lxev, lxev->target, 8, g_data_in,
data_in_len);
log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_response: requestor %d data_in_len %d",
lxev->requestor, data_in_len);
LOGM((LOG_LEVEL_DEBUG,"clipboard_process_data_response: requestor %d "
"data_in_len %d", lxev->requestor, data_in_len));
}
}
g_selection_request_event_count = 0;
@ -657,7 +662,8 @@ clipboard_data_in(struct stream* s, int chan_id, int chan_flags, int length,
clip_msg_len);
break;
default:
log_message(LOG_LEVEL_ERROR,"clipboard_data_in: unknown clip_msg_id %d", clip_msg_id);
LOGM((LOG_LEVEL_ERROR, "clipboard_data_in: unknown clip_msg_id %d",
clip_msg_id));
break;
}
XFlush(g_display);
@ -685,13 +691,13 @@ clipboard_event_selection_owner_notify(XEvent* xevent)
XFixesSelectionNotifyEvent* lxevent;
lxevent = (XFixesSelectionNotifyEvent*)xevent;
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_owner_notify: "
"window %d subtype %d owner %d g_wnd %d",
lxevent->window, lxevent->subtype, lxevent->owner, g_wnd);
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: "
"window %d subtype %d owner %d g_wnd %d",
lxevent->window, lxevent->subtype, lxevent->owner, g_wnd));
if (lxevent->owner == g_wnd)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_owner_notify: skipping, "
"onwer == g_wnd");
LOGM((LOG_LEVEL_DEBUG,"clipboard_event_selection_owner_notify: skipping, "
"onwer == g_wnd"));
g_got_selection = 1;
return 0;
}
@ -811,7 +817,10 @@ clipboard_event_selection_notify(XEvent* xevent)
int* atoms;
Atom type;
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_notify:");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify:"));
data_size = 0;
n_items = 0;
fmt = 0;
convert_to_string = 0;
convert_to_utf8 = 0;
send_format_announce = 0;
@ -821,8 +830,8 @@ clipboard_event_selection_notify(XEvent* xevent)
lxevent = (XSelectionEvent*)xevent;
if (lxevent->property == None)
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_notify: clip could "
"not be converted");
LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: clip could "
"not be converted"));
rv = 1;
}
if (rv == 0)
@ -832,8 +841,8 @@ clipboard_event_selection_notify(XEvent* xevent)
&n_items, &data, &data_size);
if (rv != 0)
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_notify: "
"clipboard_get_window_property failed error %d", rv);
LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
"clipboard_get_window_property failed error %d", rv));
}
XDeleteProperty(g_display, lxevent->requestor, lxevent->property);
}
@ -849,8 +858,8 @@ clipboard_event_selection_notify(XEvent* xevent)
for (index = 0; index < n_items; index++)
{
atom = atoms[index];
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_notify: %d %s %d", atom,
XGetAtomName(g_display, atom), XA_STRING);
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d",
atom, XGetAtomName(g_display, atom), XA_STRING));
if (atom == g_utf8_atom)
{
convert_to_utf8 = 1;
@ -863,15 +872,15 @@ clipboard_event_selection_notify(XEvent* xevent)
}
else
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_notify: error, target is "
"'TARGETS' and type[%d] or fmt[%d] not right, should be "
"type[%d], fmt[%d]", type, fmt, XA_ATOM, 32);
LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: error, "
"target is 'TARGETS' and type[%d] or fmt[%d] not right, "
"should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32));
}
}
else if (lxevent->target == g_utf8_atom)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_notify: UTF8_STRING data_size %d",
data_size);
LOGM((LOG_LEVEL_DEBUG,"clipboard_event_selection_notify: UTF8_STRING "
"data_size %d", data_size));
g_free(g_last_clip_data);
g_last_clip_size = data_size;
g_last_clip_data = g_malloc(g_last_clip_size + 1, 0);
@ -882,8 +891,8 @@ clipboard_event_selection_notify(XEvent* xevent)
}
else if (lxevent->target == XA_STRING)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_notify: XA_STRING data_size %d",
data_size);
LOGM((LOG_LEVEL_DEBUG,"clipboard_event_selection_notify: XA_STRING "
"data_size %d", data_size));
g_free(g_last_clip_data);
g_last_clip_size = data_size;
g_last_clip_data = g_malloc(g_last_clip_size + 1, 0);
@ -894,12 +903,14 @@ clipboard_event_selection_notify(XEvent* xevent)
}
else
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_notify: unknown target");
LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
"unknown target"));
}
}
else
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_notify: unknown selection");
LOGM((LOG_LEVEL_ERROR,"clipboard_event_selection_notify: "
"unknown selection"));
}
}
if (convert_to_utf8)
@ -941,7 +952,7 @@ clipboard_event_selection_notify(XEvent* xevent)
static int APP_CC
clipboard_event_selection_request(XEvent* xevent)
{
XEvent xev;
//XEvent xev;
XSelectionRequestEvent* lxev;
tui32 ui32[8];
Atom type;
@ -951,19 +962,21 @@ clipboard_event_selection_request(XEvent* xevent)
char* xdata;
lxev = (XSelectionRequestEvent*)xevent;
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: g_wnd %d, "
".requestor %d .owner %d .selection %d '%s' .target %d .property %d",
g_wnd, lxev->requestor, lxev->owner, lxev->selection,
XGetAtomName(g_display, lxev->selection),
lxev->target, lxev->property);
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_wnd %d, "
".requestor %d .owner %d .selection %d '%s' .target %d .property %d",
g_wnd, lxev->requestor, lxev->owner, lxev->selection,
XGetAtomName(g_display, lxev->selection),
lxev->target, lxev->property));
if (lxev->property == None)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: lxev->property is None");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
"lxev->property is None"));
}
else if (lxev->target == g_targets_atom)
{
/* requestor is asking what the selection can be converted to */
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: g_targets_atom");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
"g_targets_atom"));
ui32[0] = g_targets_atom;
ui32[1] = g_timestamp_atom;
ui32[2] = g_multiple_atom;
@ -974,29 +987,33 @@ clipboard_event_selection_request(XEvent* xevent)
else if (lxev->target == g_timestamp_atom)
{
/* requestor is asking the time I got the selection */
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: g_timestamp_atom");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
"g_timestamp_atom"));
ui32[0] = g_selection_time;
return clipboard_provide_selection(lxev, XA_INTEGER, 32, (char*)ui32, 1);
}
else if (lxev->target == g_multiple_atom)
{
/* target, property pairs */
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: g_multiple_atom");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
"g_multiple_atom"));
#if 0
if (clipboard_get_window_property(xev.xselection.requestor,
xev.xselection.property,
&type, &fmt, &n_items, &xdata,
&xdata_size) == 0)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: g_multiple_atom "
"n_items %d", n_items);
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_multiple_atom "
"n_items %d", n_items));
/* todo */
g_free(xdata);
}
#endif
}
else if ((lxev->target == XA_STRING) || (lxev->target == g_utf8_atom))
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_request: %s",
XGetAtomName(g_display, lxev->target));
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: %s",
XGetAtomName(g_display, lxev->target)));
if (g_data_in_up_to_date)
{
return clipboard_provide_selection(lxev, lxev->target, 8,
@ -1004,7 +1021,8 @@ clipboard_event_selection_request(XEvent* xevent)
}
if (g_selection_request_event_count > 10)
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_request: error, too many requests");
LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_request: error, "
"too many requests"));
}
else
{
@ -1022,8 +1040,8 @@ clipboard_event_selection_request(XEvent* xevent)
}
else
{
log_message(LOG_LEVEL_ERROR,"clipboard_event_selection_request: unknown "
"target %s", XGetAtomName(g_display, lxev->target));
LOGM((LOG_LEVEL_ERROR,"clipboard_event_selection_request: unknown "
"target %s", XGetAtomName(g_display, lxev->target)));
}
clipboard_refuse_selection(lxev);
return 0;
@ -1044,7 +1062,7 @@ clipboard_event_selection_request(XEvent* xevent)
static int APP_CC
clipboard_event_selection_clear(XEvent* xevent)
{
log_message(LOG_LEVEL_DEBUG,"clipboard_event_selection_clear:");
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_clear:"));
return 0;
}
@ -1105,7 +1123,7 @@ clipboard_check_wait_objs(void)
if (XPending(g_display) < 1)
{
/* something is wrong, should not get here */
log_message(LOG_LEVEL_ERROR,"clipboard_check_wait_objs: sck closed");
LOGM((LOG_LEVEL_ERROR, "clipboard_check_wait_objs: sck closed"));
return 0;
}
if (g_waiting_for_data_response)
@ -1114,8 +1132,8 @@ clipboard_check_wait_objs(void)
g_waiting_for_data_response_time;
if (time_diff > 1000)
{
log_message(LOG_LEVEL_ERROR,"clipboard_check_wait_objs: warning, waiting for "
"data response too long");
LOGM((LOG_LEVEL_ERROR, "clipboard_check_wait_objs: warning, "
"waiting for data response too long"));
}
}
while (XPending(g_display) > 0)
@ -1144,8 +1162,8 @@ clipboard_check_wait_objs(void)
clipboard_event_selection_owner_notify(&xevent);
break;
}
log_message(LOG_LEVEL_ERROR,"clipboard_check_wait_objs unknown type %d",
xevent.type);
LOGM((LOG_LEVEL_ERROR, "clipboard_check_wait_objs unknown type %d",
xevent.type));
break;
}
}

@ -1,3 +1,20 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(CLIPBOARD_H)
#define CLIPBOARD_H

@ -1,21 +1,20 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
xrdp: A Remote Desktop Protocol server.
Copyright (C) Jay Sorg 2009-2010
*/
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arch.h"
#include "parse.h"

@ -1,3 +1,20 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2009-2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(DEVREDIR_H)
#define DEVREDIR_H

@ -0,0 +1,27 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
window manager info
http://www.freedesktop.org/wiki/Specifications/wm-spec
*/
#include <X11/Xlib.h>
#include "rail.h"
#include "xcommon.h"
#include "log.h"

@ -0,0 +1,22 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _RAIL_H_
#define _RAIL_H_
#endif

@ -17,6 +17,7 @@
*/
#include "sound.h"
#include "thread_calls.h"
extern int g_rdpsnd_chan_id; /* in chansrv.c */
extern int g_display_num; /* in chansrv.c */
@ -26,6 +27,11 @@ static struct trans *g_audio_c_trans = 0; // connection
static int g_training_sent_time = 0;
static int g_cBlockNo = 0;
#if defined(XRDP_SIMPLESOUND)
static void* DEFAULT_CC
read_raw_audio_data(void* arg);
#endif
/*****************************************************************************/
static int APP_CC
sound_send_server_formats(void)
@ -164,7 +170,7 @@ sound_send_wave_data(char* data, int data_bytes)
/* part one of 2 PDU wave info */
LOG(3, ("sound_send_wave_data: sending %d bytes", data_bytes));
LOG(10, ("sound_send_wave_data: sending %d bytes", data_bytes));
make_stream(s);
init_stream(s, data_bytes);
@ -177,7 +183,7 @@ sound_send_wave_data(char* data, int data_bytes)
g_cBlockNo++;
out_uint8(s, g_cBlockNo);
LOG(3, ("sound_send_wave_data: sending time %d, g_cBlockNo %d",
LOG(10, ("sound_send_wave_data: sending time %d, g_cBlockNo %d",
time & 0xffff, g_cBlockNo & 0xff));
out_uint8s(s, 3);
@ -227,7 +233,7 @@ sound_process_wave_confirm(struct stream* s, int size)
in_uint16_le(s, wTimeStamp);
in_uint8(s, cConfirmedBlockNo);
LOG(3, ("sound_process_wave_confirm: wTimeStamp %d, cConfirmedBlockNo %d",
LOG(10, ("sound_process_wave_confirm: wTimeStamp %d, cConfirmedBlockNo %d",
wTimeStamp, cConfirmedBlockNo));
return 0;
@ -330,9 +336,8 @@ sound_init(void)
#if defined(XRDP_SIMPLESOUND)
// start thread to read raw audio data from pulseaudio device
pthread_create(&thread, 0, read_raw_audio_data, NULL);
pthread_detach(thread);
/* start thread to read raw audio data from pulseaudio device */
tc_thread_create(read_raw_audio_data, 0);
#endif
@ -434,113 +439,114 @@ sound_check_wait_objs(void)
#if defined(XRDP_SIMPLESOUND)
static int DEFAULT_CC
sttrans_data_in(struct trans* self)
{
LOG(0, ("sttrans_data_in:\n"));
return 0;
}
/**
* read raw audio data from pulseaudio device and write it
* to a unix domain socket on which trans server is listening
*/
static void *
static void* DEFAULT_CC
read_raw_audio_data(void* arg)
{
struct sockaddr_un serv_addr;
pa_sample_spec samp_spec;
pa_simple* simple = NULL;
uint32_t bytes_read;
uint8_t audio_buf[AUDIO_BUF_SIZE + 8];
char* cptr;
int i;
int error;
int skt_fd;
struct trans* strans;
char path[256];
struct stream* outs;
// create client socket
if ((skt_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
strans = trans_create(TRANS_MODE_UNIX, 8192, 8192);
if (strans == 0)
{
LOG(0, ("read_raw_audio_data: error creating unix domain socket\n"));
return NULL;
LOG(0, ("read_raw_audio_data: trans_create failed\n"));
return 0;
}
// setup server address and bind to it
memset(&serv_addr, 0, sizeof(struct sockaddr_un));
serv_addr.sun_family = AF_UNIX;
g_snprintf(serv_addr.sun_path, 255, "/tmp/xrdp_chansrv_audio_socket_%d", g_display_num);
if (connect(skt_fd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr_un)) < 0)
strans->trans_data_in = sttrans_data_in;
g_snprintf(path, 255, "/tmp/xrdp_chansrv_audio_socket_%d", g_display_num);
if (trans_connect(strans, "", path, 100) != 0)
{
LOG(0, ("read_raw_audio_data: error connecting to server\n"));
close(skt_fd);
return NULL;
LOG(0, ("read_raw_audio_data: trans_connect failed\n"));
trans_delete(strans);
return 0;
}
// setup audio format
/* setup audio format */
samp_spec.format = PA_SAMPLE_S16LE;
samp_spec.rate = 44100;
samp_spec.channels = 2;
// if we are root, then for first 8 seconds connection to pulseaudo server
// fails; if we are non-root, then connection succeeds on first attempt;
// for now we have changed code to be non-root, but this may change in the
// future - so pretend we are root and try connecting to pulseaudio server
// for upto one minute
/* if we are root, then for first 8 seconds connection to pulseaudo server
fails; if we are non-root, then connection succeeds on first attempt;
for now we have changed code to be non-root, but this may change in the
future - so pretend we are root and try connecting to pulseaudio server
for upto one minute */
for (i = 0; i < 60; i++)
{
simple = pa_simple_new(NULL, "xrdp", PA_STREAM_RECORD, NULL,
"record", &samp_spec, NULL, NULL, &error);
if (simple)
{
// connected to pulseaudio server
/* connected to pulseaudio server */
LOG(0, ("read_raw_audio_data: connected to pulseaudio server\n"));
break;
}
LOG(0, ("read_raw_audio_data: ERROR creating PulseAudio async interface\n"));
LOG(0, ("read_raw_audio_data: %s\n", pa_strerror(error)));
sleep(1);
g_sleep(1000);
}
if (i == 60)
{
// failed to connect to audio server
close(skt_fd);
/* failed to connect to audio server */
trans_delete(strans);
return NULL;
}
// insert header just once
cptr = audio_buf;
ins_uint32_le(cptr, 0);
ins_uint32_le(cptr, AUDIO_BUF_SIZE + 8);
/* insert header just once */
outs = trans_get_out_s(strans, 8192);
out_uint32_le(outs, 0);
out_uint32_le(outs, AUDIO_BUF_SIZE + 8);
cptr = outs->p;
out_uint8s(outs, AUDIO_BUF_SIZE);
s_mark_end(outs);
while (1)
{
// read a block of raw audio data...
if ((bytes_read = pa_simple_read(simple, cptr, AUDIO_BUF_SIZE, &error)) < 0)
/* read a block of raw audio data... */
g_memset(cptr, 0, 4);
bytes_read = pa_simple_read(simple, cptr, AUDIO_BUF_SIZE, &error);
if (bytes_read < 0)
{
LOG(0, ("read_raw_audio_data: ERROR reading from pulseaudio stream\n"));
LOG(0, ("read_raw_audio_data: %s\n", pa_strerror(error)));
break;
}
// bug workaround:
// even when there is no audio data, pulseaudio is returning without
// errors but the data itself is zero; we use this zero data to
// determine that there is no audio data present
/* bug workaround:
even when there is no audio data, pulseaudio is returning without
errors but the data itself is zero; we use this zero data to
determine that there is no audio data present */
if (*cptr == 0 && *(cptr + 1) == 0 && *(cptr + 2) == 0 && *(cptr + 3) == 0)
{
usleep(10000);
g_sleep(10);
continue;
}
// ... and write it to a unix domain socket
if (write(skt_fd, audio_buf, AUDIO_BUF_SIZE + 8) < 0)
if (trans_force_write_s(strans, outs) != 0)
{
LOG(0, ("read_raw_audio_data: ERROR writing audio data to server\n"));
break;
}
}
done:
pa_simple_free(simple);
close(skt_fd);
trans_delete(strans);
return NULL;
}

@ -19,9 +19,6 @@
#ifndef _SOUND_H_
#define _SOUND_H_
#include <sys/socket.h>
#include <sys/un.h>
#if defined(XRDP_SIMPLESOUND)
#include <pulse/simple.h>
#include <pulse/error.h>
@ -43,29 +40,6 @@
#define print_got_here()
#endif
/**
* insert a uint32_t value into specified byte array
*
* @param p pointer to byte array
* @param v value to insert into byte array
*/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define ins_uint32_le(p, v) \
{ \
*p++ = (unsigned char) v; \
*p++ = (unsigned char) (v >> 8); \
*p++ = (unsigned char) (v >> 16); \
*p++ = (unsigned char) (v >> 24); \
}
#else
#define ins_uint32_le(p, v) \
{ \
*((uint32_t *) p) = v; \
p += 4; \
}
#endif
#define AUDIO_BUF_SIZE 2048
#define SNDC_CLOSE 0x01
@ -93,9 +67,4 @@ int APP_CC
sound_data_in(struct stream* s, int chan_id, int chan_flags,
int length, int total_length);
#if defined(XRDP_SIMPLESOUND)
static void*
read_raw_audio_data(void* arg);
#endif
#endif

@ -0,0 +1,27 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <X11/Xlib.h>
#include "arch.h"
#include "parse.h"
#include "os_calls.h"
#include "chansrv.h"
#include "log.h"
#include "clipboard.h"
#include "rail.h"

@ -0,0 +1,34 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XCOMMON_H)
#define XCOMMON_H
#include "arch.h"
#include "parse.h"
int APP_CC
xcommon_init(void);
int APP_CC
xcommon_get_local_time(void);
int APP_CC
xcommon_get_wait_objs(tbus* objs, int* count, int* timeout);
int APP_CC
xcommon_check_wait_objs(void);
#endif

@ -214,7 +214,7 @@ x_server_running(int display)
/******************************************************************************/
static void DEFAULT_CC
session_start_sessvc(int xpid, int wmpid, long data)
session_start_sessvc(int xpid, int wmpid, long data, char* username, int display)
{
struct list * sessvc_params = (struct list *)NULL;
char wmpid_str[25];
@ -245,6 +245,8 @@ session_start_sessvc(int xpid, int wmpid, long data)
list_add_item(sessvc_params, (long)g_strdup(wmpid_str));
list_add_item(sessvc_params, 0); /* mandatory */
env_set_user(username, 0, display);
/* executing sessvc */
g_execvp(exe_path, ((char**)sessvc_params->items));
@ -593,7 +595,7 @@ session_start_fork(int width, int height, int bpp, char* username,
g_snprintf(text, 255, ":%d.0", display);
g_setenv("DISPLAY", text, 1);
/* new style waiting for clients */
session_start_sessvc(xpid, wmpid, data);
session_start_sessvc(xpid, wmpid, data, username, display);
}
}
}

@ -6,13 +6,13 @@
# Authors
# Jay Sorg Jay.Sorg@gmail.com
# Laxmikant Rashinkar LK.Rashinkar@gmail.com
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -27,6 +27,11 @@ download_file()
{
file=$1
# if we already have the file, don't re-download it
if [ -r downloads/$file ]; then
return 0
fi
cd downloads
echo "downloading file $file"
@ -145,24 +150,16 @@ remove_modules()
cd ..
}
make_it()
extract_it()
{
mod_file=$1
mod_name=$2
mod_args=$3
count=`expr $count + 1`
# if a cookie with $mod_name exists...
if [ -e cookies/$mod_name ]; then
# ...package has already been built
if [ -e cookies/$mod_name.extracted ]; then
return 0
fi
echo ""
echo "*** processing module $mod_name ($count of $num_modules) ***"
echo ""
# download file
download_file $mod_file
if [ $? -ne 0 ]; then
@ -202,17 +199,51 @@ make_it()
exit 1
fi
# make module
make
cd ../..
touch cookies/$mod_name.extracted
}
make_it()
{
mod_file=$1
mod_name=$2
mod_args=$3
count=`expr $count + 1`
# if a cookie with $mod_name exists...
if [ -e cookies/$mod_name.installed ]; then
# ...package has already been installed
return 0
fi
echo ""
echo "*** processing module $mod_name ($count of $num_modules) ***"
echo ""
extract_it $mod_file $mod_name $mod_args
if [ $? -ne 0 ]; then
echo ""
echo "make failed for module $mod_name"
echo "extract failed for module $mod_name"
echo ""
exit 1
fi
# make module
if [ ! -e cookies/$mod_name.made ]; then
(cd build_dir/$mod_name ; make)
if [ $? -ne 0 ]; then
echo ""
echo "make failed for module $mod_name"
echo ""
exit 1
fi
touch cookies/$mod_name.made
fi
# install module
make install
(cd build_dir/$mod_name ; make install)
if [ $? -ne 0 ]; then
echo ""
echo "make install failed for module $mod_name"
@ -224,12 +255,11 @@ make_it()
# so Mesa builds using this python version
case "$mod_name" in
*Python-2*)
ln -s python $PREFIX_DIR/bin/python2
(cd build_dir/$mod_name ; ln -s python $PREFIX_DIR/bin/python2)
;;
esac
cd ../..
touch cookies/$mod_name
touch cookies/$mod_name.installed
return 0
}
@ -281,11 +311,9 @@ fi
echo "using $PREFIX_DIR"
export PKG_CONFIG_PATH=$PREFIX_DIR/lib/pkgconfig:$PREFIX_DIR/share/pkgconfig
export PATH=$PREFIX_DIR/bin:$PATH
# really only needed for x84
export CFLAGS=-fPIC
export LDFLAGS=-Wl,-rpath=$PREFIX_DIR/lib
export CFLAGS="-I$PREFIX_DIR/include -fPIC -O2"
# prefix dir must exist...
if [ ! -d $PREFIX_DIR ]; then
@ -347,6 +375,10 @@ export X11RDPBASE
cd rdp
make
if [ $? -ne 0 ]; then
echo "error building rdp"
exit 1
fi
# this will copy the build X server with the other X server binaries
strip X11rdp

@ -1,41 +1,5 @@
Python-2.7.tar.bz2 : Python-2.7 :
util-macros-1.11.0.tar.bz2 : util-macros-1.11.0 :
font-adobe-75dpi-1.0.3.tar.bz2 : font-adobe-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-100dpi-1.0.3.tar.bz2 : font-adobe-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-75dpi-1.0.4.tar.bz2 : font-adobe-utopia-75dpi-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-100dpi-1.0.4.tar.bz2 : font-adobe-utopia-100dpi-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-type1-1.0.4.tar.bz2 : font-adobe-utopia-type1-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-alias-1.0.3.tar.bz2 : font-alias-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-arabic-misc-1.0.3.tar.bz2 : font-arabic-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-75dpi-1.0.3.tar.bz2 : font-bh-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-100dpi-1.0.3.tar.bz2 : font-bh-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-lucidatypewriter-75dpi-1.0.3.tar.bz2 : font-bh-lucidatypewriter-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-lucidatypewriter-100dpi-1.0.3.tar.bz2 : font-bh-lucidatypewriter-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-ttf-1.0.3.tar.bz2 : font-bh-ttf-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-type1-1.0.3.tar.bz2 : font-bh-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-75dpi-1.0.3.tar.bz2 : font-bitstream-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-100dpi-1.0.3.tar.bz2 : font-bitstream-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-type1-1.0.3.tar.bz2 : font-bitstream-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-cronyx-cyrillic-1.0.3.tar.bz2 : font-cronyx-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-cursor-misc-1.0.3.tar.bz2 : font-cursor-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-daewoo-misc-1.0.3.tar.bz2 : font-daewoo-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-dec-misc-1.0.3.tar.bz2 : font-dec-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-ibm-type1-1.0.3.tar.bz2 : font-ibm-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-isas-misc-1.0.3.tar.bz2 : font-isas-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-jis-misc-1.0.3.tar.bz2 : font-jis-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-micro-misc-1.0.3.tar.bz2 : font-micro-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-cyrillic-1.0.3.tar.bz2 : font-misc-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-ethiopic-1.0.3.tar.bz2 : font-misc-ethiopic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-meltho-1.0.3.tar.bz2 : font-misc-meltho-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-misc-1.1.2.tar.bz2 : font-misc-misc-1.1.2 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-mutt-misc-1.0.3.tar.bz2 : font-mutt-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-schumacher-misc-1.1.2.tar.bz2 : font-schumacher-misc-1.1.2 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-screen-cyrillic-1.0.4.tar.bz2 : font-screen-cyrillic-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-sony-misc-1.0.3.tar.bz2 : font-sony-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-sun-misc-1.0.3.tar.bz2 : font-sun-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-util-1.2.0.tar.bz2 : font-util-1.2.0 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-winitzki-cyrillic-1.0.3.tar.bz2 : font-winitzki-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-xfree86-type1-1.0.4.tar.bz2 : font-xfree86-type1-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
xf86driproto-2.1.0.tar.bz2 : xf86driproto-2.1.0 :
dri2proto-2.3.tar.bz2 : dri2proto-2.3 :
glproto-1.4.12.tar.bz2 : glproto-1.4.12 :
@ -43,7 +7,6 @@ libpciaccess-0.12.0.tar.bz2 : libpciaccess-0.12.0
libpthread-stubs-0.3.tar.bz2 : libpthread-stubs-0.3 :
libdrm-2.4.26.tar.bz2 : libdrm-2.4.26 :
damageproto-1.2.1.tar.bz2 : damageproto-1.2.1 :
libXdamage-1.1.3.tar.bz2 : libXdamage-1.1.3 :
makedepend-1.0.3.tar.bz2 : makedepend-1.0.3 :
libxml2-sources-2.7.8.tar.gz : libxml2-2.7.8 :
libpng-1.2.46.tar.gz : libpng-1.2.46 :
@ -62,6 +25,8 @@ libXext-1.2.0.tar.bz2 : libXext-1.2.0
libICE-1.0.7.tar.bz2 : libICE-1.0.7 :
libSM-1.2.0.tar.bz2 : libSM-1.2.0 :
libXt-1.0.9.tar.bz2 : libXt-1.0.9 :
libXdamage-1.1.3.tar.bz2 : libXdamage-1.1.3 :
libXfixes-4.0.5.tar.bz2 : libXfixes-4.0.5 :
MesaLib-7.10.3.tar.bz2 : Mesa-7.10.3 : --with-expat=$PREFIX_DIR --disable-gallium
randrproto-1.3.2.tar.bz2 : randrproto-1.3.2 :
renderproto-0.11.1.tar.bz2 : renderproto-0.11.1 :
@ -93,9 +58,45 @@ libXaw-1.0.8.tar.bz2 : libXaw-1.0.8
mkfontdir-1.0.6.tar.bz2 : mkfontdir-1.0.6 :
mkfontscale-1.0.8.tar.bz2 : mkfontscale-1.0.8 :
xkbcomp-1.2.0.tar.bz2 : xkbcomp-1.2.0 :
xdriinfo-1.0.4.tar.bz2 : xdriinfo-1.0.4 : LDFLAGS=-Wl,-rpath=$PREFIX_DIR/lib
xdriinfo-1.0.4.tar.bz2 : xdriinfo-1.0.4 :
xorg-server-1.9.3.tar.bz2 : xorg-server-1.9.3 : --with-sha1=libcrypto --disable-dmx
applewmproto-1.4.1.tar.bz2 : applewmproto-1.4.1 :
bdftopcf-1.0.3.tar.bz2 : bdftopcf-1.0.3 :
intltool-0.41.1.tar.gz : intltool-0.41.1 :
xkeyboard-config-2.0.tar.bz2 : xkeyboard-config-2.0 :
font-adobe-75dpi-1.0.3.tar.bz2 : font-adobe-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-100dpi-1.0.3.tar.bz2 : font-adobe-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-75dpi-1.0.4.tar.bz2 : font-adobe-utopia-75dpi-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-100dpi-1.0.4.tar.bz2 : font-adobe-utopia-100dpi-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-adobe-utopia-type1-1.0.4.tar.bz2 : font-adobe-utopia-type1-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-alias-1.0.3.tar.bz2 : font-alias-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-arabic-misc-1.0.3.tar.bz2 : font-arabic-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-75dpi-1.0.3.tar.bz2 : font-bh-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-100dpi-1.0.3.tar.bz2 : font-bh-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-lucidatypewriter-75dpi-1.0.3.tar.bz2 : font-bh-lucidatypewriter-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-lucidatypewriter-100dpi-1.0.3.tar.bz2 : font-bh-lucidatypewriter-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-ttf-1.0.3.tar.bz2 : font-bh-ttf-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bh-type1-1.0.3.tar.bz2 : font-bh-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-75dpi-1.0.3.tar.bz2 : font-bitstream-75dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-100dpi-1.0.3.tar.bz2 : font-bitstream-100dpi-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-bitstream-type1-1.0.3.tar.bz2 : font-bitstream-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-cronyx-cyrillic-1.0.3.tar.bz2 : font-cronyx-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-cursor-misc-1.0.3.tar.bz2 : font-cursor-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-daewoo-misc-1.0.3.tar.bz2 : font-daewoo-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-dec-misc-1.0.3.tar.bz2 : font-dec-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-ibm-type1-1.0.3.tar.bz2 : font-ibm-type1-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-isas-misc-1.0.3.tar.bz2 : font-isas-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-jis-misc-1.0.3.tar.bz2 : font-jis-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-micro-misc-1.0.3.tar.bz2 : font-micro-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-cyrillic-1.0.3.tar.bz2 : font-misc-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-ethiopic-1.0.3.tar.bz2 : font-misc-ethiopic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-meltho-1.0.3.tar.bz2 : font-misc-meltho-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-misc-misc-1.1.2.tar.bz2 : font-misc-misc-1.1.2 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-mutt-misc-1.0.3.tar.bz2 : font-mutt-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-schumacher-misc-1.1.2.tar.bz2 : font-schumacher-misc-1.1.2 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-screen-cyrillic-1.0.4.tar.bz2 : font-screen-cyrillic-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-sony-misc-1.0.3.tar.bz2 : font-sony-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-sun-misc-1.0.3.tar.bz2 : font-sun-misc-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-util-1.2.0.tar.bz2 : font-util-1.2.0 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-winitzki-cyrillic-1.0.3.tar.bz2 : font-winitzki-cyrillic-1.0.3 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11
font-xfree86-type1-1.0.4.tar.bz2 : font-xfree86-type1-1.0.4 : --with-fontrootdir=$PREFIX_DIR/share/fonts/X11

@ -50,7 +50,7 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1,
long sync_result;
int sync_command;
/* If the function is called from the main thread, the function can
/* If the function is called from the main thread, the function can
* be called directly. g_threadid= main thread ID*/
if (tc_threadid_equal(tc_get_threadid(), g_threadid))
{
@ -61,33 +61,33 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1,
}
else
{
/* All threads have to wait here until the main thread
* process the function. g_process_waiting_function() is called
* from the listening thread. g_process_waiting_function() process the function*/
/* All threads have to wait here until the main thread
* process the function. g_process_waiting_function() is called
* from the listening thread. g_process_waiting_function() process the function*/
tc_mutex_lock(g_sync1_mutex);
tc_mutex_lock(g_sync_mutex);
g_sync_param1 = sync_param1;
g_sync_param2 = sync_param2;
g_sync_func = sync_func;
/* set a value THREAD_WAITING so the g_process_waiting_function function
/* set a value THREAD_WAITING so the g_process_waiting_function function
* know if any function must be processed */
g_sync_command = THREAD_WAITING;
g_sync_command = THREAD_WAITING;
tc_mutex_unlock(g_sync_mutex);
/* set this event so that the main thread know if
/* set this event so that the main thread know if
* g_process_waiting_function() must be called */
g_set_wait_obj(g_sync_event);
g_set_wait_obj(g_sync_event);
do
{
g_sleep(100);
tc_mutex_lock(g_sync_mutex);
/* load new value from global to see if the g_process_waiting_function()
/* load new value from global to see if the g_process_waiting_function()
* function has processed the function */
sync_command = g_sync_command;
sync_command = g_sync_command;
sync_result = g_sync_result;
tc_mutex_unlock(g_sync_mutex);
}
while (sync_command != 0); /* loop until g_process_waiting_function()
* has processed the request*/
while (sync_command != 0); /* loop until g_process_waiting_function()
* has processed the request */
tc_mutex_unlock(g_sync1_mutex);
/*g_writeln("g_xrdp_sync processed BY main thread -> continue");*/
}
@ -521,7 +521,7 @@ main(int argc, char** argv)
{
g_writeln("error creating g_sync_event");
}
g_listen->startup_params = startup_params;
g_listen->startup_params = startup_params;
xrdp_listen_main_loop(g_listen);
xrdp_listen_delete(g_listen);
tc_mutex_delete(g_sync_mutex);

@ -35,12 +35,13 @@ SyslogLevel=DEBUG
[channels]
# Channel names not listed here will be blocket by XRDP.
# You can block any channel by setting its value to false.
# IMPORTANT! All channels are not supported in all use
# IMPORTANT! All channels are not supported in all use
# cases even if you set all values to true.
rdpdr=true
rdpsnd=true
drdynvc=true
cliprdr=true
rail=true
[xrdp1]
name=sesman-Xvnc

@ -352,8 +352,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
if (!g_file_exist(filename))
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] does not exist",filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] "
"does not exist", filename);
return 1;
}
s = (struct stream *)NULL;
@ -363,15 +363,15 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
/* read file type */
if (g_file_read(fd, type1, 2) != 2)
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] read error",filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] "
"read error", filename);
g_file_close(fd);
return 1;
}
if ((type1[0] != 'B') || (type1[1] != 'M'))
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] not BMP file", filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] "
"not BMP file", filename);
g_file_close(fd);
return 1;
}
@ -398,8 +398,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
if ((header.bit_count != 4) && (header.bit_count != 8) &&
(header.bit_count != 24))
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] bad bpp %d",filename, header.bit_count);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] "
"bad bpp %d", filename, header.bit_count);
free_stream(s);
g_file_close(fd);
return 1;
@ -417,8 +417,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
k = g_file_read(fd, s->data + i * size, size);
if (k != size)
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] read",filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap "
"file [%s] read", filename);
}
}
for (i = 0; i < self->height; i++)
@ -471,8 +471,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
k = g_file_read(fd, s->data + i * size, size);
if (k != size)
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] read", filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap "
"file [%s] read", filename);
}
}
for (i = 0; i < self->height; i++)
@ -521,8 +521,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
k = g_file_read(fd, s->data + i * size, size);
if (k != size)
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error bitmap file [%s] read",filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap "
"file [%s] read", filename);
}
}
for (i = 0; i < self->height; i++)
@ -564,8 +564,8 @@ xrdp_bitmap_load(struct xrdp_bitmap* self, const char* filename, int* palette)
}
else
{
log_message(LOG_LEVEL_ERROR,
"xrdp_bitmap_load: error loading bitmap from file [%s]", filename);
log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error loading bitmap "
"from file [%s]", filename);
return 1;
}
return 0;
@ -1305,7 +1305,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
h = (h / 2) + 2;
y = y + (h / 2) + 1;
painter->fg_color = self->wm->black;
for (i=w; i>0; i=i-2)
for (i=w; i>0; i=i-2)
{
xrdp_painter_fill_rect(painter, self, x, y, i, 1);
y++;

@ -261,36 +261,46 @@ xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap,
xrdp_bitmap_delete(self->bitmap_items[cache_id][cache_idx].bitmap);
self->bitmap_items[cache_id][cache_idx].bitmap = bitmap;
self->bitmap_items[cache_id][cache_idx].stamp = self->bitmap_stamp;
if (self->bitmap_cache_version == 0) /* orginal version */
if (self->use_bitmap_comp)
{
if (self->use_bitmap_comp)
if (self->bitmap_cache_version & 4)
{
libxrdp_orders_send_bitmap(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx);
}
else
{
libxrdp_orders_send_raw_bitmap(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx);
if (libxrdp_orders_send_bitmap3(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx,
hints) == 0)
{
return MAKELONG(cache_idx, cache_id);
}
}
}
else
{
if (self->use_bitmap_comp)
if (self->bitmap_cache_version & 2)
{
libxrdp_orders_send_bitmap2(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx,
hints);
}
else
else if (self->bitmap_cache_version & 1)
{
libxrdp_orders_send_bitmap(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx);
}
}
else
{
if (self->bitmap_cache_version & 2)
{
libxrdp_orders_send_raw_bitmap2(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx);
}
else if (self->bitmap_cache_version & 1)
{
libxrdp_orders_send_raw_bitmap(self->session, bitmap->width,
bitmap->height, bitmap->bpp,
bitmap->data, cache_id, cache_idx);
}
}
return MAKELONG(cache_idx, cache_id);
}

@ -355,7 +355,7 @@ xrdp_listen_main_loop(struct xrdp_listen* self)
timeout = -1;
if (trans_get_wait_objs(self->listen_trans, robjs, &robjs_count) != 0)
{
g_writeln("Listening socket is in wrong state we terminate listener") ;
g_writeln("Listening socket is in wrong state we terminate listener") ;
break;
}
/* wait - timeout -1 means wait indefinitely*/
@ -375,7 +375,7 @@ xrdp_listen_main_loop(struct xrdp_listen* self)
}
if (g_is_wait_obj_set(done_obj)) /* pro_done_event */
{
g_reset_wait_obj(done_obj);
g_reset_wait_obj(done_obj);
/* a process has died remove it from lists*/
xrdp_listen_delete_done_pro(self);
}

@ -1845,7 +1845,7 @@ void init_channel_allowed(struct xrdp_wm* wm)
/* first reset allowedchannels */
for (i = 0; i < MAX_NR_CHANNELS; i++)
{
/* 0 is a valid channel so we use -1 to mark the index as unused */
/* 0 is a valid channel so we use -1 to mark the index as unused */
wm->allowedchannels[i] = -1;
}
names = list_create();

Loading…
Cancel
Save