Commit Graph

45 Commits

Author SHA1 Message Date
dbac3db7b7 Fourth Batch: Update files using ChatGPT 4o 2024-05-31 16:42:49 +02:00
Pierre Ossman
25b8412333 Avoid poking around in STREAM internals
It's easy to make mistakes this way, and bypassed the normal bounds
checking. So make sure we always use macros or functions.
2019-05-06 14:33:38 +02:00
Pierre Ossman
c6d8b933c8 Avoid preallocated streams in tcp.c
We don't know when the caller might be done with a stream, so we
can end up with code overwriting things in a stream that is in use
elsewhere.

Solve the issue by returning a new stream each time and leave it
up to the callers to free it.
2019-05-06 14:33:05 +02:00
Pierre Ossman
75221eb3c5 Separate behaviour of out_uint8a and out_uint8p
Make them more match in_uint8a and in_uint8p in that one copies and
the other just gives you a pointer and it is up to the caller how
to fill it in. This can be useful when other APIs are used to
generate the data as it avoids a temporary buffer.
2019-05-06 14:33:05 +02:00
Pierre Ossman
6268b44f06 Add macro to check remaining length of STREAM
Avoids poking around in the internals, and also makes the code
easier to read.
2019-05-06 14:33:05 +02:00
Pierre Ossman
3e340f2f20 Add explicit STREAM allocation function
Avoids mistakes by making sure everyone allocates these the same
way.

The smart card code still has manual allocation because it has it's
own magical memory management.
2019-05-06 14:33:05 +02:00
Pierre Ossman
e099d79879 Remove dangerous s_check()
This macro checks if a pointer is valid _after_ we've already used
that pointer. So it will only trigger if we're already performed some
for of buffer overflow. As such, it provides little to no value and
can only server to encourage broken behaviour.

Let's remove it and replace it with proper bounds checking before
access instead.
2019-05-06 14:33:05 +02:00
Pierre Ossman
d8b0f3782a Give source code info in rdp_protocol_error()
Makes it easier to debug things by seeing exactly where the protocol
handling crashed.
2019-05-06 13:29:44 +02:00
Henrik Andersson
4dca546d04 Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.

All vulnerabilities was identified and reported by Eyal Itkin.

 * Add rdp_protocol_error function that is used in several fixes
 * Refactor of process_bitmap_updates
 * Fix possible integer overflow in s_check_rem() on 32bit arch
 * Fix memory corruption in process_bitmap_data - CVE-2018-8794
 * Fix remote code execution in process_bitmap_data - CVE-2018-8795
 * Fix remote code execution in process_plane - CVE-2018-8797
 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
 * Fix Denial of Service in sec_recv - CVE-2018-20176
 * Fix minor information leak in rdpdr_process - CVE-2018-8791
 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796
 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
 * Fix Denial of Service in process_secondary_order - CVE-2018-8799
 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174
 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177
 * Fix Denial of Service in process_demand_active - CVE-2018-20178
 * Fix remote code execution in lspci_process - CVE-2018-20179
 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
 * Fix remote code execution in seamless_process - CVE-2018-20181
 * Fix remote code execution in seamless_process_line - CVE-2018-20182
2019-01-16 12:28:44 +01:00
Henrik Andersson
c16b74a974 Run indent-all.sh script on source 2018-10-29 15:53:57 +01:00
Henrik Andersson
b5708cf775 Refactoring of slow and fastpath handling
This changes clarifies a chunk of code related to receiving
data and handle slow and fast path pdus.
2018-02-01 12:47:22 +01:00
Cendio
58d8f78eea Add lots of protocol debug logging
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
2018-01-31 11:03:32 +01:00
Cendio
e112b69c61 Use proper user-initiated disconnect sequence
A correct user initated disconnect sequence should send
a MCS Disconnect Provider Ultimatum PDU defined in T.128
upon a disconnect. This commit adds the implementation
the mentioned PDU and the actual write of the packet.

Signed-off-by: Henrik Andersson <hean01@cendio.com>
2018-01-31 11:03:32 +01:00
Henrik Andersson
896a923f55 Markup unused parameters 2017-10-20 11:05:52 +02:00
Henrik Andersson
87d8d123b8 Rework the logging system
This commit will add a logging system to solve the problem that
one actually need to recompile rdesktop from source to enable
different debug logging.

- Same logging api  for all kind of logging and messages to
   end user.

- Adding -v for verbose output when running rdesktop.

- All messages are logged into a subject and with a type, eg:

     logger(Keyboard, Notice, "Autos-electing %s based on locale.", locale);

- Debug logging is enabled trough a environment variable RDEKSTOP_DEBUG,
  which specifies subjects of interest, comma separated. There is a special
  subject named All which includes all subject for debug loggin. There is also
  a simple logic opeartor '!' = NOT which can be used in combination like:

    RDESKTOP_DEBUG=All,!Graphics,!Sound

  Which would give debug log output for All subject except Graphics and Sound.
2017-01-26 14:19:40 +01:00
Henrik Andersson
51014c91df Initial implementation of kerberos server autentication with CredSSP,
disabled by default and is enabled using argument --enable-credssp
to configure script.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1676 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-15 11:21:01 +00:00
Henrik Andersson
c44025aa18 Added support for protocol negotiation, this is a part of
adding Enhanced RDP Security support to rdesktop and brings
support for TLSv1 tunnel functionality.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1659 423420c4-83ab-492f-b58f-81f9feb106b5
2012-06-15 05:16:20 +00:00
Peter Åstrand
b638882347 Include emails in copyright statements.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1615 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 11:13:04 +00:00
Peter Åstrand
27068f53f8 Updated the copyright notices for the things we have been working on.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1612 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 08:55:42 +00:00
Peter Åstrand
281d7c9f06 Changed license to GPLv3
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1534 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-12 08:31:06 +00:00
Peter Åstrand
440542c535 Elminate code duplication in rdp_reconnect and sec_connect.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1528 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-07 20:01:58 +00:00
Peter Åstrand
d00373436a Avoid code duplication in iso_connect/iso_reconnect.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1526 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-07 18:42:47 +00:00
Peter Åstrand
775715848c Avoid code duplication in mcs_connect/mcs_reconnect.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1524 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-07 18:31:16 +00:00
Jay Sorg
88855ddcbf update the copyright year
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1474 423420c4-83ab-492f-b58f-81f9feb106b5
2008-07-11 03:51:23 +00:00
Jay Sorg
7b41e71cd9 added ';' so indent works correctly
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1378 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-11 05:01:46 +00:00
Jay Sorg
6091381a81 prefix BOOL with RD_
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1371 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-08 04:47:06 +00:00
Jay Sorg
797df4fa02 copyright year update
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1364 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 05:39:39 +00:00
Peter Åstrand
75ea7d9148 Applied patch #1247780 (slightly modified) from Brian Chapeau: Session Directory support.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@976 423420c4-83ab-492f-b58f-81f9feb106b5
2005-08-08 19:15:57 +00:00
Michael Gernoth
ec643e4718 bump version to 1.4.0
change year in files
add missing docu for updated commandline-flags
update changelog


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@827 423420c4-83ab-492f-b58f-81f9feb106b5
2005-03-06 21:11:18 +00:00
Jay Sorg
125922c748 bring the rdp5 packets through the various layers
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@732 423420c4-83ab-492f-b58f-81f9feb106b5
2004-07-05 19:09:07 +00:00
Matt Chapman
5b9286e6ea Commit of work in progress on channels (so that other people can hack on
RDPSND), in particular:
* channel layer takes care of virtual channel header
* split X dependent parts out of CLIPRDR, simplified IPC implementation
* initial RDPDR implementation


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@431 423420c4-83ab-492f-b58f-81f9feb106b5
2003-07-01 09:31:25 +00:00
Erik Forsberg
0accb413ac Allow sending to specific MCS channels (still keeping old interface intact).
Send CJRQs for the channels we want when initializing MCS.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@408 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 10:46:00 +00:00
Jay Sorg
63c4677522 adding g_ prefix to global vars, mcs.c done
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@380 423420c4-83ab-492f-b58f-81f9feb106b5
2003-05-30 21:59:56 +00:00
Erik Forsberg
8d6c2bf1e9 Changed some of the data sent from mcs_send_connection_initial - the
number of channels being the most important.

Don't assume the length of the data coming back from the server is
of the same length that the data we sent was.

Record the channel id of incoming MCS packets.

Send username to iso_connect, in order for it to be able to send the
mstshash.

Open the clipboard channel if we are speaking RDP5.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@347 423420c4-83ab-492f-b58f-81f9feb106b5
2003-03-27 13:15:36 +00:00
Matt Chapman
b120a50f44 Update copyright dates on all files that have changed.
Bump version to 1.2-cvs.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@206 423420c4-83ab-492f-b58f-81f9feb106b5
2002-09-26 14:26:46 +00:00
Matt Chapman
5514330916 foo function() -> foo function(void) to conform to ANSI C.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@191 423420c4-83ab-492f-b58f-81f9feb106b5
2002-09-24 07:59:14 +00:00
Peter Åstrand
4f8b0bc47a Changed max line length to 100
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@81 423420c4-83ab-492f-b58f-81f9feb106b5
2002-07-30 07:18:48 +00:00
Peter Åstrand
0685b1b65c Fixed indentation with indent
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@63 423420c4-83ab-492f-b58f-81f9feb106b5
2002-07-18 16:38:31 +00:00
Matt Chapman
24ea31f68a Portability fixes, including elimination of variable argument macros.
Rudimentary configure script.
Miscellaneous cleanups.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@29 423420c4-83ab-492f-b58f-81f9feb106b5
2001-09-14 13:51:38 +00:00
Matt Chapman
75717d8ab6 Changed indentation style (-psl).
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@24 423420c4-83ab-492f-b58f-81f9feb106b5
2001-01-06 03:47:04 +00:00
Matt Chapman
b9613445f9 ran indent (-bli0 -i8 -cli8 -npcs -npsl)
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@23 423420c4-83ab-492f-b58f-81f9feb106b5
2001-01-06 03:12:10 +00:00
Matt Chapman
cd9b5a8761 Major commit of work from laptop - done in various free moments.
Implemented encryption layer and some basic licensing negotiation.
Reorganised code somewhat. While this is not quite as clean, it is
a lot faster - our parser speed was becoming a bottle-neck.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@9 423420c4-83ab-492f-b58f-81f9feb106b5
2000-08-15 10:23:24 +00:00
Matt Chapman
e11a571f14 Committing some awesome progress I made while overseas - this commit
really embodies a huge number of changes. We are now able to talk quite
fluently to a French NT Terminal Server - in normal usage only minor
font issues remain (handling of TEXT2 order is not perfect).

The next major hurdle is encryption, and it will be quite a big hurdle
- there seems to be some quite nasty session key stuff.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@8 423420c4-83ab-492f-b58f-81f9feb106b5
2000-07-25 12:34:29 +00:00
Matt Chapman
26d316fec0 Miscellaneous updates: implemented some more protocol features including
colour maps. Started on a new bitmap decompression engine which is not
completely working yet - however I am going back on the road so I am
committing now.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@6 423420c4-83ab-492f-b58f-81f9feb106b5
2000-07-07 09:40:03 +00:00
Matt Chapman
34f82f3e18 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@3 423420c4-83ab-492f-b58f-81f9feb106b5
2000-05-10 07:36:34 +00:00