Fixing code formatting with astyle
This commit is contained in:
parent
51905d765a
commit
2d6d249f76
@ -121,7 +121,7 @@ libxrdp_get_pdu_bytes(const char *aheader)
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* only used during connection */
|
/* only used during connection */
|
||||||
struct stream *
|
struct stream *
|
||||||
libxrdp_force_read(struct trans* trans)
|
libxrdp_force_read(struct trans *trans)
|
||||||
{
|
{
|
||||||
int bytes;
|
int bytes;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
@ -246,9 +246,9 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
|
|||||||
case 2: /* FASTPATH_INPUT_EVENT */
|
case 2: /* FASTPATH_INPUT_EVENT */
|
||||||
if (xrdp_fastpath_process_input_event(rdp->sec_layer->fastpath_layer, s) != 0)
|
if (xrdp_fastpath_process_input_event(rdp->sec_layer->fastpath_layer, s) != 0)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "libxrdp_process_data returned non zero");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "libxrdp_process_data returned non zero");
|
||||||
cont = 0;
|
cont = 0;
|
||||||
term = 1;
|
term = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -307,7 +307,8 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_palette: slowpath");
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_palette: slowpath");
|
||||||
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
|
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
|
||||||
}
|
}
|
||||||
@ -329,16 +330,16 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
|
|||||||
s_mark_end(s);
|
s_mark_end(s);
|
||||||
if (session->client_info->use_fast_path & 1) /* fastpath output supported */
|
if (session->client_info->use_fast_path & 1) /* fastpath output supported */
|
||||||
{
|
{
|
||||||
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
||||||
FASTPATH_UPDATETYPE_PALETTE) != 0)
|
FASTPATH_UPDATETYPE_PALETTE) != 0)
|
||||||
{
|
{
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
||||||
RDP_DATA_PDU_UPDATE);
|
RDP_DATA_PDU_UPDATE);
|
||||||
}
|
}
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
@ -434,7 +435,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
line_pad_bytes = line_bytes + e * Bpp;
|
line_pad_bytes = line_bytes + e * Bpp;
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: bpp %d Bpp %d line_bytes %d "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: bpp %d Bpp %d line_bytes %d "
|
||||||
"server_line_bytes %d", bpp, Bpp, line_bytes, server_line_bytes);
|
"server_line_bytes %d", bpp, Bpp, line_bytes, server_line_bytes);
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
init_stream(s, MAX_BITMAP_BUF_SIZE);
|
init_stream(s, MAX_BITMAP_BUF_SIZE);
|
||||||
|
|
||||||
@ -479,19 +480,19 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: 32 bpp");
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: 32 bpp");
|
||||||
lines_sending = xrdp_bitmap32_compress(data, width, height,
|
lines_sending = xrdp_bitmap32_compress(data, width, height,
|
||||||
s, 32,
|
s, 32,
|
||||||
(MAX_BITMAP_BUF_SIZE - 100) - total_bufsize,
|
(MAX_BITMAP_BUF_SIZE - 100) - total_bufsize,
|
||||||
i - 1, temp_s, e, 0x10);
|
i - 1, temp_s, e, 0x10);
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: i %d lines_sending %d",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: i %d lines_sending %d",
|
||||||
i, lines_sending);
|
i, lines_sending);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lines_sending = xrdp_bitmap_compress(data, width, height,
|
lines_sending = xrdp_bitmap_compress(data, width, height,
|
||||||
s, bpp,
|
s, bpp,
|
||||||
(MAX_BITMAP_BUF_SIZE - 100) - total_bufsize,
|
(MAX_BITMAP_BUF_SIZE - 100) - total_bufsize,
|
||||||
i - 1, temp_s, e);
|
i - 1, temp_s, e);
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: i %d lines_sending %d",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: i %d lines_sending %d",
|
||||||
i, lines_sending);
|
i, lines_sending);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines_sending == 0)
|
if (lines_sending == 0)
|
||||||
@ -535,20 +536,20 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: decompressed pixels %d "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: decompressed pixels %d "
|
||||||
"decompressed bytes %d compressed bytes %d",
|
"decompressed bytes %d compressed bytes %d",
|
||||||
lines_sending * (width + e),
|
lines_sending * (width + e),
|
||||||
line_pad_bytes * lines_sending, bufsize);
|
line_pad_bytes * lines_sending, bufsize);
|
||||||
|
|
||||||
if (j > MAX_BITMAP_BUF_SIZE)
|
if (j > MAX_BITMAP_BUF_SIZE)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, decompressed "
|
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, decompressed "
|
||||||
"size too big: %d bytes", j);
|
"size too big: %d bytes", j);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufsize > MAX_BITMAP_BUF_SIZE)
|
if (bufsize > MAX_BITMAP_BUF_SIZE)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, compressed size "
|
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, compressed size "
|
||||||
"too big: %d bytes", bufsize);
|
"too big: %d bytes", bufsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->p = s->end;
|
s->p = s->end;
|
||||||
@ -556,7 +557,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
while (total_bufsize < MAX_BITMAP_BUF_SIZE && i > 0);
|
while (total_bufsize < MAX_BITMAP_BUF_SIZE && i > 0);
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: num_updates %d total_bufsize %d",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_bitmap: num_updates %d total_bufsize %d",
|
||||||
num_updates, total_bufsize);
|
num_updates, total_bufsize);
|
||||||
|
|
||||||
p_num_updates[0] = num_updates;
|
p_num_updates[0] = num_updates;
|
||||||
p_num_updates[1] = num_updates >> 8;
|
p_num_updates[1] = num_updates >> 8;
|
||||||
@ -566,7 +567,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
if (total_bufsize > MAX_BITMAP_BUF_SIZE)
|
if (total_bufsize > MAX_BITMAP_BUF_SIZE)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, total compressed "
|
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_send_bitmap: error, total compressed "
|
||||||
"size too big: %d bytes", total_bufsize);
|
"size too big: %d bytes", total_bufsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +630,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
q = q - server_line_bytes;
|
q = q - server_line_bytes;
|
||||||
for (k = 0; k < width; k++)
|
for (k = 0; k < width; k++)
|
||||||
{
|
{
|
||||||
pixel = *((tui16*)(q + k * 2));
|
pixel = *((tui16 *)(q + k * 2));
|
||||||
out_uint16_le(s, pixel);
|
out_uint16_le(s, pixel);
|
||||||
}
|
}
|
||||||
out_uint8s(s, e * 2);
|
out_uint8s(s, e * 2);
|
||||||
@ -641,7 +642,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
q = q - server_line_bytes;
|
q = q - server_line_bytes;
|
||||||
for (k = 0; k < width; k++)
|
for (k = 0; k < width; k++)
|
||||||
{
|
{
|
||||||
pixel = *((tui32*)(q + k * 4));
|
pixel = *((tui32 *)(q + k * 4));
|
||||||
out_uint8(s, pixel);
|
out_uint8(s, pixel);
|
||||||
out_uint8(s, pixel >> 8);
|
out_uint8(s, pixel >> 8);
|
||||||
out_uint8(s, pixel >> 16);
|
out_uint8(s, pixel >> 16);
|
||||||
@ -655,7 +656,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
|||||||
q = q - server_line_bytes;
|
q = q - server_line_bytes;
|
||||||
for (k = 0; k < width; k++)
|
for (k = 0; k < width; k++)
|
||||||
{
|
{
|
||||||
pixel = *((int*)(q + k * 4));
|
pixel = *((int *)(q + k * 4));
|
||||||
out_uint32_le(s, pixel);
|
out_uint32_le(s, pixel);
|
||||||
}
|
}
|
||||||
out_uint8s(s, e * 4);
|
out_uint8s(s, e * 4);
|
||||||
@ -735,18 +736,18 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
|
|||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_pointer: slowpath");
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "libxrdp_send_pointer: slowpath");
|
||||||
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
|
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
|
||||||
if ((session->client_info->pointer_flags & 1) == 0)
|
if ((session->client_info->pointer_flags & 1) == 0)
|
||||||
{
|
{
|
||||||
out_uint16_le(s, RDP_POINTER_COLOR);
|
out_uint16_le(s, RDP_POINTER_COLOR);
|
||||||
out_uint16_le(s, 0); /* pad */
|
out_uint16_le(s, 0); /* pad */
|
||||||
data_bytes = 3072;
|
data_bytes = 3072;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out_uint16_le(s, RDP_POINTER_POINTER);
|
out_uint16_le(s, RDP_POINTER_POINTER);
|
||||||
out_uint16_le(s, 0); /* pad */
|
out_uint16_le(s, 0); /* pad */
|
||||||
out_uint16_le(s, bpp);
|
out_uint16_le(s, bpp);
|
||||||
data_bytes = ((bpp + 7) / 8) * 32 * 32;
|
data_bytes = ((bpp + 7) / 8) * 32 * 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -808,7 +809,7 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
|
|||||||
if ((session->client_info->pointer_flags & 1) == 0)
|
if ((session->client_info->pointer_flags & 1) == 0)
|
||||||
{
|
{
|
||||||
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
||||||
FASTPATH_UPDATETYPE_COLOR) != 0)
|
FASTPATH_UPDATETYPE_COLOR) != 0)
|
||||||
{
|
{
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 1;
|
return 1;
|
||||||
@ -817,7 +818,7 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
||||||
FASTPATH_UPDATETYPE_POINTER) != 0)
|
FASTPATH_UPDATETYPE_POINTER) != 0)
|
||||||
{
|
{
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 1;
|
return 1;
|
||||||
@ -827,7 +828,7 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
||||||
RDP_DATA_PDU_POINTER);
|
RDP_DATA_PDU_POINTER);
|
||||||
}
|
}
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 0;
|
return 0;
|
||||||
@ -867,7 +868,7 @@ libxrdp_set_pointer(struct xrdp_session *session, int cache_idx)
|
|||||||
if (session->client_info->use_fast_path & 1) /* fastpath output supported */
|
if (session->client_info->use_fast_path & 1) /* fastpath output supported */
|
||||||
{
|
{
|
||||||
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
|
||||||
FASTPATH_UPDATETYPE_CACHED) != 0)
|
FASTPATH_UPDATETYPE_CACHED) != 0)
|
||||||
{
|
{
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 1;
|
return 1;
|
||||||
@ -876,7 +877,7 @@ libxrdp_set_pointer(struct xrdp_session *session, int cache_idx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
|
||||||
RDP_DATA_PDU_POINTER);
|
RDP_DATA_PDU_POINTER);
|
||||||
}
|
}
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 0;
|
return 0;
|
||||||
@ -971,21 +972,21 @@ libxrdp_orders_mem_blt(struct xrdp_session *session, int cache_id,
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
int
|
int
|
||||||
libxrdp_orders_composite_blt(struct xrdp_session* session, int srcidx,
|
libxrdp_orders_composite_blt(struct xrdp_session *session, int srcidx,
|
||||||
int srcformat, int srcwidth, int srcrepeat,
|
int srcformat, int srcwidth, int srcrepeat,
|
||||||
int* srctransform, int mskflags,
|
int *srctransform, int mskflags,
|
||||||
int mskidx, int mskformat, int mskwidth,
|
int mskidx, int mskformat, int mskwidth,
|
||||||
int mskrepeat, int op, int srcx, int srcy,
|
int mskrepeat, int op, int srcx, int srcy,
|
||||||
int mskx, int msky, int dstx, int dsty,
|
int mskx, int msky, int dstx, int dsty,
|
||||||
int width, int height, int dstformat,
|
int width, int height, int dstformat,
|
||||||
struct xrdp_rect* rect)
|
struct xrdp_rect *rect)
|
||||||
{
|
{
|
||||||
return xrdp_orders_composite_blt((struct xrdp_orders*)session->orders,
|
return xrdp_orders_composite_blt((struct xrdp_orders *)session->orders,
|
||||||
srcidx, srcformat, srcwidth, srcrepeat,
|
srcidx, srcformat, srcwidth, srcrepeat,
|
||||||
srctransform, mskflags,
|
srctransform, mskflags,
|
||||||
mskidx, mskformat, mskwidth, mskrepeat,
|
mskidx, mskformat, mskwidth, mskrepeat,
|
||||||
op, srcx, srcy, mskx, msky, dstx, dsty,
|
op, srcx, srcy, mskx, msky, dstx, dsty,
|
||||||
width, height, dstformat, rect);
|
width, height, dstformat, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -1067,9 +1068,9 @@ libxrdp_reset(struct xrdp_session *session,
|
|||||||
|
|
||||||
/* if same (and only one monitor on client) don't need to do anything */
|
/* if same (and only one monitor on client) don't need to do anything */
|
||||||
if (client_info->width == width &&
|
if (client_info->width == width &&
|
||||||
client_info->height == height &&
|
client_info->height == height &&
|
||||||
client_info->bpp == bpp &&
|
client_info->bpp == bpp &&
|
||||||
(client_info->monitorCount == 0 || client_info->multimon == 0))
|
(client_info->monitorCount == 0 || client_info->multimon == 0))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1493,7 +1494,7 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
|
|||||||
char *out_data, int *io_len)
|
char *out_data, int *io_len)
|
||||||
{
|
{
|
||||||
struct xrdp_orders *orders;
|
struct xrdp_orders *orders;
|
||||||
void* jpeg_han;
|
void *jpeg_han;
|
||||||
|
|
||||||
orders = (struct xrdp_orders *)(session->orders);
|
orders = (struct xrdp_orders *)(session->orders);
|
||||||
jpeg_han = orders->jpeg_han;
|
jpeg_han = orders->jpeg_han;
|
||||||
@ -1505,7 +1506,7 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int EXPORT_CC
|
int EXPORT_CC
|
||||||
libxrdp_fastpath_send_surface(struct xrdp_session *session,
|
libxrdp_fastpath_send_surface(struct xrdp_session *session,
|
||||||
char* data_pad, int pad_bytes,
|
char *data_pad, int pad_bytes,
|
||||||
int data_bytes,
|
int data_bytes,
|
||||||
int destLeft, int destTop,
|
int destLeft, int destTop,
|
||||||
int destRight, int destBottom, int bpp,
|
int destRight, int destBottom, int bpp,
|
||||||
|
@ -81,9 +81,9 @@ fsplit3(char *in_data, int start_line, int width, int e,
|
|||||||
rp |= (pixel << 8) & 0xff000000;
|
rp |= (pixel << 8) & 0xff000000;
|
||||||
gp |= (pixel << 16) & 0xff000000;
|
gp |= (pixel << 16) & 0xff000000;
|
||||||
bp |= (pixel << 24) & 0xff000000;
|
bp |= (pixel << 24) & 0xff000000;
|
||||||
*((int*)(r_data + out_index)) = rp;
|
*((int *)(r_data + out_index)) = rp;
|
||||||
*((int*)(g_data + out_index)) = gp;
|
*((int *)(g_data + out_index)) = gp;
|
||||||
*((int*)(b_data + out_index)) = bp;
|
*((int *)(b_data + out_index)) = bp;
|
||||||
out_index += 4;
|
out_index += 4;
|
||||||
index += 4;
|
index += 4;
|
||||||
}
|
}
|
||||||
@ -166,10 +166,10 @@ fsplit4(char *in_data, int start_line, int width, int e,
|
|||||||
rp |= (pixel << 8) & 0xff000000;
|
rp |= (pixel << 8) & 0xff000000;
|
||||||
gp |= (pixel << 16) & 0xff000000;
|
gp |= (pixel << 16) & 0xff000000;
|
||||||
bp |= (pixel << 24) & 0xff000000;
|
bp |= (pixel << 24) & 0xff000000;
|
||||||
*((int*)(a_data + out_index)) = ap;
|
*((int *)(a_data + out_index)) = ap;
|
||||||
*((int*)(r_data + out_index)) = rp;
|
*((int *)(r_data + out_index)) = rp;
|
||||||
*((int*)(g_data + out_index)) = gp;
|
*((int *)(g_data + out_index)) = gp;
|
||||||
*((int*)(b_data + out_index)) = bp;
|
*((int *)(b_data + out_index)) = bp;
|
||||||
out_index += 4;
|
out_index += 4;
|
||||||
index += 4;
|
index += 4;
|
||||||
}
|
}
|
||||||
@ -205,13 +205,13 @@ fsplit4(char *in_data, int start_line, int width, int e,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
#define DELTA_ONE \
|
#define DELTA_ONE \
|
||||||
do { \
|
do { \
|
||||||
delta = src8[cx] - src8[0]; \
|
delta = src8[cx] - src8[0]; \
|
||||||
is_neg = (delta >> 7) & 1; \
|
is_neg = (delta >> 7) & 1; \
|
||||||
dst8[cx] = (((delta ^ -is_neg) + is_neg) << 1) - is_neg; \
|
dst8[cx] = (((delta ^ -is_neg) + is_neg) << 1) - is_neg; \
|
||||||
src8++; \
|
src8++; \
|
||||||
dst8++; \
|
dst8++; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int
|
static int
|
||||||
|
@ -167,7 +167,7 @@ xrdp_caps_process_order(struct xrdp_rdp *self, struct stream *s,
|
|||||||
|
|
||||||
/* check if libpainter should be used for drawing, instead of orders */
|
/* check if libpainter should be used for drawing, instead of orders */
|
||||||
if (!(order_caps[TS_NEG_DSTBLT_INDEX] && order_caps[TS_NEG_PATBLT_INDEX] &&
|
if (!(order_caps[TS_NEG_DSTBLT_INDEX] && order_caps[TS_NEG_PATBLT_INDEX] &&
|
||||||
order_caps[TS_NEG_SCRBLT_INDEX] && order_caps[TS_NEG_MEMBLT_INDEX]))
|
order_caps[TS_NEG_SCRBLT_INDEX] && order_caps[TS_NEG_MEMBLT_INDEX]))
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_process_order: not enough orders supported by client, using painter.");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_process_order: not enough orders supported by client, using painter.");
|
||||||
self->client_info.no_orders_supported = 1;
|
self->client_info.no_orders_supported = 1;
|
||||||
@ -210,11 +210,11 @@ xrdp_caps_process_bmpcache(struct xrdp_rdp *self, struct stream *s,
|
|||||||
self->client_info.cache3_entries = i;
|
self->client_info.cache3_entries = i;
|
||||||
in_uint16_le(s, self->client_info.cache3_size);
|
in_uint16_le(s, self->client_info.cache3_size);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache1 entries %d size %d", self->client_info.cache1_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache1 entries %d size %d", self->client_info.cache1_entries,
|
||||||
self->client_info.cache1_size);
|
self->client_info.cache1_size);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache2 entries %d size %d", self->client_info.cache2_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache2 entries %d size %d", self->client_info.cache2_entries,
|
||||||
self->client_info.cache2_size);
|
self->client_info.cache2_size);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache3 entries %d size %d", self->client_info.cache3_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache3 entries %d size %d", self->client_info.cache3_entries,
|
||||||
self->client_info.cache3_size);
|
self->client_info.cache3_size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,11 +254,11 @@ xrdp_caps_process_bmpcache2(struct xrdp_rdp *self, struct stream *s,
|
|||||||
self->client_info.cache3_entries = i;
|
self->client_info.cache3_entries = i;
|
||||||
self->client_info.cache3_size = 4096 * Bpp;
|
self->client_info.cache3_size = 4096 * Bpp;
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache1 entries %d size %d", self->client_info.cache1_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache1 entries %d size %d", self->client_info.cache1_entries,
|
||||||
self->client_info.cache1_size);
|
self->client_info.cache1_size);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache2 entries %d size %d", self->client_info.cache2_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache2 entries %d size %d", self->client_info.cache2_entries,
|
||||||
self->client_info.cache2_size);
|
self->client_info.cache2_size);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "cache3 entries %d size %d", self->client_info.cache3_entries,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "cache3 entries %d size %d", self->client_info.cache3_entries,
|
||||||
self->client_info.cache3_size);
|
self->client_info.cache3_size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ xrdp_caps_process_multifragmentupdate(struct xrdp_rdp *self, struct stream *s,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int
|
static int
|
||||||
xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len)
|
xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len)
|
||||||
{
|
{
|
||||||
@ -739,7 +739,7 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self->client_info.no_orders_supported &&
|
if (self->client_info.no_orders_supported &&
|
||||||
(self->client_info.offscreen_support_level != 0))
|
(self->client_info.offscreen_support_level != 0))
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_process_confirm_active: not enough orders "
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_process_confirm_active: not enough orders "
|
||||||
"supported by client, client wants off screen bitmap but "
|
"supported by client, client wants off screen bitmap but "
|
||||||
@ -1042,12 +1042,12 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
|
|||||||
|
|
||||||
/* send Monitor Layout PDU for dual monitor */
|
/* send Monitor Layout PDU for dual monitor */
|
||||||
if (self->client_info.monitorCount > 0 &&
|
if (self->client_info.monitorCount > 0 &&
|
||||||
self->client_info.multimon == 1)
|
self->client_info.multimon == 1)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: sending monitor layout pdu");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: sending monitor layout pdu");
|
||||||
if (xrdp_caps_send_monitorlayout(self) != 0)
|
if (xrdp_caps_send_monitorlayout(self) != 0)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: error sending monitor layout pdu");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: error sending monitor layout pdu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,10 +138,10 @@ xrdp_channel_send(struct xrdp_channel *self, struct stream *s, int channel_id,
|
|||||||
*
|
*
|
||||||
* That's flag makes MSTSC crash when using RAIL channel.
|
* That's flag makes MSTSC crash when using RAIL channel.
|
||||||
*/
|
*/
|
||||||
// if (channel->flags & XR_CHANNEL_OPTION_SHOW_PROTOCOL)
|
// if (channel->flags & XR_CHANNEL_OPTION_SHOW_PROTOCOL)
|
||||||
// {
|
// {
|
||||||
// flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
|
// flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
out_uint32_le(s, flags);
|
out_uint32_le(s, flags);
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ drdynvc_process_open_channel_response(struct xrdp_channel *self,
|
|||||||
}
|
}
|
||||||
in_uint32_le(s, creation_status);
|
in_uint32_le(s, creation_status);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_open_channel_response: chan_id 0x%x "
|
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_open_channel_response: chan_id 0x%x "
|
||||||
"creation_status %d", chan_id, creation_status);
|
"creation_status %d", chan_id, creation_status);
|
||||||
session = self->sec_layer->rdp_layer->session;
|
session = self->sec_layer->rdp_layer->session;
|
||||||
if (chan_id > 255)
|
if (chan_id > 255)
|
||||||
{
|
{
|
||||||
@ -336,7 +336,7 @@ drdynvc_process_close_channel_response(struct xrdp_channel *self,
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_close_channel_response: chan_id 0x%x", chan_id);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_close_channel_response: chan_id 0x%x", chan_id);
|
||||||
session = self->sec_layer->rdp_layer->session;
|
session = self->sec_layer->rdp_layer->session;
|
||||||
if (chan_id > 255)
|
if (chan_id > 255)
|
||||||
{
|
{
|
||||||
@ -393,7 +393,7 @@ drdynvc_process_data_first(struct xrdp_channel *self,
|
|||||||
in_uint32_le(s, total_bytes);
|
in_uint32_le(s, total_bytes);
|
||||||
}
|
}
|
||||||
bytes = (int) (s->end - s->p);
|
bytes = (int) (s->end - s->p);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_data_first: bytes %d total_bytes %d", bytes, total_bytes);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_data_first: bytes %d total_bytes %d", bytes, total_bytes);
|
||||||
session = self->sec_layer->rdp_layer->session;
|
session = self->sec_layer->rdp_layer->session;
|
||||||
if (chan_id > 255)
|
if (chan_id > 255)
|
||||||
{
|
{
|
||||||
@ -423,7 +423,7 @@ drdynvc_process_data(struct xrdp_channel *self,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
bytes = (int) (s->end - s->p);
|
bytes = (int) (s->end - s->p);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_data: bytes %d", bytes);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "drdynvc_process_data: bytes %d", bytes);
|
||||||
session = self->sec_layer->rdp_layer->session;
|
session = self->sec_layer->rdp_layer->session;
|
||||||
if (chan_id > 255)
|
if (chan_id > 255)
|
||||||
{
|
{
|
||||||
@ -457,7 +457,7 @@ xrdp_channel_process_drdynvc(struct xrdp_channel *self,
|
|||||||
in_uint32_le(s, total_length);
|
in_uint32_le(s, total_length);
|
||||||
in_uint32_le(s, flags);
|
in_uint32_le(s, flags);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: total_length %d flags 0x%8.8x",
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: total_length %d flags 0x%8.8x",
|
||||||
total_length, flags);
|
total_length, flags);
|
||||||
ls = NULL;
|
ls = NULL;
|
||||||
switch (flags & 3)
|
switch (flags & 3)
|
||||||
{
|
{
|
||||||
@ -504,7 +504,7 @@ xrdp_channel_process_drdynvc(struct xrdp_channel *self,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
in_uint8(ls, cmd); /* read command */
|
in_uint8(ls, cmd); /* read command */
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: cmd 0x%x", cmd);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: cmd 0x%x", cmd);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
switch (cmd & 0xf0)
|
switch (cmd & 0xf0)
|
||||||
{
|
{
|
||||||
@ -528,7 +528,7 @@ xrdp_channel_process_drdynvc(struct xrdp_channel *self,
|
|||||||
"command 0x%x", cmd);
|
"command 0x%x", cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: rv %d", rv);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_channel_process_drdynvc: rv %d", rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ xrdp_channel_drdynvc_close(struct xrdp_channel *self, int chan_id)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((self->drdynvcs[chan_id].status != XRDP_DRDYNVC_STATUS_OPEN) &&
|
if ((self->drdynvcs[chan_id].status != XRDP_DRDYNVC_STATUS_OPEN) &&
|
||||||
(self->drdynvcs[chan_id].status != XRDP_DRDYNVC_STATUS_OPEN_SENT))
|
(self->drdynvcs[chan_id].status != XRDP_DRDYNVC_STATUS_OPEN_SENT))
|
||||||
{
|
{
|
||||||
/* not open */
|
/* not open */
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -179,7 +179,9 @@ xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
|
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
|
||||||
|
{
|
||||||
flags |= KBD_FLAG_EXT;
|
flags |= KBD_FLAG_EXT;
|
||||||
|
}
|
||||||
|
|
||||||
xrdp_fastpath_session_callback(self, RDP_INPUT_SCANCODE,
|
xrdp_fastpath_session_callback(self, RDP_INPUT_SCANCODE,
|
||||||
code, 0, flags, 0);
|
code, 0, flags, 0);
|
||||||
@ -253,13 +255,13 @@ static int
|
|||||||
xrdp_fastpath_process_EVENT_SYNC(struct xrdp_fastpath *self,
|
xrdp_fastpath_process_EVENT_SYNC(struct xrdp_fastpath *self,
|
||||||
int eventFlags, struct stream *s)
|
int eventFlags, struct stream *s)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The eventCode bitfield (3 bits in size) MUST be set to
|
* The eventCode bitfield (3 bits in size) MUST be set to
|
||||||
* FASTPATH_INPUT_EVENT_SYNC (3).
|
* FASTPATH_INPUT_EVENT_SYNC (3).
|
||||||
* The eventFlags bitfield (5 bits in size) contains flags
|
* The eventFlags bitfield (5 bits in size) contains flags
|
||||||
* indicating the "on"
|
* indicating the "on"
|
||||||
* status of the keyboard toggle keys.
|
* status of the keyboard toggle keys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
xrdp_fastpath_session_callback(self, RDP_INPUT_SYNCHRONIZE,
|
xrdp_fastpath_session_callback(self, RDP_INPUT_SYNCHRONIZE,
|
||||||
eventFlags, 0, 0, 0);
|
eventFlags, 0, 0, 0);
|
||||||
@ -326,8 +328,8 @@ xrdp_fastpath_process_input_event(struct xrdp_fastpath *self,
|
|||||||
{
|
{
|
||||||
case FASTPATH_INPUT_EVENT_SCANCODE:
|
case FASTPATH_INPUT_EVENT_SCANCODE:
|
||||||
if (xrdp_fastpath_process_EVENT_SCANCODE(self,
|
if (xrdp_fastpath_process_EVENT_SCANCODE(self,
|
||||||
eventFlags,
|
eventFlags,
|
||||||
s) != 0)
|
s) != 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,11 @@ xrdp_iso_negotiate_security(struct xrdp_iso *self)
|
|||||||
if (self->requestedProtocol & PROTOCOL_SSL)
|
if (self->requestedProtocol & PROTOCOL_SSL)
|
||||||
{
|
{
|
||||||
if (!g_file_readable(client_info->certificate) ||
|
if (!g_file_readable(client_info->certificate) ||
|
||||||
!g_file_readable(client_info->key_file))
|
!g_file_readable(client_info->key_file))
|
||||||
{
|
{
|
||||||
/* certificate or privkey is not readable */
|
/* certificate or privkey is not readable */
|
||||||
LOG(LOG_LEVEL_DEBUG, "No readable certificates or "
|
LOG(LOG_LEVEL_DEBUG, "No readable certificates or "
|
||||||
"private keys, cannot accept TLS connections");
|
"private keys, cannot accept TLS connections");
|
||||||
self->failureCode = SSL_CERT_NOT_ON_SERVER;
|
self->failureCode = SSL_CERT_NOT_ON_SERVER;
|
||||||
rv = 1; /* error */
|
rv = 1; /* error */
|
||||||
}
|
}
|
||||||
@ -97,8 +97,8 @@ xrdp_iso_negotiate_security(struct xrdp_iso *self)
|
|||||||
case PROTOCOL_HYBRID_EX:
|
case PROTOCOL_HYBRID_EX:
|
||||||
default:
|
default:
|
||||||
if ((self->requestedProtocol & PROTOCOL_SSL) &&
|
if ((self->requestedProtocol & PROTOCOL_SSL) &&
|
||||||
g_file_readable(client_info->certificate) &&
|
g_file_readable(client_info->certificate) &&
|
||||||
g_file_readable(client_info->key_file))
|
g_file_readable(client_info->key_file))
|
||||||
{
|
{
|
||||||
/* that's a patch since we don't support CredSSP for now */
|
/* that's a patch since we don't support CredSSP for now */
|
||||||
self->selectedProtocol = PROTOCOL_SSL;
|
self->selectedProtocol = PROTOCOL_SSL;
|
||||||
@ -111,7 +111,7 @@ xrdp_iso_negotiate_security(struct xrdp_iso *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG(LOG_LEVEL_DEBUG, "Security layer: requested %d, selected %d",
|
LOG(LOG_LEVEL_DEBUG, "Security layer: requested %d, selected %d",
|
||||||
self->requestedProtocol, self->selectedProtocol);
|
self->requestedProtocol, self->selectedProtocol);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,14 +132,14 @@ xrdp_iso_process_rdp_neg_req(struct xrdp_iso *self, struct stream *s)
|
|||||||
in_uint8(s, flags);
|
in_uint8(s, flags);
|
||||||
if (flags != 0x0 && flags != 0x8 && flags != 0x1)
|
if (flags != 0x0 && flags != 0x8 && flags != 0x1)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, flags: %x",flags);
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, flags: %x", flags);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_uint16_le(s, len);
|
in_uint16_le(s, len);
|
||||||
if (len != 8)
|
if (len != 8)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, length: %x",len);
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, length: %x", len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ xrdp_iso_process_rdp_neg_req(struct xrdp_iso *self, struct stream *s)
|
|||||||
if (self->requestedProtocol > 0xb)
|
if (self->requestedProtocol > 0xb)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, requestedProtocol: %x",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_iso_process_rdpNegReq: error, requestedProtocol: %x",
|
||||||
self->requestedProtocol);
|
self->requestedProtocol);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ xrdp_iso_incoming(struct xrdp_iso *self)
|
|||||||
if (len != expected_pdu_len)
|
if (len != expected_pdu_len)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_iso_incoming: X.224 CR-TPDU length exp %d got %d",
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_iso_incoming: X.224 CR-TPDU length exp %d got %d",
|
||||||
expected_pdu_len, len);
|
expected_pdu_len, len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,10 +401,10 @@ xrdp_iso_incoming(struct xrdp_iso *self)
|
|||||||
in_uint8s(s, 1 + 2 + 16 + 16);
|
in_uint8s(s, 1 + 2 + 16 + 16);
|
||||||
break;
|
break;
|
||||||
case 'C': /* Cookie */
|
case 'C': /* Cookie */
|
||||||
/* The routingToken and cookie fields are both ASCII
|
/* The routingToken and cookie fields are both ASCII
|
||||||
* strings starting with the word 'Cookie: ' and
|
* strings starting with the word 'Cookie: ' and
|
||||||
* ending with CR+LF. We ignore both, so we do
|
* ending with CR+LF. We ignore both, so we do
|
||||||
* not need to distinguish them */
|
* not need to distinguish them */
|
||||||
while (s_check_rem(s, 1))
|
while (s_check_rem(s, 1))
|
||||||
{
|
{
|
||||||
in_uint8(s, cc_type);
|
in_uint8(s, cc_type);
|
||||||
|
@ -70,7 +70,7 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height,
|
|||||||
temp_buf = 0;
|
temp_buf = 0;
|
||||||
if (e == 0)
|
if (e == 0)
|
||||||
{
|
{
|
||||||
src_buf = (unsigned char*)in_data;
|
src_buf = (unsigned char *)in_data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -97,15 +97,15 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height,
|
|||||||
}
|
}
|
||||||
src_buf = (unsigned char *) temp_buf;
|
src_buf = (unsigned char *) temp_buf;
|
||||||
}
|
}
|
||||||
dst_buf = (unsigned char*)(s->p);
|
dst_buf = (unsigned char *)(s->p);
|
||||||
error = tjCompress(tj_han, src_buf, width + e, (width + e) * 4, height,
|
error = tjCompress(tj_han, src_buf, width + e, (width + e) * 4, height,
|
||||||
TJPF_XBGR, dst_buf, &cdata_bytes,
|
TJPF_XBGR, dst_buf, &cdata_bytes,
|
||||||
TJSAMP_420, quality, 0);
|
TJSAMP_420, quality, 0);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR,
|
LOG(LOG_LEVEL_ERROR,
|
||||||
"xrdp_jpeg_compress: tjCompress error: %s",
|
"xrdp_jpeg_compress: tjCompress error: %s",
|
||||||
tjGetErrorStr());
|
tjGetErrorStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
s->p += cdata_bytes;
|
s->p += cdata_bytes;
|
||||||
@ -132,8 +132,8 @@ xrdp_codec_jpeg_compress(void *handle,
|
|||||||
int quality, /* higher numbers compress less */
|
int quality, /* higher numbers compress less */
|
||||||
char *out_data, /* dest for jpg image */
|
char *out_data, /* dest for jpg image */
|
||||||
int *io_len /* length of out_data and on return */
|
int *io_len /* length of out_data and on return */
|
||||||
/* len of compressed data */
|
/* len of compressed data */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tjhandle tj_han;
|
tjhandle tj_han;
|
||||||
int error;
|
int error;
|
||||||
@ -185,12 +185,12 @@ xrdp_codec_jpeg_compress(void *handle,
|
|||||||
TJSAMP_420, /* jpeg sub sample */
|
TJSAMP_420, /* jpeg sub sample */
|
||||||
quality, /* jpeg quality */
|
quality, /* jpeg quality */
|
||||||
0 /* flags */
|
0 /* flags */
|
||||||
);
|
);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR,
|
LOG(LOG_LEVEL_ERROR,
|
||||||
"xrdp_codec_jpeg_compress: tjCompress error: %s",
|
"xrdp_codec_jpeg_compress: tjCompress error: %s",
|
||||||
tjGetErrorStr());
|
tjGetErrorStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
*io_len = lio_len;
|
*io_len = lio_len;
|
||||||
@ -303,7 +303,7 @@ jp_do_compress(JOCTET *data, int width, int height, int bpp, int quality,
|
|||||||
jpeg_create_compress(&cinfo);
|
jpeg_create_compress(&cinfo);
|
||||||
memset(&md, 0, sizeof(md));
|
memset(&md, 0, sizeof(md));
|
||||||
md.cb = comp_data,
|
md.cb = comp_data,
|
||||||
md.cb_bytes = *comp_data_bytes;
|
md.cb_bytes = *comp_data_bytes;
|
||||||
cinfo.client_data = &md;
|
cinfo.client_data = &md;
|
||||||
memset(&dst_mgr, 0, sizeof(dst_mgr));
|
memset(&dst_mgr, 0, sizeof(dst_mgr));
|
||||||
dst_mgr.init_destination = my_init_destination;
|
dst_mgr.init_destination = my_init_destination;
|
||||||
|
@ -164,12 +164,12 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
|
|||||||
|
|
||||||
in_uint16_be(s, userid);
|
in_uint16_be(s, userid);
|
||||||
in_uint16_be(s, chanid);
|
in_uint16_be(s, chanid);
|
||||||
LOG(LOG_LEVEL_DEBUG,"MCS_CJRQ - channel join request received");
|
LOG(LOG_LEVEL_DEBUG, "MCS_CJRQ - channel join request received");
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_mcs_recv adding channel %4.4x", chanid);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_mcs_recv adding channel %4.4x", chanid);
|
||||||
|
|
||||||
if (xrdp_mcs_send_cjcf(self, userid, chanid) != 0)
|
if (xrdp_mcs_send_cjcf(self, userid, chanid) != 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR,"Non handled error from xrdp_mcs_send_cjcf") ;
|
LOG(LOG_LEVEL_ERROR, "Non handled error from xrdp_mcs_send_cjcf") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = libxrdp_force_read(self->iso_layer->trans);
|
s = libxrdp_force_read(self->iso_layer->trans);
|
||||||
@ -188,7 +188,7 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,"Received an unhandled appid:%d",appid);
|
LOG(LOG_LEVEL_DEBUG, "Received an unhandled appid:%d", appid);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -722,8 +722,8 @@ xrdp_mcs_out_gcc_data(struct xrdp_sec *self)
|
|||||||
int index;
|
int index;
|
||||||
int channel;
|
int channel;
|
||||||
int gcc_size;
|
int gcc_size;
|
||||||
char* gcc_size_ptr;
|
char *gcc_size_ptr;
|
||||||
char* ud_ptr;
|
char *ud_ptr;
|
||||||
|
|
||||||
num_channels = self->mcs_layer->channel_list->count;
|
num_channels = self->mcs_layer->channel_list->count;
|
||||||
num_channels_even = num_channels + (num_channels & 1);
|
num_channels_even = num_channels + (num_channels & 1);
|
||||||
@ -766,7 +766,7 @@ xrdp_mcs_out_gcc_data(struct xrdp_sec *self)
|
|||||||
out_uint8(s, 0);
|
out_uint8(s, 0);
|
||||||
if (self->mcs_layer->iso_layer->rdpNegData)
|
if (self->mcs_layer->iso_layer->rdpNegData)
|
||||||
{
|
{
|
||||||
/* RequestedProtocol */
|
/* RequestedProtocol */
|
||||||
out_uint32_le(s, self->mcs_layer->iso_layer->requestedProtocol);
|
out_uint32_le(s, self->mcs_layer->iso_layer->requestedProtocol);
|
||||||
}
|
}
|
||||||
out_uint16_le(s, SEC_TAG_SRV_CHANNELS);
|
out_uint16_le(s, SEC_TAG_SRV_CHANNELS);
|
||||||
@ -883,7 +883,7 @@ xrdp_mcs_send_connect_response(struct xrdp_mcs *self)
|
|||||||
xrdp_iso_init(self->iso_layer, s);
|
xrdp_iso_init(self->iso_layer, s);
|
||||||
//TODO: we should calculate the whole length include MCS_CONNECT_RESPONSE
|
//TODO: we should calculate the whole length include MCS_CONNECT_RESPONSE
|
||||||
xrdp_mcs_ber_out_header(self, s, MCS_CONNECT_RESPONSE,
|
xrdp_mcs_ber_out_header(self, s, MCS_CONNECT_RESPONSE,
|
||||||
data_len > 0x80 ? data_len + 38 : data_len + 36);
|
data_len > 0x80 ? data_len + 38 : data_len + 36);
|
||||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_RESULT, 1);
|
xrdp_mcs_ber_out_header(self, s, BER_TAG_RESULT, 1);
|
||||||
out_uint8(s, 0);
|
out_uint8(s, 0);
|
||||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);
|
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);
|
||||||
@ -959,7 +959,7 @@ xrdp_mcs_incoming(struct xrdp_mcs *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xrdp_mcs_send_cjcf(self, self->userid,
|
if (xrdp_mcs_send_cjcf(self, self->userid,
|
||||||
self->userid + MCS_USERCHANNEL_BASE + index) != 0)
|
self->userid + MCS_USERCHANNEL_BASE + index) != 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#define CRC_INIT 0xFFFF
|
#define CRC_INIT 0xFFFF
|
||||||
#define CRC(_crcval, _newchar) _crcval = \
|
#define CRC(_crcval, _newchar) _crcval = \
|
||||||
((_crcval) >> 8) ^ g_crc_table[((_crcval) ^ (_newchar)) & 0x00ff]
|
((_crcval) >> 8) ^ g_crc_table[((_crcval) ^ (_newchar)) & 0x00ff]
|
||||||
|
|
||||||
/* CRC16 defs */
|
/* CRC16 defs */
|
||||||
static const tui16 g_crc_table[256] =
|
static const tui16 g_crc_table[256] =
|
||||||
@ -84,336 +84,336 @@ static const tui16 g_crc_table[256] =
|
|||||||
insert 2 bits into outputBuffer
|
insert 2 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_2_bits(_data) \
|
#define insert_2_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if ((bits_left >= 3) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
i = bits_left - 2; \
|
if ((bits_left >= 3) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= _data << i; \
|
{ \
|
||||||
bits_left = i; \
|
i = bits_left - 2; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << i; \
|
||||||
else \
|
bits_left = i; \
|
||||||
{ \
|
} \
|
||||||
i = 2 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 2 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 3 bits into outputBuffer
|
insert 3 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_3_bits(_data) \
|
#define insert_3_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if ((bits_left >= 4) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
i = bits_left - 3; \
|
if ((bits_left >= 4) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= _data << i; \
|
{ \
|
||||||
bits_left = i; \
|
i = bits_left - 3; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << i; \
|
||||||
else \
|
bits_left = i; \
|
||||||
{ \
|
} \
|
||||||
i = 3 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 3 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 4 bits into outputBuffer
|
insert 4 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_4_bits(_data) \
|
#define insert_4_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if ((bits_left >= 5) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
i = bits_left - 4; \
|
if ((bits_left >= 5) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= _data << i; \
|
{ \
|
||||||
bits_left = i; \
|
i = bits_left - 4; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << i; \
|
||||||
else \
|
bits_left = i; \
|
||||||
{ \
|
} \
|
||||||
i = 4 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 4 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 5 bits into outputBuffer
|
insert 5 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_5_bits(_data) \
|
#define insert_5_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if ((bits_left >= 6) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
i = bits_left - 5; \
|
if ((bits_left >= 6) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= _data << i; \
|
{ \
|
||||||
bits_left = i; \
|
i = bits_left - 5; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << i; \
|
||||||
else \
|
bits_left = i; \
|
||||||
{ \
|
} \
|
||||||
i = 5 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 5 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 6 bits into outputBuffer
|
insert 6 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_6_bits(_data) \
|
#define insert_6_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if ((bits_left >= 7) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
i = bits_left - 6; \
|
if ((bits_left >= 7) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (_data << i); \
|
{ \
|
||||||
bits_left = i; \
|
i = bits_left - 6; \
|
||||||
} \
|
outputBuffer[opb_index] |= (_data << i); \
|
||||||
else \
|
bits_left = i; \
|
||||||
{ \
|
} \
|
||||||
i = 6 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (_data >> i); \
|
i = 6 - bits_left; \
|
||||||
outputBuffer[opb_index] |= (_data << j); \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= (_data >> i); \
|
||||||
} \
|
outputBuffer[opb_index] |= (_data << j); \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 7 bits into outputBuffer
|
insert 7 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_7_bits(_data) \
|
#define insert_7_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if (bits_left == 8) \
|
|
||||||
{ \
|
{ \
|
||||||
outputBuffer[opb_index] |= _data << 1; \
|
if (bits_left == 8) \
|
||||||
bits_left = 1; \
|
{ \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << 1; \
|
||||||
else \
|
bits_left = 1; \
|
||||||
{ \
|
} \
|
||||||
i = 7 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 7 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 8 bits into outputBuffer
|
insert 8 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_8_bits(_data) \
|
#define insert_8_bits(_data) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
if (bits_left == 8) \
|
|
||||||
{ \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data; \
|
if (bits_left == 8) \
|
||||||
bits_left = 8; \
|
{ \
|
||||||
} \
|
outputBuffer[opb_index++] |= _data; \
|
||||||
else \
|
bits_left = 8; \
|
||||||
{ \
|
} \
|
||||||
i = 8 - bits_left; \
|
else \
|
||||||
j = 8 - i; \
|
{ \
|
||||||
outputBuffer[opb_index++] |= _data >> i; \
|
i = 8 - bits_left; \
|
||||||
outputBuffer[opb_index] |= _data << j; \
|
j = 8 - i; \
|
||||||
bits_left = j; \
|
outputBuffer[opb_index++] |= _data >> i; \
|
||||||
} \
|
outputBuffer[opb_index] |= _data << j; \
|
||||||
} while (0)
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 9 bits into outputBuffer
|
insert 9 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_9_bits(_data16) \
|
#define insert_9_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 9 - bits_left; \
|
|
||||||
j = 8 - i; \
|
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
|
||||||
bits_left = j; \
|
|
||||||
if (bits_left == 0) \
|
|
||||||
{ \
|
{ \
|
||||||
opb_index++; \
|
i = 9 - bits_left; \
|
||||||
bits_left = 8; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
|
bits_left = j; \
|
||||||
|
if (bits_left == 0) \
|
||||||
|
{ \
|
||||||
|
opb_index++; \
|
||||||
|
bits_left = 8; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 10 bits into outputBuffer
|
insert 10 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_10_bits(_data16) \
|
#define insert_10_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 10 - bits_left; \
|
|
||||||
if ((bits_left >= 3) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 10 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if ((bits_left >= 3) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
{ \
|
bits_left = j; \
|
||||||
j = i - 8; \
|
} \
|
||||||
k = 8 - j; \
|
else \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
j = i - 8; \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
k = 8 - j; \
|
||||||
bits_left = k; \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 11 bits into outputBuffer
|
insert 11 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_11_bits(_data16) \
|
#define insert_11_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 11 - bits_left; \
|
|
||||||
if ((bits_left >= 4) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 11 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if ((bits_left >= 4) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
{ \
|
bits_left = j; \
|
||||||
j = i - 8; \
|
} \
|
||||||
k = 8 - j; \
|
else \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
j = i - 8; \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
k = 8 - j; \
|
||||||
bits_left = k; \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 12 bits into outputBuffer
|
insert 12 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_12_bits(_data16) \
|
#define insert_12_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 12 - bits_left; \
|
|
||||||
if ((bits_left >= 5) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 12 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if ((bits_left >= 5) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
{ \
|
bits_left = j; \
|
||||||
j = i - 8; \
|
} \
|
||||||
k = 8 - j; \
|
else \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
j = i - 8; \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
k = 8 - j; \
|
||||||
bits_left = k; \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 13 bits into outputBuffer
|
insert 13 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_13_bits(_data16) \
|
#define insert_13_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 13 - bits_left; \
|
|
||||||
if ((bits_left >= 6) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 13 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if ((bits_left >= 6) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
{ \
|
bits_left = j; \
|
||||||
j = i - 8; \
|
} \
|
||||||
k = 8 - j; \
|
else \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
j = i - 8; \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
k = 8 - j; \
|
||||||
bits_left = k; \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 14 bits into outputBuffer
|
insert 14 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_14_bits(_data16) \
|
#define insert_14_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 14 - bits_left; \
|
|
||||||
if ((bits_left >= 7) && (bits_left <= 8)) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 14 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if ((bits_left >= 7) && (bits_left <= 8)) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
{ \
|
bits_left = j; \
|
||||||
j = i - 8; \
|
} \
|
||||||
k = 8 - j; \
|
else \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
{ \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
j = i - 8; \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
k = 8 - j; \
|
||||||
bits_left = k; \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
} while (0)
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
insert 15 bits into outputBuffer
|
insert 15 bits into outputBuffer
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define insert_15_bits(_data16) \
|
#define insert_15_bits(_data16) \
|
||||||
do \
|
do \
|
||||||
{ \
|
|
||||||
i = 15 - bits_left; \
|
|
||||||
if (bits_left == 8) \
|
|
||||||
{ \
|
{ \
|
||||||
j = 8 - i; \
|
i = 15 - bits_left; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
if (bits_left == 8) \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
{ \
|
||||||
bits_left = j; \
|
j = 8 - i; \
|
||||||
} \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
else \
|
outputBuffer[opb_index] |= (char) (_data16 << j); \
|
||||||
|
bits_left = j; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
j = i - 8; \
|
||||||
|
k = 8 - j; \
|
||||||
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
|
bits_left = k; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
insert 16 bits into outputBuffer
|
||||||
|
******************************************************************************/
|
||||||
|
#define insert_16_bits(_data16) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
i = 16 - bits_left; \
|
||||||
j = i - 8; \
|
j = i - 8; \
|
||||||
k = 8 - j; \
|
k = 8 - j; \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
||||||
bits_left = k; \
|
bits_left = k; \
|
||||||
} \
|
} while (0)
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
insert 16 bits into outputBuffer
|
|
||||||
******************************************************************************/
|
|
||||||
#define insert_16_bits(_data16) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
i = 16 - bits_left; \
|
|
||||||
j = i - 8; \
|
|
||||||
k = 8 - j; \
|
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> i); \
|
|
||||||
outputBuffer[opb_index++] |= (char) (_data16 >> j); \
|
|
||||||
outputBuffer[opb_index] |= (char) (_data16 << k); \
|
|
||||||
bits_left = k; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize mppc_enc structure
|
* Initialize mppc_enc structure
|
||||||
@ -670,8 +670,8 @@ compress_rdp_5(struct xrdp_mppc_enc *enc, tui8 *srcData, int len)
|
|||||||
|
|
||||||
/* double check that we have a pattern match */
|
/* double check that we have a pattern match */
|
||||||
if ((*cptr1 != *cptr2) ||
|
if ((*cptr1 != *cptr2) ||
|
||||||
(*(cptr1 + 1) != *(cptr2 + 1)) ||
|
(*(cptr1 + 1) != *(cptr2 + 1)) ||
|
||||||
(*(cptr1 + 2) != *(cptr2 + 2)))
|
(*(cptr1 + 2) != *(cptr2 + 2)))
|
||||||
{
|
{
|
||||||
/* no match found; encode literal byte */
|
/* no match found; encode literal byte */
|
||||||
data = *cptr1;
|
data = *cptr1;
|
||||||
@ -703,7 +703,7 @@ compress_rdp_5(struct xrdp_mppc_enc *enc, tui8 *srcData, int len)
|
|||||||
}
|
}
|
||||||
saved_ctr = ctr + lom;
|
saved_ctr = ctr + lom;
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "<%ld: %u,%d> ", (historyPointer + ctr) - hbuf_start,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "<%ld: %u,%d> ", (historyPointer + ctr) - hbuf_start,
|
||||||
copy_offset, lom);
|
copy_offset, lom);
|
||||||
|
|
||||||
/* compute CRC for matching segment and store in hash table */
|
/* compute CRC for matching segment and store in hash table */
|
||||||
|
|
||||||
@ -984,7 +984,7 @@ compress_rdp_5(struct xrdp_mppc_enc *enc, tui8 *srcData, int len)
|
|||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "\n");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "\n");
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "compression ratio: %f", (float) len / (float) enc->bytes_in_opb);
|
LOG_DEVEL(LOG_LEVEL_TRACE, "compression ratio: %f", (float) len / (float) enc->bytes_in_opb);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1640,20 +1640,20 @@ xrdp_orders_mem_blt(struct xrdp_orders *self, int cache_id,
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* returns error */
|
/* returns error */
|
||||||
int
|
int
|
||||||
xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, int srcformat,
|
xrdp_orders_composite_blt(struct xrdp_orders *self, int srcidx, int srcformat,
|
||||||
int srcwidth, int srcrepeat, int* srctransform,
|
int srcwidth, int srcrepeat, int *srctransform,
|
||||||
int mskflags, int mskidx, int mskformat,
|
int mskflags, int mskidx, int mskformat,
|
||||||
int mskwidth, int mskrepeat, int op,
|
int mskwidth, int mskrepeat, int op,
|
||||||
int srcx, int srcy, int mskx, int msky,
|
int srcx, int srcy, int mskx, int msky,
|
||||||
int dstx, int dsty, int width, int height,
|
int dstx, int dsty, int width, int height,
|
||||||
int dstformat,
|
int dstformat,
|
||||||
struct xrdp_rect* rect)
|
struct xrdp_rect *rect)
|
||||||
{
|
{
|
||||||
int order_flags;
|
int order_flags;
|
||||||
int vals[20];
|
int vals[20];
|
||||||
int present;
|
int present;
|
||||||
char* present_ptr;
|
char *present_ptr;
|
||||||
char* order_flags_ptr;
|
char *order_flags_ptr;
|
||||||
|
|
||||||
if (xrdp_orders_check(self, 80) != 0)
|
if (xrdp_orders_check(self, 80) != 0)
|
||||||
{
|
{
|
||||||
@ -1670,7 +1670,7 @@ xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, int srcformat,
|
|||||||
{
|
{
|
||||||
/* if clip is present, still check if it's needed */
|
/* if clip is present, still check if it's needed */
|
||||||
if (dstx < rect->left || dsty < rect->top ||
|
if (dstx < rect->left || dsty < rect->top ||
|
||||||
dstx + width > rect->right || dsty + height > rect->bottom)
|
dstx + width > rect->right || dsty + height > rect->bottom)
|
||||||
{
|
{
|
||||||
order_flags |= TS_BOUNDS;
|
order_flags |= TS_BOUNDS;
|
||||||
if (xrdp_orders_last_bounds(self, rect))
|
if (xrdp_orders_last_bounds(self, rect))
|
||||||
@ -1717,7 +1717,7 @@ xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, int srcformat,
|
|||||||
present_ptr = self->out_s->p;
|
present_ptr = self->out_s->p;
|
||||||
out_uint8s(self->out_s, 3);
|
out_uint8s(self->out_s, 3);
|
||||||
if ((order_flags & TS_BOUNDS) &&
|
if ((order_flags & TS_BOUNDS) &&
|
||||||
!(order_flags & TS_ZERO_BOUNDS_DELTAS))
|
!(order_flags & TS_ZERO_BOUNDS_DELTAS))
|
||||||
{
|
{
|
||||||
xrdp_orders_out_bounds(self, rect);
|
xrdp_orders_out_bounds(self, rect);
|
||||||
}
|
}
|
||||||
@ -2482,7 +2482,7 @@ xrdp_orders_cache_glyph(struct xrdp_orders *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* returns error */
|
/* returns error */
|
||||||
static int write_2byte_signed(struct stream * s, int value)
|
static int write_2byte_signed(struct stream *s, int value)
|
||||||
{
|
{
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
int negative = 0;
|
int negative = 0;
|
||||||
@ -2528,7 +2528,7 @@ static int write_2byte_signed(struct stream * s, int value)
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* returns error */
|
/* returns error */
|
||||||
static int write_2byte_unsigned(struct stream * s, unsigned int value)
|
static int write_2byte_unsigned(struct stream *s, unsigned int value)
|
||||||
{
|
{
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
@ -2594,9 +2594,9 @@ xrdp_orders_cache_glyph_v2(struct xrdp_orders *self,
|
|||||||
|
|
||||||
out_uint8(self->out_s, char_index);
|
out_uint8(self->out_s, char_index);
|
||||||
if (write_2byte_signed(self->out_s, font_char->offset) ||
|
if (write_2byte_signed(self->out_s, font_char->offset) ||
|
||||||
write_2byte_signed(self->out_s, font_char->baseline) ||
|
write_2byte_signed(self->out_s, font_char->baseline) ||
|
||||||
write_2byte_unsigned(self->out_s, font_char->width) ||
|
write_2byte_unsigned(self->out_s, font_char->width) ||
|
||||||
write_2byte_unsigned(self->out_s, font_char->height))
|
write_2byte_unsigned(self->out_s, font_char->height))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2887,7 +2887,7 @@ xrdp_orders_send_as_rfx(struct xrdp_orders *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "width %d height %d rfx_min_pixel %d", width, height,
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "width %d height %d rfx_min_pixel %d", width, height,
|
||||||
self->rfx_min_pixel);
|
self->rfx_min_pixel);
|
||||||
if (width * height < self->rfx_min_pixel)
|
if (width * height < self->rfx_min_pixel)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -99,8 +99,8 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ALWAYS,"Warning: Your configured crypt level is "
|
LOG(LOG_LEVEL_ALWAYS, "Warning: Your configured crypt level is "
|
||||||
"undefined, 'high' will be used");
|
"undefined, 'high' will be used");
|
||||||
client_info->crypt_level = 3;
|
client_info->crypt_level = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,17 +109,17 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
client_info->channels_allowed = g_text2bool(value);
|
client_info->channels_allowed = g_text2bool(value);
|
||||||
if (client_info->channels_allowed == 0)
|
if (client_info->channels_allowed == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,"Info - All channels are disabled");
|
LOG(LOG_LEVEL_DEBUG, "Info - All channels are disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "allow_multimon") == 0)
|
else if (g_strcasecmp(item, "allow_multimon") == 0)
|
||||||
{
|
{
|
||||||
client_info->multimon = g_text2bool(value);
|
client_info->multimon = g_text2bool(value);
|
||||||
if (client_info->multimon == 0)
|
if (client_info->multimon == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,"Info - Multi monitor server support disabled");
|
LOG(LOG_LEVEL_DEBUG, "Info - Multi monitor server support disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "max_bpp") == 0)
|
else if (g_strcasecmp(item, "max_bpp") == 0)
|
||||||
{
|
{
|
||||||
client_info->max_bpp = g_atoi(value);
|
client_info->max_bpp = g_atoi(value);
|
||||||
@ -160,8 +160,8 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ALWAYS,"Warning: Your configured fastpath level is "
|
LOG(LOG_LEVEL_ALWAYS, "Warning: Your configured fastpath level is "
|
||||||
"undefined, fastpath will not be used");
|
"undefined, fastpath will not be used");
|
||||||
client_info->use_fast_path = 0;
|
client_info->use_fast_path = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,8 +205,8 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR, "security_layer=%s is not "
|
LOG(LOG_LEVEL_ERROR, "security_layer=%s is not "
|
||||||
"recognized, will use security_layer=negotiate",
|
"recognized, will use security_layer=negotiate",
|
||||||
value);
|
value);
|
||||||
client_info->security_layer = PROTOCOL_SSL | PROTOCOL_HYBRID | PROTOCOL_HYBRID_EX;
|
client_info->security_layer = PROTOCOL_SSL | PROTOCOL_HYBRID | PROTOCOL_HYBRID_EX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,8 +218,8 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
/* default certificate path */
|
/* default certificate path */
|
||||||
g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH);
|
g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH);
|
||||||
LOG(LOG_LEVEL_INFO,
|
LOG(LOG_LEVEL_INFO,
|
||||||
"Using default X.509 certificate: %s",
|
"Using default X.509 certificate: %s",
|
||||||
client_info->certificate);
|
client_info->certificate);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (value[0] != '/')
|
else if (value[0] != '/')
|
||||||
@ -227,8 +227,8 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
/* default certificate path */
|
/* default certificate path */
|
||||||
g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH);
|
g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH);
|
||||||
LOG(LOG_LEVEL_WARNING,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"X.509 certificate should use absolute path, using "
|
"X.509 certificate should use absolute path, using "
|
||||||
"default instead: %s", client_info->certificate);
|
"default instead: %s", client_info->certificate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -236,10 +236,10 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
g_strncpy(client_info->certificate, value, 1023);
|
g_strncpy(client_info->certificate, value, 1023);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_file_readable(client_info->certificate))
|
if (!g_file_readable(client_info->certificate))
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR, "Cannot read certificate file %s: %s",
|
LOG(LOG_LEVEL_ERROR, "Cannot read certificate file %s: %s",
|
||||||
client_info->certificate, g_get_strerror());
|
client_info->certificate, g_get_strerror());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "key_file") == 0)
|
else if (g_strcasecmp(item, "key_file") == 0)
|
||||||
@ -250,15 +250,15 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
/* default key_file path */
|
/* default key_file path */
|
||||||
g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH);
|
g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH);
|
||||||
LOG(LOG_LEVEL_INFO, "Using default X.509 key file: %s",
|
LOG(LOG_LEVEL_INFO, "Using default X.509 key file: %s",
|
||||||
client_info->key_file);
|
client_info->key_file);
|
||||||
}
|
}
|
||||||
else if (value[0] != '/')
|
else if (value[0] != '/')
|
||||||
{
|
{
|
||||||
/* default key_file path */
|
/* default key_file path */
|
||||||
g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH);
|
g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH);
|
||||||
LOG(LOG_LEVEL_WARNING,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"X.509 key file should use absolute path, using "
|
"X.509 key file should use absolute path, using "
|
||||||
"default instead: %s", client_info->key_file);
|
"default instead: %s", client_info->key_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -269,7 +269,7 @@ xrdp_rdp_read_config(const char *xrdp_ini, struct xrdp_client_info *client_info)
|
|||||||
if (!g_file_readable(client_info->key_file))
|
if (!g_file_readable(client_info->key_file))
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_ERROR, "Cannot read private key file %s: %s",
|
LOG(LOG_LEVEL_ERROR, "Cannot read private key file %s: %s",
|
||||||
client_info->key_file, g_get_strerror());
|
client_info->key_file, g_get_strerror());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "domain_user_separator") == 0
|
else if (g_strcasecmp(item, "domain_user_separator") == 0
|
||||||
@ -304,9 +304,9 @@ cpuid(tui32 info, tui32 *eax, tui32 *ebx, tui32 *ecx, tui32 *edx)
|
|||||||
"cpuid;"
|
"cpuid;"
|
||||||
"xchg %%rbx, %%rsi;"
|
"xchg %%rbx, %%rsi;"
|
||||||
#endif
|
#endif
|
||||||
: "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx)
|
: "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx)
|
||||||
: "0" (info)
|
: "0" (info)
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -575,8 +575,8 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
|
|||||||
if (compress_rdp(mppc_enc, (tui8 *)(s->p + 18), tocomplen))
|
if (compress_rdp(mppc_enc, (tui8 *)(s->p + 18), tocomplen))
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "mppc_encode ok flags 0x%x bytes_in_opb %d historyOffset %d "
|
LOG_DEVEL(LOG_LEVEL_TRACE, "mppc_encode ok flags 0x%x bytes_in_opb %d historyOffset %d "
|
||||||
"tocomplen %d", mppc_enc->flags, mppc_enc->bytes_in_opb,
|
"tocomplen %d", mppc_enc->flags, mppc_enc->bytes_in_opb,
|
||||||
mppc_enc->historyOffset, tocomplen);
|
mppc_enc->historyOffset, tocomplen);
|
||||||
|
|
||||||
clen = mppc_enc->bytes_in_opb + 18;
|
clen = mppc_enc->bytes_in_opb + 18;
|
||||||
pdulen = clen;
|
pdulen = clen;
|
||||||
@ -602,8 +602,8 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_data: mppc_encode not ok "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_data: mppc_encode not ok "
|
||||||
"type %d flags %d", mppc_enc->protocol_type,
|
"type %d flags %d", mppc_enc->protocol_type,
|
||||||
mppc_enc->flags);
|
mppc_enc->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,7 +731,7 @@ xrdp_rdp_send_fastpath(struct xrdp_rdp *self, struct stream *s,
|
|||||||
}
|
}
|
||||||
send_len = no_comp_len;
|
send_len = no_comp_len;
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: no_comp_len %d fragmentation %d",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: no_comp_len %d fragmentation %d",
|
||||||
no_comp_len, fragmentation);
|
no_comp_len, fragmentation);
|
||||||
if ((compression != 0) && (no_comp_len > header_bytes + 16))
|
if ((compression != 0) && (no_comp_len > header_bytes + 16))
|
||||||
{
|
{
|
||||||
to_comp_len = no_comp_len - header_bytes;
|
to_comp_len = no_comp_len - header_bytes;
|
||||||
@ -741,13 +741,13 @@ xrdp_rdp_send_fastpath(struct xrdp_rdp *self, struct stream *s,
|
|||||||
{
|
{
|
||||||
comp_len = mppc_enc->bytes_in_opb + header_bytes;
|
comp_len = mppc_enc->bytes_in_opb + header_bytes;
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: no_comp_len %d "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: no_comp_len %d "
|
||||||
"comp_len %d", no_comp_len, comp_len);
|
"comp_len %d", no_comp_len, comp_len);
|
||||||
send_len = comp_len;
|
send_len = comp_len;
|
||||||
comp_type = mppc_enc->flags;
|
comp_type = mppc_enc->flags;
|
||||||
/* outputBuffer has 64 bytes preceding it */
|
/* outputBuffer has 64 bytes preceding it */
|
||||||
g_memset(&comp_s, 0, sizeof(comp_s));
|
g_memset(&comp_s, 0, sizeof(comp_s));
|
||||||
comp_s.data = mppc_enc->outputBuffer -
|
comp_s.data = mppc_enc->outputBuffer -
|
||||||
(rdp_offset + header_bytes);
|
(rdp_offset + header_bytes);
|
||||||
comp_s.p = comp_s.data + rdp_offset;
|
comp_s.p = comp_s.data + rdp_offset;
|
||||||
comp_s.end = comp_s.p + send_len;
|
comp_s.end = comp_s.p + send_len;
|
||||||
comp_s.size = send_len;
|
comp_s.size = send_len;
|
||||||
@ -758,13 +758,13 @@ xrdp_rdp_send_fastpath(struct xrdp_rdp *self, struct stream *s,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: mppc_encode not ok "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_rdp_send_fastpath: mppc_encode not ok "
|
||||||
"type %d flags %d", mppc_enc->protocol_type,
|
"type %d flags %d", mppc_enc->protocol_type,
|
||||||
mppc_enc->flags);
|
mppc_enc->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateHeader = (updateCode & 15) |
|
updateHeader = (updateCode & 15) |
|
||||||
((fragmentation & 3) << 4) |
|
((fragmentation & 3) << 4) |
|
||||||
((compression & 3) << 6);
|
((compression & 3) << 6);
|
||||||
out_uint8(&send_s, updateHeader);
|
out_uint8(&send_s, updateHeader);
|
||||||
if (compression != 0)
|
if (compression != 0)
|
||||||
{
|
{
|
||||||
@ -870,20 +870,20 @@ xrdp_rdp_incoming(struct xrdp_rdp *self)
|
|||||||
if (iso->selectedProtocol > PROTOCOL_RDP)
|
if (iso->selectedProtocol > PROTOCOL_RDP)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_INFO,
|
LOG(LOG_LEVEL_INFO,
|
||||||
"TLS connection established from %s port %s: %s with cipher %s",
|
"TLS connection established from %s port %s: %s with cipher %s",
|
||||||
self->client_info.client_addr,
|
self->client_info.client_addr,
|
||||||
self->client_info.client_port,
|
self->client_info.client_port,
|
||||||
iso->trans->ssl_protocol,
|
iso->trans->ssl_protocol,
|
||||||
iso->trans->cipher_name);
|
iso->trans->cipher_name);
|
||||||
}
|
}
|
||||||
/* log non-TLS connections */
|
/* log non-TLS connections */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_INFO,
|
LOG(LOG_LEVEL_INFO,
|
||||||
"Non-TLS connection established from %s port %s: "
|
"Non-TLS connection established from %s port %s: "
|
||||||
"encrypted with standard RDP security",
|
"encrypted with standard RDP security",
|
||||||
self->client_info.client_addr,
|
self->client_info.client_addr,
|
||||||
self->client_info.client_port);
|
self->client_info.client_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -929,7 +929,7 @@ xrdp_rdp_process_data_input(struct xrdp_rdp *self, struct stream *s)
|
|||||||
in_sint16_le(s, param1);
|
in_sint16_le(s, param1);
|
||||||
in_sint16_le(s, param2);
|
in_sint16_le(s, param2);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_rdp_process_data_input event %4.4x flags %4.4x param1 %d "
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_rdp_process_data_input event %4.4x flags %4.4x param1 %d "
|
||||||
"param2 %d time %d", msg_type, device_flags, param1, param2, time);
|
"param2 %d time %d", msg_type, device_flags, param1, param2, time);
|
||||||
|
|
||||||
if (self->session->callback != 0)
|
if (self->session->callback != 0)
|
||||||
{
|
{
|
||||||
@ -1216,9 +1216,9 @@ xrdp_rdp_process_frame_ack(struct xrdp_rdp *self, struct stream *s)
|
|||||||
{
|
{
|
||||||
int frame_id;
|
int frame_id;
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_rdp_process_frame_ack:");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_rdp_process_frame_ack:");
|
||||||
in_uint32_le(s, frame_id);
|
in_uint32_le(s, frame_id);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, " frame_id %d", frame_id);
|
LOG_DEVEL(LOG_LEVEL_TRACE, " frame_id %d", frame_id);
|
||||||
if (self->session->callback != 0)
|
if (self->session->callback != 0)
|
||||||
{
|
{
|
||||||
/* call to xrdp_wm.c : callback */
|
/* call to xrdp_wm.c : callback */
|
||||||
|
@ -236,7 +236,7 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
|
|||||||
char rdp_layout[256] = { 0 };
|
char rdp_layout[256] = { 0 };
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: keyboard_type [%d] keyboard_subtype [%d]",
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: keyboard_type [%d] keyboard_subtype [%d]",
|
||||||
client_info->keyboard_type, client_info->keyboard_subtype);
|
client_info->keyboard_type, client_info->keyboard_subtype);
|
||||||
|
|
||||||
/* infer model/variant */
|
/* infer model/variant */
|
||||||
/* TODO specify different X11 keyboard models/variants */
|
/* TODO specify different X11 keyboard models/variants */
|
||||||
@ -288,7 +288,7 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
|
|||||||
item = (char *)list_get_item(items, i);
|
item = (char *)list_get_item(items, i);
|
||||||
value = (char *)list_get_item(values, i);
|
value = (char *)list_get_item(values, i);
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_load_keyboard_layout: item %s value %s",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_load_keyboard_layout: item %s value %s",
|
||||||
item, value);
|
item, value);
|
||||||
if (g_strcasecmp(item, "keyboard_type") == 0)
|
if (g_strcasecmp(item, "keyboard_type") == 0)
|
||||||
{
|
{
|
||||||
int v = g_atoi(value);
|
int v = g_atoi(value);
|
||||||
@ -301,7 +301,7 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
|
|||||||
{
|
{
|
||||||
int v = g_atoi(value);
|
int v = g_atoi(value);
|
||||||
if (v != client_info->keyboard_subtype &&
|
if (v != client_info->keyboard_subtype &&
|
||||||
section_found == index)
|
section_found == index)
|
||||||
{
|
{
|
||||||
section_found = -1;
|
section_found = -1;
|
||||||
break;
|
break;
|
||||||
@ -355,8 +355,8 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
|
|||||||
* skipping over current section.
|
* skipping over current section.
|
||||||
*/
|
*/
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_load_keyboard_layout: skipping "
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_load_keyboard_layout: skipping "
|
||||||
"configuration item - %s, continuing to next "
|
"configuration item - %s, continuing to next "
|
||||||
"section", item);
|
"section", item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,14 +423,14 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
|
|||||||
list_delete(values);
|
list_delete(values);
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: model [%s] variant [%s] "
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: model [%s] variant [%s] "
|
||||||
"layout [%s] options [%s]", client_info->model,
|
"layout [%s] options [%s]", client_info->model,
|
||||||
client_info->variant, client_info->layout, client_info->options);
|
client_info->variant, client_info->layout, client_info->options);
|
||||||
g_file_close(fd);
|
g_file_close(fd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: error opening %s",
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_load_keyboard_layout: error opening %s",
|
||||||
keyboard_cfg_file);
|
keyboard_cfg_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
|
|||||||
/* must be or error */
|
/* must be or error */
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_process_logon_info: flags wrong, major error");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_process_logon_info: flags wrong, major error");
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_sec_process_logon_info: flags wrong, likely decrypt "
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_sec_process_logon_info: flags wrong, likely decrypt "
|
||||||
"not working");
|
"not working");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self->rdp_layer->client_info.domain_user_separator[0] != '\0'
|
if (self->rdp_layer->client_info.domain_user_separator[0] != '\0'
|
||||||
&& self->rdp_layer->client_info.domain[0] != '\0')
|
&& self->rdp_layer->client_info.domain[0] != '\0')
|
||||||
{
|
{
|
||||||
int size = sizeof(self->rdp_layer->client_info.username);
|
int size = sizeof(self->rdp_layer->client_info.username);
|
||||||
g_strncat(self->rdp_layer->client_info.username, self->rdp_layer->client_info.domain_user_separator, size - 1 - g_strlen(self->rdp_layer->client_info.domain_user_separator));
|
g_strncat(self->rdp_layer->client_info.username, self->rdp_layer->client_info.domain_user_separator, size - 1 - g_strlen(self->rdp_layer->client_info.domain_user_separator));
|
||||||
@ -1124,9 +1124,9 @@ xrdp_sec_fips_establish_keys(struct xrdp_sec *self)
|
|||||||
|
|
||||||
fips_ivec = (const char *) g_fips_ivec;
|
fips_ivec = (const char *) g_fips_ivec;
|
||||||
self->encrypt_fips_info =
|
self->encrypt_fips_info =
|
||||||
ssl_des3_encrypt_info_create(self->fips_encrypt_key, fips_ivec);
|
ssl_des3_encrypt_info_create(self->fips_encrypt_key, fips_ivec);
|
||||||
self->decrypt_fips_info =
|
self->decrypt_fips_info =
|
||||||
ssl_des3_decrypt_info_create(self->fips_decrypt_key, fips_ivec);
|
ssl_des3_decrypt_info_create(self->fips_decrypt_key, fips_ivec);
|
||||||
self->sign_fips_info = ssl_hmac_info_create();
|
self->sign_fips_info = ssl_hmac_info_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1619,7 +1619,7 @@ xrdp_sec_send_fastpath(struct xrdp_sec *self, struct stream *s)
|
|||||||
/* http://msdn.microsoft.com/en-us/library/cc240510.aspx
|
/* http://msdn.microsoft.com/en-us/library/cc240510.aspx
|
||||||
2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) */
|
2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) */
|
||||||
static int
|
static int
|
||||||
xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec* self, struct stream* s)
|
xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec *self, struct stream *s)
|
||||||
{
|
{
|
||||||
int colorDepth;
|
int colorDepth;
|
||||||
int postBeta2ColorDepth;
|
int postBeta2ColorDepth;
|
||||||
@ -1764,7 +1764,7 @@ xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec* self, struct stream* s)
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int
|
static int
|
||||||
xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream *s)
|
||||||
{
|
{
|
||||||
int crypt_method;
|
int crypt_method;
|
||||||
int found;
|
int found;
|
||||||
@ -1789,8 +1789,8 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
}
|
}
|
||||||
found = 0;
|
found = 0;
|
||||||
if ((found == 0) &&
|
if ((found == 0) &&
|
||||||
(self->crypt_method & CRYPT_METHOD_FIPS) &&
|
(self->crypt_method & CRYPT_METHOD_FIPS) &&
|
||||||
(self->crypt_level == CRYPT_LEVEL_FIPS))
|
(self->crypt_level == CRYPT_LEVEL_FIPS))
|
||||||
{
|
{
|
||||||
if (crypt_method & CRYPT_METHOD_FIPS)
|
if (crypt_method & CRYPT_METHOD_FIPS)
|
||||||
{
|
{
|
||||||
@ -1801,8 +1801,8 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((found == 0) &&
|
if ((found == 0) &&
|
||||||
(self->crypt_method & CRYPT_METHOD_128BIT) &&
|
(self->crypt_method & CRYPT_METHOD_128BIT) &&
|
||||||
(self->crypt_level == CRYPT_LEVEL_HIGH))
|
(self->crypt_level == CRYPT_LEVEL_HIGH))
|
||||||
{
|
{
|
||||||
if (crypt_method & CRYPT_METHOD_128BIT)
|
if (crypt_method & CRYPT_METHOD_128BIT)
|
||||||
{
|
{
|
||||||
@ -1814,8 +1814,8 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((found == 0) &&
|
if ((found == 0) &&
|
||||||
(self->crypt_method & CRYPT_METHOD_40BIT) &&
|
(self->crypt_method & CRYPT_METHOD_40BIT) &&
|
||||||
(self->crypt_level == CRYPT_LEVEL_CLIENT_COMPATIBLE))
|
(self->crypt_level == CRYPT_LEVEL_CLIENT_COMPATIBLE))
|
||||||
{
|
{
|
||||||
if (crypt_method & CRYPT_METHOD_40BIT)
|
if (crypt_method & CRYPT_METHOD_40BIT)
|
||||||
{
|
{
|
||||||
@ -1827,8 +1827,8 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((found == 0) &&
|
if ((found == 0) &&
|
||||||
(self->crypt_method & CRYPT_METHOD_40BIT) &&
|
(self->crypt_method & CRYPT_METHOD_40BIT) &&
|
||||||
(self->crypt_level == CRYPT_LEVEL_LOW))
|
(self->crypt_level == CRYPT_LEVEL_LOW))
|
||||||
{
|
{
|
||||||
if (crypt_method & CRYPT_METHOD_40BIT)
|
if (crypt_method & CRYPT_METHOD_40BIT)
|
||||||
{
|
{
|
||||||
@ -1840,7 +1840,7 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((found == 0) &&
|
if ((found == 0) &&
|
||||||
(self->crypt_level == CRYPT_LEVEL_NONE))
|
(self->crypt_level == CRYPT_LEVEL_NONE))
|
||||||
{
|
{
|
||||||
if (crypt_method == CRYPT_METHOD_NONE)
|
if (crypt_method == CRYPT_METHOD_NONE)
|
||||||
{
|
{
|
||||||
@ -1851,11 +1851,11 @@ xrdp_sec_process_mcs_data_CS_SECURITY(struct xrdp_sec *self, struct stream* s)
|
|||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (found == 0)
|
// if (found == 0)
|
||||||
// {
|
// {
|
||||||
// LOG_DEVEL(LOG_LEVEL_TRACE, " can not find client / server agreed encryption method");
|
// LOG_DEVEL(LOG_LEVEL_TRACE, " can not find client / server agreed encryption method");
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1872,12 +1872,12 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
|
|||||||
|
|
||||||
client_info = &(self->rdp_layer->client_info);
|
client_info = &(self->rdp_layer->client_info);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "processing channels, channels_allowed is %d",
|
LOG_DEVEL(LOG_LEVEL_TRACE, "processing channels, channels_allowed is %d",
|
||||||
client_info->channels_allowed);
|
client_info->channels_allowed);
|
||||||
/* this is an option set in xrdp.ini */
|
/* this is an option set in xrdp.ini */
|
||||||
if (client_info->channels_allowed == 0) /* are channels on? */
|
if (client_info->channels_allowed == 0) /* are channels on? */
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_INFO, "all channels are disabled by "
|
LOG(LOG_LEVEL_INFO, "all channels are disabled by "
|
||||||
"configuration");
|
"configuration");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!s_check_rem(s, 4))
|
if (!s_check_rem(s, 4))
|
||||||
@ -1903,12 +1903,12 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
|
|||||||
{
|
{
|
||||||
channel_item->chanid = MCS_GLOBAL_CHANNEL + (index + 1);
|
channel_item->chanid = MCS_GLOBAL_CHANNEL + (index + 1);
|
||||||
LOG(LOG_LEVEL_INFO, "adding channel item name %s chan_id "
|
LOG(LOG_LEVEL_INFO, "adding channel item name %s chan_id "
|
||||||
"%d flags 0x%8.8x", channel_item->name,
|
"%d flags 0x%8.8x", channel_item->name,
|
||||||
channel_item->chanid, channel_item->flags);
|
channel_item->chanid, channel_item->flags);
|
||||||
list_add_item(self->mcs_layer->channel_list,
|
list_add_item(self->mcs_layer->channel_list,
|
||||||
(intptr_t) channel_item);
|
(intptr_t) channel_item);
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "got channel flags %8.8x name %s", channel_item->flags,
|
LOG_DEVEL(LOG_LEVEL_TRACE, "got channel flags %8.8x name %s", channel_item->flags,
|
||||||
channel_item->name);
|
channel_item->name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1940,7 +1940,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
if (client_info->multimon != 1) /* are multi-monitors allowed ? */
|
if (client_info->multimon != 1) /* are multi-monitors allowed ? */
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not "
|
LOG_DEVEL(LOG_LEVEL_INFO, "[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not "
|
||||||
"allowed, skipping");
|
"allowed, skipping");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
in_uint32_le(s, flags); /* flags */
|
in_uint32_le(s, flags); /* flags */
|
||||||
@ -1948,7 +1948,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
if (flags != 0)
|
if (flags != 0)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: flags MUST be "
|
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: flags MUST be "
|
||||||
"zero, detected: %d", flags);
|
"zero, detected: %d", flags);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
in_uint32_le(s, monitorCount);
|
in_uint32_le(s, monitorCount);
|
||||||
@ -1956,7 +1956,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
if (monitorCount > 16)
|
if (monitorCount > 16)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: max allowed "
|
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: max allowed "
|
||||||
"monitors is 16, detected: %d", monitorCount);
|
"monitors is 16, detected: %d", monitorCount);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1998,12 +1998,12 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_sec_process_mcs_data_monitors: got a monitor [%d]: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d",
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_sec_process_mcs_data_monitors: got a monitor [%d]: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d",
|
||||||
index,
|
index,
|
||||||
client_info->minfo[index].left,
|
client_info->minfo[index].left,
|
||||||
client_info->minfo[index].top,
|
client_info->minfo[index].top,
|
||||||
client_info->minfo[index].right,
|
client_info->minfo[index].right,
|
||||||
client_info->minfo[index].bottom,
|
client_info->minfo[index].bottom,
|
||||||
client_info->minfo[index].is_primary);
|
client_info->minfo[index].is_primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!got_primary)
|
if (!got_primary)
|
||||||
@ -2028,7 +2028,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
}
|
}
|
||||||
/* make sure virtual desktop size is ok */
|
/* make sure virtual desktop size is ok */
|
||||||
if (client_info->width > 0x7FFE || client_info->width < 0xC8 ||
|
if (client_info->width > 0x7FFE || client_info->width < 0xC8 ||
|
||||||
client_info->height > 0x7FFE || client_info->height < 0xC8)
|
client_info->height > 0x7FFE || client_info->height < 0xC8)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: error, virtual desktop width / height is too large");
|
LOG_DEVEL(LOG_LEVEL_INFO, "[ERROR] xrdp_sec_process_mcs_data_monitors: error, virtual desktop width / height is too large");
|
||||||
return 1; /* error */
|
return 1; /* error */
|
||||||
@ -2077,7 +2077,7 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self)
|
|||||||
if ((size < 4) || (!s_check_rem(s, size - 4)))
|
if ((size < 4) || (!s_check_rem(s, size - 4)))
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "error in xrdp_sec_process_mcs_data tag %d size %d",
|
LOG_DEVEL(LOG_LEVEL_INFO, "error in xrdp_sec_process_mcs_data tag %d size %d",
|
||||||
tag, size);
|
tag, size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2110,17 +2110,17 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* CS_MCS_MSGCHANNEL 0xC006
|
/* CS_MCS_MSGCHANNEL 0xC006
|
||||||
CS_MONITOR_EX 0xC008
|
CS_MONITOR_EX 0xC008
|
||||||
CS_MULTITRANSPORT 0xC00A
|
CS_MULTITRANSPORT 0xC00A
|
||||||
SC_CORE 0x0C01
|
SC_CORE 0x0C01
|
||||||
SC_SECURITY 0x0C02
|
SC_SECURITY 0x0C02
|
||||||
SC_NET 0x0C03
|
SC_NET 0x0C03
|
||||||
SC_MCS_MSGCHANNEL 0x0C04
|
SC_MCS_MSGCHANNEL 0x0C04
|
||||||
SC_MULTITRANSPORT 0x0C08 */
|
SC_MULTITRANSPORT 0x0C08 */
|
||||||
default:
|
default:
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "error unknown xrdp_sec_process_mcs_data "
|
LOG_DEVEL(LOG_LEVEL_INFO, "error unknown xrdp_sec_process_mcs_data "
|
||||||
"tag 0x%4.4x size %d", tag, size);
|
"tag 0x%4.4x size %d", tag, size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2130,14 +2130,14 @@ xrdp_sec_process_mcs_data(struct xrdp_sec *self)
|
|||||||
if (self->rdp_layer->client_info.max_bpp > 0)
|
if (self->rdp_layer->client_info.max_bpp > 0)
|
||||||
{
|
{
|
||||||
if (self->rdp_layer->client_info.bpp >
|
if (self->rdp_layer->client_info.bpp >
|
||||||
self->rdp_layer->client_info.max_bpp)
|
self->rdp_layer->client_info.max_bpp)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_rdp_parse_client_mcs_data: client asked "
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_rdp_parse_client_mcs_data: client asked "
|
||||||
"for %dbpp connection but configuration is limited "
|
"for %dbpp connection but configuration is limited "
|
||||||
"to %dbpp", self->rdp_layer->client_info.bpp,
|
"to %dbpp", self->rdp_layer->client_info.bpp,
|
||||||
self->rdp_layer->client_info.max_bpp);
|
self->rdp_layer->client_info.max_bpp);
|
||||||
self->rdp_layer->client_info.bpp =
|
self->rdp_layer->client_info.bpp =
|
||||||
self->rdp_layer->client_info.max_bpp;
|
self->rdp_layer->client_info.max_bpp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2292,10 +2292,10 @@ xrdp_sec_incoming(struct xrdp_sec *self)
|
|||||||
LOG_DEVEL(LOG_LEVEL_TRACE, " in xrdp_sec_incoming: init tls security");
|
LOG_DEVEL(LOG_LEVEL_TRACE, " in xrdp_sec_incoming: init tls security");
|
||||||
|
|
||||||
if (trans_set_tls_mode(self->mcs_layer->iso_layer->trans,
|
if (trans_set_tls_mode(self->mcs_layer->iso_layer->trans,
|
||||||
self->rdp_layer->client_info.key_file,
|
self->rdp_layer->client_info.key_file,
|
||||||
self->rdp_layer->client_info.certificate,
|
self->rdp_layer->client_info.certificate,
|
||||||
self->rdp_layer->client_info.ssl_protocols,
|
self->rdp_layer->client_info.ssl_protocols,
|
||||||
self->rdp_layer->client_info.tls_ciphers) != 0)
|
self->rdp_layer->client_info.tls_ciphers) != 0)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_incoming: trans_set_tls_mode failed");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_incoming: trans_set_tls_mode failed");
|
||||||
return 1;
|
return 1;
|
||||||
@ -2329,7 +2329,7 @@ xrdp_sec_incoming(struct xrdp_sec *self)
|
|||||||
{
|
{
|
||||||
/* this is a show stopper */
|
/* this is a show stopper */
|
||||||
LOG(LOG_LEVEL_ALWAYS, "XRDP cannot read file: %s "
|
LOG(LOG_LEVEL_ALWAYS, "XRDP cannot read file: %s "
|
||||||
"(check permissions)", key_file);
|
"(check permissions)", key_file);
|
||||||
list_delete(items);
|
list_delete(items);
|
||||||
list_delete(values);
|
list_delete(values);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2367,7 +2367,7 @@ xrdp_sec_incoming(struct xrdp_sec *self)
|
|||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "warning, RSA key len 512 "
|
LOG_DEVEL(LOG_LEVEL_TRACE, "warning, RSA key len 512 "
|
||||||
"bits or less, consider creating a 2048 bit key");
|
"bits or less, consider creating a 2048 bit key");
|
||||||
LOG(LOG_LEVEL_WARNING, "warning, RSA key len 512 "
|
LOG(LOG_LEVEL_WARNING, "warning, RSA key len 512 "
|
||||||
"bits or less, consider creating a 2048 bit key");
|
"bits or less, consider creating a 2048 bit key");
|
||||||
}
|
}
|
||||||
|
|
||||||
list_delete(items);
|
list_delete(items);
|
||||||
@ -2382,9 +2382,9 @@ xrdp_sec_incoming(struct xrdp_sec *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "client mcs data received", self->client_mcs_data.data,
|
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "client mcs data received", self->client_mcs_data.data,
|
||||||
(int)(self->client_mcs_data.end - self->client_mcs_data.data));
|
(int)(self->client_mcs_data.end - self->client_mcs_data.data));
|
||||||
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "server mcs data sent", self->server_mcs_data.data,
|
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "server mcs data sent", self->server_mcs_data.data,
|
||||||
(int)(self->server_mcs_data.end - self->server_mcs_data.data));
|
(int)(self->server_mcs_data.end - self->server_mcs_data.data));
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, " out xrdp_sec_incoming");
|
LOG_DEVEL(LOG_LEVEL_TRACE, " out xrdp_sec_incoming");
|
||||||
if (xrdp_sec_in_mcs_data(self) != 0)
|
if (xrdp_sec_in_mcs_data(self) != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user