fastpath

Conflicts:
	libxrdp/xrdp_fastpath.c
ulab-next
speidy 11 years ago
commit d610101521

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2012 * Copyright (C) Jay Sorg 2012-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -3,7 +3,7 @@
* Miscellaneous protocol constants * Miscellaneous protocol constants
* *
* Copyright (C) Matthew Chapman 1999-2008 * Copyright (C) Matthew Chapman 1999-2008
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* Copyright (C) Kevin Zhou 2012 * Copyright (C) Kevin Zhou 2012
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2012-2013 * Copyright (C) Jay Sorg 2012-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script # Process this file with autoconf to produce a configure script
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT([xrdp], [0.7.0], [xrdp-devel@lists.sourceforge.net]) AC_INIT([xrdp], [0.9.0], [xrdp-devel@lists.sourceforge.net])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in) AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.6 foreign]) AM_INIT_AUTOMAKE([1.6 foreign])
AC_PROG_CC AC_PROG_CC

@ -45,8 +45,8 @@ int main(int argc, char **argv)
char text[256]; char text[256];
char *displayname = NULL; char *displayname = NULL;
char *outfname; char *outfname;
char *sections[5] = {"noshift", "shift", "altgr", "capslock", "shiftcapslock"}; char *sections[6] = {"noshift", "shift", "altgr", "shiftaltgr", "capslock", "shiftcapslock"};
int states[5] = {0, 1, 0x80, 2, 3}; int states[6] = {0, 1, 0x80, 0x81, 2, 3};
int i; int i;
int idx; int idx;
int char_count; int char_count;
@ -94,7 +94,7 @@ int main(int argc, char **argv)
e.display = dpy; e.display = dpy;
e.same_screen = True; e.same_screen = True;
for (idx = 0; idx < 5; idx++) /* Sections and states */ for (idx = 0; idx < 6; idx++) /* Sections and states */
{ {
fprintf(outf, "[%s]\n", sections[idx]); fprintf(outf, "[%s]\n", sections[idx]);
e.state = states[idx]; e.state = states[idx];

@ -1,35 +1,42 @@
Creating a new keymap file.
---------------------------
crating a new keymap file. The names of the files are of the format;
The names of the files are
km-xxxx.ini km-xxxx.ini
where the xxx is replaces ny the hex number of the layout of interest. where the xxxx is replaced by the hex number of the layout of interest.
The files have 6 sections;
The files have 5 section [noshift], [shift], [altgr], [shiftaltgr], [capslock], [shiftcapslock]
[noshift], [shift], [altgr], [capslock], [shiftcapslock] In each section there are multiple lines for each key.
In each section there are multiple lines for each key An example line looks like;
An example line looks like
Key10=49:49 Key10=49:49
In this line, 10 is the X11 scancode, the first 49 is the keysym value, In this line, 10 is the X11 scancode, the first 49 is the keysym value,
the second 49 if the unicode value of the key. This is the definition the second 49 if the unicode value of the key. This is the definition
for the 'noshift' '1' key on a en-us keyboard. In this case, the keysym for the 'noshift' '1' key on a en-us keyboard. In this case, the keysym
and the unicode value are the same. Here is an example where they are and the unicode value are the same.
not.
This is the definition for the backspace key. Here is an example where they are not;
This is the definition for the backspace key;
Key22=65288:8 Key22=65288:8
And this is the star on the keypad And this is the star on the keypad;
Key63=65450:42 Key63=65450:42
To create a new file run xrdp-genkeymap filename To create a new file run "xrdp-genkeymap <filename>"
Example: ./xrdp-genkeymap /etc/xrdp/km-0409.ini
Example ./xrdp-genkeymap /etc/xrdp/km-0409.ini Note: You need to have enough rights to be able to write to the
/etc/xrdp directory.
Note: You need to have rights to the /etc/xrdp directory. Alternatively, create the keymap file in a directory of your choice, then
copy or move it over to /etc/xrdp using sudo/su.

@ -62,7 +62,101 @@ libxrdp_disconnect(struct xrdp_session *session)
int EXPORT_CC int EXPORT_CC
libxrdp_process_incomming(struct xrdp_session *session) libxrdp_process_incomming(struct xrdp_session *session)
{ {
return xrdp_rdp_incoming((struct xrdp_rdp *)session->rdp); int rv;
rv = xrdp_rdp_incoming((struct xrdp_rdp *)(session->rdp));
return rv;
}
/*****************************************************************************/
int EXPORT_CC
libxrdp_get_pdu_bytes(const char *aheader)
{
int rv;
const tui8 *header;
rv = -1;
header = (const tui8 *) aheader;
if (header[0] == 0x03)
{
/* TPKT */
rv = (header[2] << 8) | header[3];
}
else if (header[0] == 0x30)
{
/* TSRequest (NLA) */
if (header[1] & 0x80)
{
if ((header[1] & ~(0x80)) == 1)
{
rv = header[2];
rv += 3;
}
else if ((header[1] & ~(0x80)) == 2)
{
rv = (header[2] << 8) | header[3];
rv += 4;
}
else
{
g_writeln("libxrdp_get_pdu_bytes: error TSRequest!");
return -1;
}
}
else
{
rv = header[1];
rv += 2;
}
}
else
{
/* Fast-Path */
if (header[1] & 0x80)
{
rv = ((header[1] & 0x7F) << 8) | header[2];
}
else
{
rv = header[1];
}
}
return rv;
}
/******************************************************************************/
/* only used durring connection */
struct stream * APP_CC
libxrdp_force_read(struct trans* trans)
{
int bytes;
struct stream *s;
s = trans->in_s;
init_stream(s, 32 * 1024);
if (trans_force_read(trans, 4) != 0)
{
g_writeln("libxrdp_force_read: error");
return 0;
}
bytes = libxrdp_get_pdu_bytes(s->data);
if (bytes < 1)
{
g_writeln("libxrdp_force_read: error");
return 0;
}
if (bytes > 32 * 1024)
{
g_writeln("libxrdp_force_read: error");
return 0;
}
if (trans_force_read(trans, bytes - 4) != 0)
{
g_writeln("libxrdp_force_read: error");
return 0;
}
return s;
} }
/******************************************************************************/ /******************************************************************************/
@ -74,9 +168,15 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
int code; int code;
int term; int term;
int dead_lock_counter; int dead_lock_counter;
int do_read;
struct xrdp_rdp *rdp; struct xrdp_rdp *rdp;
struct stream *ls;
do_read = s == 0;
if (do_read && session->up_and_running)
{
g_writeln("libxrdp_process_data: error logic");
return 1;
}
if (session->in_process_data != 0) if (session->in_process_data != 0)
{ {
g_writeln("libxrdp_process_data: error reentry"); g_writeln("libxrdp_process_data: error reentry");
@ -84,14 +184,6 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
} }
session->in_process_data++; session->in_process_data++;
ls = 0;
if (s == 0)
{
make_stream(ls);
init_stream(ls, 8192 * 4);
s = ls;
}
term = 0; term = 0;
cont = 1; cont = 1;
rv = 0; rv = 0;
@ -106,13 +198,26 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
if (session->is_term()) if (session->is_term())
{ {
term = 1; term = 1;
break;
} }
} }
code = 0; code = 0;
if (do_read)
{
s = libxrdp_force_read(session->trans);
if (s == 0)
{
g_writeln("libxrdp_process_data: libxrdp_force_read failed");
rv = 1;
break;
}
}
if (xrdp_rdp_recv(rdp, s, &code) != 0) if (xrdp_rdp_recv(rdp, s, &code) != 0)
{ {
g_writeln("libxrdp_process_data: xrdp_rdp_recv failed");
rv = 1; rv = 1;
break; break;
} }
@ -181,11 +286,6 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
} }
} }
if (s == ls)
{
free_stream(s);
}
session->in_process_data--; session->in_process_data--;
return rv; return rv;

@ -82,6 +82,10 @@ int DEFAULT_CC
libxrdp_disconnect(struct xrdp_session* session); libxrdp_disconnect(struct xrdp_session* session);
int DEFAULT_CC int DEFAULT_CC
libxrdp_process_incomming(struct xrdp_session* session); libxrdp_process_incomming(struct xrdp_session* session);
int EXPORT_CC
libxrdp_get_pdu_bytes(const char *aheader);
struct stream * APP_CC
libxrdp_force_read(struct trans* trans);
int DEFAULT_CC int DEFAULT_CC
libxrdp_process_data(struct xrdp_session* session, struct stream *s); libxrdp_process_data(struct xrdp_session* session, struct stream *s);
int DEFAULT_CC int DEFAULT_CC

@ -90,27 +90,21 @@ xrdp_iso_recv_msg(struct xrdp_iso *self, struct stream *s, int *code, int *len)
{ {
int ver; // TPKT Version int ver; // TPKT Version
int plen; // TPKT PacketLength int plen; // TPKT PacketLength
int do_read;
*code = 0; // X.224 Packet Type *code = 0; // X.224 Packet Type
*len = 0; // X.224 Length Indicator *len = 0; // X.224 Length Indicator
/* early in connection sequence, iso needs to do a force read */ if (s != self->trans->in_s)
do_read = s != self->trans->in_s;
if (do_read)
{ {
init_stream(s, 4); g_writeln("xrdp_iso_recv_msg error logic");
if (trans_force_read_s(self->trans, s, 4) != 0)
{
return 1;
}
} }
in_uint8(s, ver); in_uint8(s, ver);
if (ver != 3) if (ver != 3)
{ {
g_writeln("xrdp_iso_recv_msg: bad ver");
g_hexdump(s->data, 4);
return 1; return 1;
} }
@ -122,15 +116,6 @@ xrdp_iso_recv_msg(struct xrdp_iso *self, struct stream *s, int *code, int *len)
return 1; return 1;
} }
if (do_read)
{
init_stream(s, plen - 4);
if (trans_force_read_s(self->trans, s, plen - 4) != 0)
{
return 1;
}
}
if (!s_check_rem(s, 2)) if (!s_check_rem(s, 2))
{ {
return 1; return 1;
@ -311,20 +296,22 @@ xrdp_iso_incoming(struct xrdp_iso *self)
char *pend; char *pend;
struct stream *s; struct stream *s;
make_stream(s);
init_stream(s, 8192);
DEBUG((" in xrdp_iso_incoming")); DEBUG((" in xrdp_iso_incoming"));
s = libxrdp_force_read(self->trans);
if (s == 0)
{
return 1;
}
if (xrdp_iso_recv_msg(self, s, &code, &len) != 0) if (xrdp_iso_recv_msg(self, s, &code, &len) != 0)
{ {
DEBUG((" in xrdp_iso_recv_msg error!!")); DEBUG((" in xrdp_iso_recv_msg error!!"));
free_stream(s);
return 1; return 1;
} }
if ((code != ISO_PDU_CR) || (len < 6)) if ((code != ISO_PDU_CR) || (len < 6))
{ {
free_stream(s);
return 1; return 1;
} }
@ -343,7 +330,6 @@ xrdp_iso_incoming(struct xrdp_iso *self)
case RDP_NEG_REQ: /* rdpNegReq 1 */ case RDP_NEG_REQ: /* rdpNegReq 1 */
if (xrdp_iso_recv_rdpnegreq(self, s) != 0) if (xrdp_iso_recv_rdpnegreq(self, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
break; break;
@ -371,12 +357,10 @@ xrdp_iso_incoming(struct xrdp_iso *self)
if (xrdp_iso_send_nego(self) != 0) if (xrdp_iso_send_nego(self) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
DEBUG((" out xrdp_iso_incoming")); DEBUG((" out xrdp_iso_incoming"));
free_stream(s);
return 0; return 0;
} }

@ -129,6 +129,7 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
if (xrdp_iso_recv(self->iso_layer, s) != 0) if (xrdp_iso_recv(self->iso_layer, s) != 0)
{ {
DEBUG((" out xrdp_mcs_recv, xrdp_iso_recv return non zero")); DEBUG((" out xrdp_mcs_recv, xrdp_iso_recv return non zero"));
g_writeln("xrdp_mcs_recv: xrdp_iso_recv failed");
return 1; return 1;
} }
@ -150,12 +151,7 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
/* this is channels getting added from the client */ /* this is channels getting added from the client */
if (appid == MCS_CJRQ) if (appid == MCS_CJRQ)
{ {
if (s == self->iso_layer->trans->in_s)
{
/* this should not happen */
g_writeln("xrdp_mcs_recv: error, MCS_CJRQ at wrong time");
return 1;
}
if (!s_check_rem(s, 4)) if (!s_check_rem(s, 4))
{ {
return 1; return 1;
@ -170,6 +166,14 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
{ {
log_message(LOG_LEVEL_ERROR,"Non handled error from xrdp_mcs_send_cjcf") ; log_message(LOG_LEVEL_ERROR,"Non handled error from xrdp_mcs_send_cjcf") ;
} }
s = libxrdp_force_read(self->iso_layer->trans);
if (s == 0)
{
g_writeln("xrdp_mcs_recv: libxrdp_force_read failed");
return 1;
}
continue; continue;
} }
@ -321,30 +325,29 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
int len; int len;
struct stream *s; struct stream *s;
make_stream(s); s = libxrdp_force_read(self->iso_layer->trans);
init_stream(s, 16 * 1024); if (s == 0)
{
return 1;
}
if (xrdp_iso_recv(self->iso_layer, s) != 0) if (xrdp_iso_recv(self->iso_layer, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (xrdp_mcs_ber_parse_header(self, s, MCS_CONNECT_INITIAL, &len) != 0) if (xrdp_mcs_ber_parse_header(self, s, MCS_CONNECT_INITIAL, &len) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0) if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if ((len < 0) || !s_check_rem(s, len)) if ((len < 0) || !s_check_rem(s, len))
{ {
free_stream(s);
return 1; return 1;
} }
@ -352,13 +355,11 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0) if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if ((len < 0) || !s_check_rem(s, len)) if ((len < 0) || !s_check_rem(s, len))
{ {
free_stream(s);
return 1; return 1;
} }
@ -366,13 +367,11 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_BOOLEAN, &len) != 0) if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_BOOLEAN, &len) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if ((len < 0) || !s_check_rem(s, len)) if ((len < 0) || !s_check_rem(s, len))
{ {
free_stream(s);
return 1; return 1;
} }
@ -380,38 +379,32 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
if (xrdp_mcs_parse_domain_params(self, s) != 0) if (xrdp_mcs_parse_domain_params(self, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (xrdp_mcs_parse_domain_params(self, s) != 0) if (xrdp_mcs_parse_domain_params(self, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (xrdp_mcs_parse_domain_params(self, s) != 0) if (xrdp_mcs_parse_domain_params(self, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0) if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
/* mcs data can not be zero length */ /* mcs data can not be zero length */
if ((len <= 0) || (len > 16 * 1024)) if ((len <= 0) || (len > 16 * 1024))
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, len)) if (!s_check_rem(s, len))
{ {
free_stream(s);
return 1; return 1;
} }
@ -423,12 +416,10 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
if (s_check_end(s)) if (s_check_end(s))
{ {
free_stream(s);
return 0; return 0;
} }
else else
{ {
free_stream(s);
return 1; return 1;
} }
} }
@ -442,18 +433,20 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
struct stream *s; struct stream *s;
DEBUG((" in xrdp_mcs_recv_edrq")); DEBUG((" in xrdp_mcs_recv_edrq"));
make_stream(s);
init_stream(s, 8192); s = libxrdp_force_read(self->iso_layer->trans);
if (s == 0)
{
return 1;
}
if (xrdp_iso_recv(self->iso_layer, s) != 0) if (xrdp_iso_recv(self->iso_layer, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, 1)) if (!s_check_rem(s, 1))
{ {
free_stream(s);
return 1; return 1;
} }
@ -461,13 +454,11 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
if ((opcode >> 2) != MCS_EDRQ) if ((opcode >> 2) != MCS_EDRQ)
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, 4)) if (!s_check_rem(s, 4))
{ {
free_stream(s);
return 1; return 1;
} }
@ -478,7 +469,6 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
{ {
if (!s_check_rem(s, 2)) if (!s_check_rem(s, 2))
{ {
free_stream(s);
return 1; return 1;
} }
in_uint16_be(s, self->userid); in_uint16_be(s, self->userid);
@ -486,11 +476,9 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
if (!(s_check_end(s))) if (!(s_check_end(s)))
{ {
free_stream(s);
return 1; return 1;
} }
free_stream(s);
DEBUG((" out xrdp_mcs_recv_edrq")); DEBUG((" out xrdp_mcs_recv_edrq"));
return 0; return 0;
} }
@ -504,18 +492,20 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
struct stream *s; struct stream *s;
DEBUG((" in xrdp_mcs_recv_aurq")); DEBUG((" in xrdp_mcs_recv_aurq"));
make_stream(s);
init_stream(s, 8192); s = libxrdp_force_read(self->iso_layer->trans);
if (s == 0)
{
return 1;
}
if (xrdp_iso_recv(self->iso_layer, s) != 0) if (xrdp_iso_recv(self->iso_layer, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, 1)) if (!s_check_rem(s, 1))
{ {
free_stream(s);
return 1; return 1;
} }
@ -523,7 +513,6 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
if ((opcode >> 2) != MCS_AURQ) if ((opcode >> 2) != MCS_AURQ)
{ {
free_stream(s);
return 1; return 1;
} }
@ -531,7 +520,6 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
{ {
if (!s_check_rem(s, 2)) if (!s_check_rem(s, 2))
{ {
free_stream(s);
return 1; return 1;
} }
in_uint16_be(s, self->userid); in_uint16_be(s, self->userid);
@ -539,11 +527,9 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
if (!(s_check_end(s))) if (!(s_check_end(s)))
{ {
free_stream(s);
return 1; return 1;
} }
free_stream(s);
DEBUG((" out xrdp_mcs_recv_aurq")); DEBUG((" out xrdp_mcs_recv_aurq"));
return 0; return 0;
} }
@ -591,18 +577,19 @@ xrdp_mcs_recv_cjrq(struct xrdp_mcs *self)
int opcode; int opcode;
struct stream *s; struct stream *s;
make_stream(s); s = libxrdp_force_read(self->iso_layer->trans);
init_stream(s, 8192); if (s == 0)
{
return 1;
}
if (xrdp_iso_recv(self->iso_layer, s) != 0) if (xrdp_iso_recv(self->iso_layer, s) != 0)
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, 1)) if (!s_check_rem(s, 1))
{ {
free_stream(s);
return 1; return 1;
} }
@ -610,13 +597,11 @@ xrdp_mcs_recv_cjrq(struct xrdp_mcs *self)
if ((opcode >> 2) != MCS_CJRQ) if ((opcode >> 2) != MCS_CJRQ)
{ {
free_stream(s);
return 1; return 1;
} }
if (!s_check_rem(s, 4)) if (!s_check_rem(s, 4))
{ {
free_stream(s);
return 1; return 1;
} }
@ -626,7 +611,6 @@ xrdp_mcs_recv_cjrq(struct xrdp_mcs *self)
{ {
if (!s_check_rem(s, 2)) if (!s_check_rem(s, 2))
{ {
free_stream(s);
return 1; return 1;
} }
in_uint8s(s, 2); in_uint8s(s, 2);
@ -634,11 +618,9 @@ xrdp_mcs_recv_cjrq(struct xrdp_mcs *self)
if (!(s_check_end(s))) if (!(s_check_end(s)))
{ {
free_stream(s);
return 1; return 1;
} }
free_stream(s);
return 0; return 0;
} }

@ -299,17 +299,17 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
int pdu_code = 0; int pdu_code = 0;
int chan = 0; int chan = 0;
const tui8 *header; const tui8 *header;
header = (const tui8 *) (self->session->trans->in_s->p);
DEBUG(("in xrdp_rdp_recv")); DEBUG(("in xrdp_rdp_recv"));
if (s->next_packet == 0 || s->next_packet >= s->end) if (s->next_packet == 0 || s->next_packet >= s->end)
{ {
/* check for fastpath first */ /* check for fastpath first */
header = (const tui8 *) (self->session->trans->in_s->p);
if ((header[0] != 0x3) && (header[0] != 0x3c)) if ((header[0] != 0x3) && (header[0] != 0x3c))
{ {
if (xrdp_sec_recv_fastpath(self->sec_layer, s) != 0) if (xrdp_sec_recv_fastpath(self->sec_layer, s) != 0)
{ {
return 1; return 1;
} }
*code = 2; // special code for fastpath input *code = 2; // special code for fastpath input
DEBUG(("out (fastpath) xrdp_rdp_recv")); DEBUG(("out (fastpath) xrdp_rdp_recv"));
@ -331,6 +331,7 @@ xrdp_rdp_recv(struct xrdp_rdp *self, struct stream *s, int *code)
if (error != 0) if (error != 0)
{ {
DEBUG(("out xrdp_rdp_recv error")); DEBUG(("out xrdp_rdp_recv error"));
g_writeln("xrdp_rdp_recv: xrdp_sec_recv failed");
return 1; return 1;
} }

@ -545,6 +545,16 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
} }
in_uint16_le(s, len_user); in_uint16_le(s, len_user);
/*
* Microsoft's itap client running on Mac OS/Android
* always sends autologon credentials, even when user has not
* configured any
*/
if (len_user == 0)
{
self->rdp_layer->client_info.rdp_autologin = 0;
}
if (len_user > 511) if (len_user > 511)
{ {
DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_user > 511")); DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_user > 511"));
@ -986,6 +996,7 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
if (xrdp_mcs_recv(self->mcs_layer, s, chan) != 0) if (xrdp_mcs_recv(self->mcs_layer, s, chan) != 0)
{ {
DEBUG((" out xrdp_sec_recv : error")); DEBUG((" out xrdp_sec_recv : error"));
g_writeln("xrdp_sec_recv: xrdp_mcs_recv failed");
return 1; return 1;
} }

@ -1,9 +1,10 @@
xrdp 0.7.0 xrdp 0.9.0
Credits Credits
This project is very much dependent on FreeRDP(was rdesktop), the work of This project is very much dependent on NeutrinoRDP, FreeRDP, rdesktop, and
Matt Chapman and the FreeRDP team members, of which I'm a member. the work of Matt Chapman and the NeutrinoRDP team members, of which I'm a
member.
Mark from up 19.9 was the first to work with rdp server code. Mark from up 19.9 was the first to work with rdp server code.

@ -16,7 +16,7 @@ AlwaysGroupCheck = false
[Sessions] [Sessions]
X11DisplayOffset=10 X11DisplayOffset=10
MaxSessions=10 MaxSessions=50
# if 1, true, or yes, kill session after 60 seconds # if 1, true, or yes, kill session after 60 seconds
KillDisconnected=0 KillDisconnected=0
# if not zero, the seconds without mouse or keyboard input before disconnect # if not zero, the seconds without mouse or keyboard input before disconnect

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -435,7 +435,7 @@ main(int argc, char **argv)
{ {
g_writeln(""); g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server."); g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2013"); g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://xrdp.sourceforge.net for more information."); g_writeln("See http://xrdp.sourceforge.net for more information.");
g_writeln(""); g_writeln("");
g_writeln("Usage: xrdp [options]"); g_writeln("Usage: xrdp [options]");
@ -453,7 +453,7 @@ main(int argc, char **argv)
{ {
g_writeln(""); g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server."); g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2013"); g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://xrdp.sourceforge.net for more information."); g_writeln("See http://xrdp.sourceforge.net for more information.");
g_writeln("Version %s", PACKAGE_VERSION); g_writeln("Version %s", PACKAGE_VERSION);
g_writeln(""); g_writeln("");

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -114,63 +114,6 @@ xrdp_process_mod_end(struct xrdp_process *self)
return 0; return 0;
} }
/*****************************************************************************/
static int APP_CC
xrdp_process_get_pdu_bytes(const char *aheader)
{
int rv;
const tui8 *header;
rv = -1;
header = (const tui8 *) aheader;
if (header[0] == 0x03)
{
/* TPKT */
rv = (header[2] << 8) | header[3];
}
else if (header[0] == 0x30)
{
/* TSRequest (NLA) */
if (header[1] & 0x80)
{
if ((header[1] & ~(0x80)) == 1)
{
rv = header[2];
rv += 3;
}
else if ((header[1] & ~(0x80)) == 2)
{
rv = (header[2] << 8) | header[3];
rv += 4;
}
else
{
g_writeln("xrdp_process_get_packet_bytes: error TSRequest!");
return -1;
}
}
else
{
rv = header[1];
rv += 2;
}
}
else
{
/* Fast-Path */
if (header[1] & 0x80)
{
rv = ((header[1] & 0x7F) << 8) | header[2];
}
else
{
rv = header[1];
}
}
return rv;
}
/*****************************************************************************/ /*****************************************************************************/
static int DEFAULT_CC static int DEFAULT_CC
xrdp_process_data_in(struct trans *self) xrdp_process_data_in(struct trans *self)
@ -197,12 +140,13 @@ xrdp_process_data_in(struct trans *self)
{ {
pro->server_trans->extra_flags = 1; pro->server_trans->extra_flags = 1;
pro->server_trans->header_size = 4; pro->server_trans->header_size = 4;
init_stream(s, 0);
} }
break; break;
case 1: case 1:
/* we have enough now to get the PDU bytes */ /* we have enough now to get the PDU bytes */
len = xrdp_process_get_pdu_bytes(s->p); len = libxrdp_get_pdu_bytes(s->p);
if (len == -1) if (len == -1)
{ {
g_writeln("xrdp_process_data_in: " g_writeln("xrdp_process_data_in: "
@ -259,6 +203,8 @@ xrdp_process_main_loop(struct xrdp_process *self)
if (libxrdp_process_incomming(self->session) == 0) if (libxrdp_process_incomming(self->session) == 0)
{ {
init_stream(self->server_trans->in_s, 32 * 1024);
term_obj = g_get_term_event(); term_obj = g_get_term_event();
cont = 1; cont = 1;

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2013 * Copyright (C) Jay Sorg 2004-2014
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

@ -223,7 +223,7 @@ lib_mod_connect(struct mod *mod)
g_tcp_set_no_delay(mod->sck); g_tcp_set_no_delay(mod->sck);
} }
mod->server_msg(mod, "connecting...", 0); /* mod->server_msg(mod, "connecting...", 0); */
if (use_uds) if (use_uds)
{ {
@ -255,7 +255,7 @@ lib_mod_connect(struct mod *mod)
} }
else else
{ {
mod->server_msg(mod, "connect error", 0); /* mod->server_msg(mod, "connect error", 0); */
} }
} }
@ -268,13 +268,13 @@ lib_mod_connect(struct mod *mod)
mod->sck = 0; mod->sck = 0;
i++; i++;
if (i >= 4) if (i >= 60)
{ {
mod->server_msg(mod, "connection problem, giving up", 0); mod->server_msg(mod, "connection problem, giving up", 0);
break; break;
} }
g_sleep(250); g_sleep(500);
} }
if (error == 0) if (error == 0)

Loading…
Cancel
Save