Commit Graph

73 Commits

Author SHA1 Message Date
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
489c43f382 Return STREAM objects from data generating functions
Use a consistent style of returning a new STREAM object from functions
that output data, rather than requiring an existing structure to be
passed in. This generally makes the memory management more straight
forward and allows us to do more proper bounds checking of everything.

This also adds some new STREAM macros to make it easier to manage
them without poking around in the internal structure.
2019-05-06 14:33:11 +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
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
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
b5917bc9a2
Merge pull request #152 from hean01-cendio/pulseaudio
Add support for pulseaudio backend
2017-11-24 08:01:01 +01:00
René Genz
9e99dd52d6 Fix minor spelling mistakes 2017-11-02 01:01:44 +01:00
Henrik Andersson
896a923f55 Markup unused parameters 2017-10-20 11:05:52 +02:00
Henrik Andersson
ed7e43818f Merge pull request #158 from derfian/maybe-better-audio-sync
rdpsnd_process_ping: include actual packsize value in reply
2017-10-06 10:36:06 +02:00
Karl Mikaelsson
8316b346e8 Remove accidental packsize reference
This was work done on another branch that got included here by
mistake.
2017-10-05 15:02:01 +02:00
Karl Mikaelsson
e48f947794 Include selected sound driver in the verbose output
This could be somewhat useful for troubleshooting audio, so burying it
in the debug log output is unhelpful.
2017-10-05 14:41:25 +02:00
Karl Mikaelsson
329289ff6c Don't log an error on new audio format handshakes
This happens regularly and it's not an error. An easy way to trigger
this scenario is to let cmd.exe produce a bell sound by tab-completing
something non-existant.
2017-10-05 14:41:25 +02:00
Karl Mikaelsson
7870ef6f86 Refactor rdpsnd to follow to the MS-RDPEA specs more closely
Rename functions and change the constants to match the specification.
2017-10-05 14:41:25 +02:00
Karl Mikaelsson
8cb6bf4e95 rdpsnd_process_ping: include actual packsize value in reply
The rdpsnd_process_ping function did not conform to the MS-RDPEA spec
by leaving out the packsize in the reply. The MS-RDPEA spec is rather
clear that this needs to be the same value as received in the training
request.

I think I'm seeing a slight improvement in audio sync after this
change.
2017-10-05 14:29:44 +02:00
Henrik Andersson
9b98c3b229 Add support for pulseaudio backend
This work is done by Nikita Krupenko which sent a patch to
rdesktop in 2010 for version 1.6.0. I have now ported it
over to trunk and it seems to work as expected.
2017-09-26 15:07:14 +02:00
Henrik Andersson
8cb4149722 Use correct log message level for rdpsnd_process() 2017-09-26 15:04:58 +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
d4df8c9f20 Remove rdpsnd_rec extension from rdesktop
This commit removes the implementation of rdpsnd_rec extension
of rdpsnd protocol from rdesktop. The reason for this is that the
required driver (which only works on Windows 2003) provided by Cendio
is deprecated.
2016-12-05 09:06:35 +01:00
Henrik Andersson
4a4d0a9160 Updated comment to be more clarifying.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1797 423420c4-83ab-492f-b58f-81f9feb106b5
2014-05-13 14:34:23 +00:00
Henrik Andersson
8c7c645285 Reintroduce special caps flag 0x00800000 which got
removed in commit r1791.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1796 423420c4-83ab-492f-b58f-81f9feb106b5
2014-05-13 14:03:08 +00:00
Henrik Andersson
b8557c42ea Always enable rdpsnd channel and use flags to control use
of streamed audio or not.

This is a fix for driveredirection which requires rdpsnd
channel to work as mentioned in the following post.

http://social.msdn.microsoft.com/Forums/en-US/75024a3d-458f-4ed9-b55d-7852d0113bd7/rdpbcgrpdf-2-minors-problems-with-server-2012
 


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1791 423420c4-83ab-492f-b58f-81f9feb106b5
2014-03-06 11:43:43 +00:00
Peter Åstrand
b47063c74f Consistent formatting of emails in copyright headers.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1616 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 11:28:19 +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
Pierre Ossman
a22d20b871 Handle resets of the server sound system more gracefully by resetting our
state if we see an unexpected negotiate request.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1593 423420c4-83ab-492f-b58f-81f9feb106b5
2010-04-09 13:54:46 +00:00
Peter Åstrand
42928d7ae1 Properly reset sound subsystem when reconnecting due to screen size
change (RandR). 



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1592 423420c4-83ab-492f-b58f-81f9feb106b5
2010-04-09 13:12:31 +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
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
Pierre Ossman
cd7d646517 Make sure to handle big endian systems for the record path as well.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1429 423420c4-83ab-492f-b58f-81f9feb106b5
2008-02-08 10:34:53 +00:00
Pierre Ossman
e693ed89c7 Check that the sound backend supports wave_in_format_supported before
calling it.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1426 423420c4-83ab-492f-b58f-81f9feb106b5
2008-01-18 15:11:57 +00:00
Pierre Ossman
fda4c63c95 None of the drivers requires it to be open to determine supported formats,
so let's not require it. This allows the device to be busy when rdesktop starts
but can be used later when it becomes free.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1410 423420c4-83ab-492f-b58f-81f9feb106b5
2007-06-18 08:31:27 +00:00
Jay Sorg
4b80c655db remove g++ errors and warnings
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1381 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-18 05:42:11 +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
Jay Sorg
b670bdacfa RD_ prefix and win32 compatibility for core files
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1363 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 04:55:56 +00:00
Pierre Ossman
0dbec16985 Add experimental extension to the RDPSND protocol that allows recording.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1358 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-02 16:30:06 +00:00
Michael Gernoth
f39ecfa6f6 fix device_available which I broke in a previous commit
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1352 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-24 15:22:15 +00:00
Michael Gernoth
84a393eebb fix double open of sound device. should at least allow oss, libao, sun and
sgi drivers to be selected again, when they only allow one open of the
device.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1349 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-24 13:48:50 +00:00
Pierre Ossman
c6712a8945 Abstract select() handling in rdpsnd so that backends can do their thing
more correctly.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1345 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-07 15:23:45 +00:00
Pierre Ossman
7180a70b7a Fix bad variable reference.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1343 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:59:43 +00:00
Pierre Ossman
869f31c2d5 Add more sensible debug output from rdpsnd.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1342 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:55:34 +00:00
Pierre Ossman
10bad3c82d New packet based parser for the rdpsnd protocol.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1341 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:29:42 +00:00
Pierre Ossman
1f47dce7ed Properly split volume channels for RDPSND_SET_VOLUME.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1340 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:18:36 +00:00
Pierre Ossman
838f43b3b7 Update rdpsnd_negotiate() to new information.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1339 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:11:35 +00:00
Pierre Ossman
7f088cbabf Change servertick to ping according to new information.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1338 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 13:01:45 +00:00
Pierre Ossman
5fe136fec2 Ticks are in ms, not us.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1336 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-06 12:31:58 +00:00
Michael Gernoth
8d3020eaff only declare rdpsnd_optarg when sound-support is configured
make sure last element of sound-driver-list is NULL


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1331 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-06 23:05:39 +00:00
Pierre Ossman
22d88645ff Rewrite the queue management a bit so that blocks are not completed until
they have finished playing. This also makes the queue system mandatory for
all backends.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1301 423420c4-83ab-492f-b58f-81f9feb106b5
2006-10-26 09:47:17 +00:00