Commit Graph

287 Commits

Author SHA1 Message Date
akallabeth
6e3c00725a Cleaned up collections:
ArrayList, MessageQueue, Queue, PubSub, BipBuffer
ObjectPool and BufferPool
2020-11-06 12:30:13 +01:00
Armin Novak
81d59b2d47 Fixed double free on channel close in channel write. 2020-08-12 10:10:18 +02:00
Armin Novak
57b405ca26 Fixed compilation warnings. 2020-08-10 12:14:11 +02:00
akallabeth
1a02af5a12 Fixed codition with side effects 2020-06-22 11:51:38 +02:00
Kubistika
6ed765c960 drdynvc: client: fix #6252 use-after-free 2020-06-03 19:47:40 +03:00
akallabeth
cac8c365f2 Reset pointer to NULL after free. 2020-05-20 15:10:08 +02:00
akallabeth
a1eb3e66b3 Clear dynamic channel lists on disconnect. 2020-05-20 15:10:08 +02:00
akallabeth
abf7c29910 Extend lifetime of streampool in drdynvc
The stream pool can not be released until all streams have been
returned. This might happen as late as channel termination, so
change the lifetime scope accordingly.
2020-05-18 16:57:02 +02:00
akallabeth
6a811db69c Fixed drdynvc_send stream release 2020-05-13 17:11:17 +02:00
akallabeth
64ad42b95b Fixed DestroyListener arguments and call order 2020-05-13 17:11:17 +02:00
akallabeth
5b2a4434d8 drdynvc channel cleanup.
* Clean channel listeners on channel close
* Remove limit on listeners for channels
* Remove limit on channels
2020-05-12 11:40:42 +02:00
akallabeth
c31eb24bae Fixed wrong error return from drdynvc_write_data
When the channel was closed a wrong error code was returned.
2020-05-08 11:21:51 +02:00
Armin Novak
4692f00864 Removed unnecessary cast. 2020-03-09 16:40:07 +01:00
Armin Novak
1fd51d9183 Fixed clang scanbuild warnings. 2020-03-04 09:17:35 +01:00
Norbert Federa
17e0d25104 dynvc/client: fix and improve channel closing code
- fixed and consolitate the duplicated code for sending the
  CLOSE_REQUEST_PDU to the server into dvcman_close_channel
- call dvcman_close_channel if a dynamic channel plugin fails
  to process the received channel data
- rdpegfx: don't try to remove a non-existing cache entry,
  return an error instead which now will close the channel, as
  expected by Microsoft's windows protocols test suite
2020-03-04 08:03:56 +01:00
Armin Novak
f933cafa93 Added some callbacks to dynamic channel
* Allow listener removal of channel during runtime
* Allow retrieval of channel name
2020-02-18 11:14:05 +01:00
Martin Fleisz
e304428a5f
Merge pull request #5857 from akallabeth/scanbuild_fixes
Scanbuild fixes
2020-02-12 10:16:54 +01:00
Armin Novak
d2aef75004 Fix #5852: handle CHANNEL_EVENT_WRITE_CANCELLED
When channels are cleaned up OpenHandle is most of the time
already 0. Ignore the argument checks for
CHANNEL_EVENT_WRITE_CANCELLED and CHANNEL_EVENT_WRITE_COMPLETE
only check where actually required (CHANNEL_EVENT_DATA_RECEIVED)
2020-01-29 08:52:25 +01:00
Armin Novak
087f290d8d Fixed type of index variable. 2020-01-23 10:12:12 +01:00
Armin Novak
7011b008b5 Ignore dynamic virtual channel errors
If a dynamic virtual channel can not process a message, ignore it.
2020-01-13 12:23:30 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
75ed12f1f0 Fixed userdata pointer and CHANNEL_EVENT_WRITE_CANCELLED message. 2019-11-06 13:01:43 +01:00
Armin Novak
1bcb799560 Listen to CHANNEL_EVENT_WRITE_CANCELLED and emit if queue is cleared. 2019-11-06 13:01:43 +01:00
Armin Novak
1b78b59926 Fixed #4809: Properly process CHANNEL_EVENT_WRITE_COMPLETE 2019-11-06 13:01:43 +01:00
Armin Novak
0bba166020 Force close channel, use defines instead of magic numbers
* When senging a close request for a dynamic channel close the channel
  immediately. A response from the server is not guaranteed.
* Use the *_PDU defines instead of magic numbers when creating
  dynamic channel messages.
2019-02-26 15:29:30 +01:00
Armin Novak
711c726222 Fixed static analyzer warnings for dynamic channel. 2019-01-29 12:07:05 +01:00
Ilya Shipitsin
bdc039e719 resolve several issues found by cppcheck
[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:796]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:797]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:798]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[libfreerdp/codec/dsp.c:1156] -> [libfreerdp/codec/dsp.c:1154]: (warning) Either the condition '!srcFormat' is redundant or there is possible null pointer dereference: srcFormat.
[channels/drdynvc/client/drdynvc_main.c:1453] -> [channels/drdynvc/client/drdynvc_main.c:1450]: (warning) Either the condition '!drdynvc' is redundant or there is possible null pointer dereference: drdynvc.
[channels/audin/client/opensles/audin_opensl_es.c:98] -> [channels/audin/client/opensles/audin_opensl_es.c:94]: (warning) Either the condition '!opensles' is redundant or there is possible null pointer dereference: opensles.
[channels/audin/client/opensles/audin_opensl_es.c:159] -> [channels/audin/client/opensles/audin_opensl_es.c:153]: (warning) Either the condition '!opensles' is redundant or there is possible null pointer dereference: opensles.
2019-01-02 20:35:24 +05:00
Armin Novak
a8a6accc15 Fixed compiler warnings. 2018-10-03 15:16:59 +02:00
Armin Novak
baee520e3d Fix for #4866: Added additional length checks 2018-09-20 09:06:01 +02:00
Armin Novak
114abad767 Removed use of strcpy. 2018-08-27 14:34:09 +02:00
Armin Novak
a716dc244c Removed duplicate resource free. 2018-06-18 10:23:57 +02:00
Armin Novak
973a4c30b8 Fixed channel duplicate disconnect handling 2018-04-09 11:26:26 +02:00
Armin Novak
2517755d25 Fixed thread function return and parameters. 2018-03-07 14:36:55 +01:00
Martin Fleisz
ffa5fb07c2 drdynvc: Fix possible NULL pointer accesses 2018-03-06 16:03:13 +01:00
Armin Novak
a6a57e3619 Prefer dynamic logger in dynamic channel. 2018-02-13 13:46:25 +01:00
David Fort
73eb4ba77e drdynvc: fixed stream leak on error 2018-02-13 10:51:45 +01:00
Armin Novak
1ec1c9b7a3 Add dynamic channel queue object free function. 2018-02-09 11:04:31 +01:00
David Fort
41823080f9 Fix users of Stream_GetPosition() that returns size_t 2017-12-11 22:38:58 +01:00
David Fort
1e48405d19 drdynvc: fix invalid check
There were a copy'n paste error in the check of a malloc.
2017-12-01 14:20:24 +01:00
Armin Novak
8a5c78bde6 Unified dynamic channel cleanup code. 2017-08-31 09:55:59 +02:00
Armin Novak
523a881663 Channels with a context must free it themselves. 2017-07-28 08:39:51 +02:00
Armin Novak
8b9e3fa51e Fixed use of reserved keywords for include guards. 2017-07-20 09:35:41 +02:00
Armin Novak
359077e8d3 Closing dynamic channels on shutdown. 2017-02-15 15:42:14 +01:00
Armin Novak
a64fb343c1 Fixed missing return. 2017-01-18 15:41:50 +01:00
Armin Novak
7f1d4222eb Checks, return value fixes
* Added missing argument checks
* Use opened drdynvc->log where possible
* Fix drdynvc_send return in case channel not connected.
2017-01-17 16:06:17 +01:00
Armin Novak
9f19da798c Added attach/detach support for channels. 2016-12-19 17:07:01 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Bernhard Miklautz
00dae7c5ef Fix some spelling errors
Fixes #3633
2016-12-01 15:36:49 +01:00
Norbert Federa
c6e6b44143 countless WLog/printf format specifier fixes 2016-11-25 17:06:25 +01:00
Martin Haimberger
7fe28a8a78 virtualChannel: removed static variable usage from
VirtualChannelApi
2016-11-23 04:17:56 -08:00
Marc-André Moreau
36db0cc325 channels: properly handle VirtualChannelEntryEx in static virtual channel loading 2016-11-16 09:52:24 -05:00
Marc-André Moreau
f74380be42 channels/drdynvc: fix channel entry point name 2016-11-15 12:37:50 -05:00
Marc-André Moreau
dee76617d9 channels: remove thread-local storage usage 2016-11-15 11:41:01 -05:00
Marc-André Moreau
2cce8e9fbc channels: migrate drdynvc to extended virtual channel API 2016-11-15 10:58:38 -05:00
Marc-André Moreau
70c4646722 channels: restore global tables for initHandle, openHandle mappings instead of thread local storage 2016-11-14 15:23:05 -05:00
Marc-André Moreau
e8004d5184 drdynvc: ignore some messages sent for invalid channel ids with MMR and Windows Server 2012 R2, fix issue #3422 2016-11-03 10:12:48 -04:00
Armin Novak
5bc691c79d Improved error handling if channel is missing. 2016-10-27 14:41:05 +02:00
Armin Novak
9f5da483dc Reformatted files touched in last 2 commits. 2016-10-06 13:43:12 +02:00
Armin Novak
64590e7e89 Set pEntryPointsEx->ppInterface NULL on error. 2016-10-06 13:43:12 +02:00
Armin Novak
88a3b8dd76 Initializing channel context in each thread. 2016-10-06 13:43:12 +02:00
Armin Novak
dadc5262ae Removed static channel variables.
Global static variables do not work, if more than one instance
of an RDP client is running in the same process space.
Removed the varaibles where possible and replaced them with
thread local storage where necessary.
2016-10-06 13:43:09 +02:00
Armin Novak
dc12641b23 Fixed a windows 8.1 issue. 2016-10-06 13:43:01 +02:00
Armin Novak
48b11cf150 Dynamic channel internal functions now static. 2016-04-26 09:35:54 +02:00
Armin Novak
2dbc1a0b87 Reverted WTS API changes. 2016-03-14 13:19:08 +01:00
Armin Novak
36cbf1b583 Fixed error handling for channel load failures. 2016-03-14 13:13:43 +01:00
Armin Novak
e7814d5855 Fixed stream API for Stream_Copy. 2016-03-01 12:57:48 +01:00
Armin Novak
8595e395ab Fixed size checks (thanks to @virtman) 2016-01-28 11:45:06 +01:00
Bernhard Miklautz
6fa3608111 cleanup cmake exports and pkg-config files
With this commit the "exported" components (usable with pkg-config and
cmake find module package)
* winpr - winpr library and headers
* freerdp - core library and headers
* freerdp-client - client specific library
* freerdp-server - server specific library
* rdtk - rdtk headers and library

To allow the installation of multiple different version (different major
number) the include files were moved into the respective sub folder:
freerdp -> freerdp{MAJOR}/freerdp (currently freerdp2/freerdp/)
winpr -> winpr{MAJOR}/winpr (currently winrp1/winpr/)
rdtk -> rdpk{MAJOR}/rdtk (currently rdtk0/rdtk/

The generated pkg-config and cmake find modules now also include the major
version number. Currently the following pkg-config are generated and
installed.
* winpr1
* freerdp2
* freerdp-server2
* freerdp-client2
* rdtk0

As cmake is able to handle multiple versions out of the box the
following can be used to find a specific module:

find_package(WinPR)
find_package(FreeRDP)
find_package(FreeRDP-Server)
find_package(FreeRDP-Client)
find_package(RdTk)

As cmake doesn't automatically resolve dependencies for packages it is
necessary to manually include the requirements. For example if
FreeRDP-Client is required WinPR and FreeRDP need to be included
(find_package) as well.

This commit also fixes the installation when STATIC_CHANNELS are built.
WITH STATIC_CHANNELS all channels are linked into libfreerdp-client, for
this all channels are generated as linker archive and linked together in
the final step. Before the intermediate linker archives were, although
not required and useful, installed. Same applies for server side
channels.
2016-01-12 17:32:33 +01:00
Bernhard Miklautz
97edeca204 Merge pull request #2874 from akallabeth/stdtypes
Using stdint.h and stdbool.h for type definitions
2015-12-17 16:37:54 +01:00
Armin Novak
cb958ba9c6 Added pdb files to package target.
Fixed name collision with freerdp-shadow targets.
2015-12-15 12:07:21 +01:00
Armin Novak
90251f5e0d Fixed OnNewChannelConnection arguments 2015-12-14 14:18:50 +01:00
Marc-André Moreau
3fd0c45be8 afreerdp: fix build warnings 2015-09-22 11:53:50 -04:00
Martin Haimberger
52405a3e79 Remove WIN32ERROR type
All return values are UINT now.
2015-08-27 05:38:20 -07:00
Martin Haimberger
420a86e1c7 Merge remote-tracking branch 'upstream/master' into mh-channel-fix
Conflicts:
	channels/drdynvc/client/drdynvc_main.c
	channels/rdpgfx/client/rdpgfx_main.c
	client/X11/xf_gfx.c
2015-08-25 00:07:04 -07:00
Martin Haimberger
65fd259610 misc fixes:
fixed all bugs from the review
checking all WaitFor*Object/s calls
2015-07-30 06:49:21 -07:00
Martin Haimberger
b8c110d19b introduced channel error reporting system
The rdpContext gets an event which will
get set if an error occoured in a channel.

If a thread or a void callback has to report an
error it will get signaled by this system.
2015-07-15 00:50:35 -07:00
Marc-André Moreau
11f785290f channels/drdynvc: use same status code as mstsc for DVC opening failure 2015-07-07 13:36:36 -04:00
Marc-André Moreau
ff5b876260 channels/drdynvc: silence harmless warnings with Windows 8 / Windows 2012 channel close 2015-06-29 14:47:46 -04:00
Martin Haimberger
6e4e1c2773 Merge remote-tracking branch 'upstream/master' into mh-stream-fix
Conflicts:
	client/Windows/wf_cliprdr.c
2015-06-18 03:06:40 -07:00
Martin Haimberger
d06da4f1bd hardend drdynvc channel 2015-06-18 03:04:28 -07:00
David FORT
12f873f1f9 Fixed MessageQueue and callers 2015-05-29 14:24:14 +02:00
Norbert Federa
1eff1a345e free can handle NULL perfectly fine 2015-05-11 09:07:39 +02:00
Bernhard Miklautz
8615f74eac drdynvc: ensure stream != NULL 2015-03-30 17:23:22 +02:00
Bernhard Miklautz
74c8400789 coding style fixes
Add missing space after if
2015-03-30 17:15:45 +02:00
Bernhard Miklautz
f469e069dc stream: Stream_Ensure*Capacity: change return type
Change the return type of Stream_Ensure*Capacity from void to BOOL to be
able to detect realloc problems easily. Otherwise the only way to detect
this was to check if the capacity after the call was >= the required
size.
In case Stream_Ensure*Capacity fails the old memory is still available
and need to freed outside.

This commit also adds checks to most calls of Stream_Ensure*Capacity to
check if the call was successful.
2015-03-30 16:33:48 +02:00
ivan-83
7b3a552988 + audin OSS support (un tested now)
+ add: COMMAND_LINE_IGN_UNKNOWN_KEYWORD flag for CommandLineParseArgumentsA to ignory unknown keys without fail
+ add: lot of WLog_DBG() in drdynvc, add function names in existing
* change: error text in rdpsnd OSS
* fix: dev in rdpsnd does not work
* fix/change: audio-dev renamed to dev and now work in audin
* fix dynamic channels now work again
2015-03-13 01:28:44 +03:00
Marc-André Moreau
3258c887a4 libfreerdp-core: add channel reconnect 2015-02-06 17:35:14 -05:00
Marc-André Moreau
fa06c4d401 libfreerdp-core: improve reconnection 2015-02-06 14:21:26 -05:00
Marc-André Moreau
82d58086db xfreerdp: partial reconnect fixes 2015-02-05 17:01:56 -05:00
Norbert Federa
70c8acdd67 drdynvc: fix segfaults and a compiler warning
If we send a negative creation status while processing the DVC create
response pdu in drdynvc_process_create_request() we must also close
the created channel. Otherwise we will get duplicated channel IDs
in the channel manager's array list because the server will
eventually reuse the channel ids which we have reported as failed in
previous creation responses.
In order to protect the client from duplicated IDs sent by buggy or
malicious servers I've added an appropriate check in
dvcman_channel_new() which will now return NULL in this case.
Also added a missing NULL check for the result of dvcman_channel_new()
in dvcman_create_channel().
2015-01-26 19:26:38 +01:00
Armin Novak
2f57cca71c Moved arraylist remove to dvcman_close_channel
This ensures, that the resources are also cleaned up if no channel
listener was registered.
2015-01-21 14:16:23 +01:00
Armin Novak
256c64fbed Fixes cleanup when closing a dynamic channel.
The resource cleanup was executed twice for each dynamic channel.
Now cleaning up the resources by array list free callback and only
when closing the channel.
2015-01-21 12:58:18 +01:00
Armin Novak
4d08528f89 Fixed variable initialisation and cleanup. 2015-01-20 12:31:39 +01:00
Armin Novak
9e5ed07556 Added CHANNEL_EVENT_DISCONNECTED handling.
Additional error checks and logging.
2015-01-20 11:58:04 +01:00
Marc-André Moreau
5024c42b76 channels/drdynvc: properly handle DYNVC_OPEN/DYNVC_CLOSE requests 2014-12-28 11:13:51 -05:00
Marc-André Moreau
27a8e50e60 channels: fix drdynvc, patch memory leaks 2014-12-27 15:20:29 -05:00
Marc-André Moreau
6c2ebb2b58 channels: redirection valgrind fixes 2014-12-27 13:50:50 -05:00
erobertor
d647fd2f36 Update drdynvc_main.c
fixed memory leak
2014-12-15 18:36:56 +01:00
Armin Novak
b9908af64a Fixed memory leaks. 2014-11-16 16:02:28 +01:00
Marc-André Moreau
986dae429b freerdp: remove deprecated svc_plugin.c utils 2014-11-12 13:34:07 -05:00