Commit Graph

100 Commits

Author SHA1 Message Date
akallabeth
1f236ade7a [server] make settings opaque 2023-11-24 14:54:56 +01:00
Armin Novak
80058caa4d [proxy,modules] check return of pf_modules_run_hook 2023-06-29 11:05:37 +02:00
David Fort
7b84f2f740 proxy: fix treatment of client channels
Iteration on channels was done with the wrong counter leading to incorrect behaviour.
2023-05-09 07:52:06 +02:00
Martin Fleisz
4b9fb8fff9 proxy: Fix NLA to TLS fallback connection
Currently the proxy's TLS fallback if an NLA connection attempt failed
is broken. There are two issues with the current code that this PR
fixes:

- freerdp_reconnect is used which requires an already established
  connection to work correctly. This is not the case since the NLA
  connectin attempt failed. This resulted in a seemingly working TLS
  connection but i.e. channels where missing/not working.
- The fallback connection attempt just altered the NLA security setting
  in the instance's settings. However these settings have been already
  modified by the NLA connection attempt so we need to create a copy of
  the original connection settings before doing the first connect.

The PR also introduces freerdp_reset_context which restores the initial
connection settings for the given instance.
2023-02-09 12:49:47 +01:00
Armin Novak
641022b795 [logging] remove __FUNCTION__ from actual message
prefer the log formatter to provide that information.
2023-01-25 16:26:39 +01:00
Armin Novak
22c47b7def [server,proxy] use cached channel id 2022-12-22 15:09:03 +01:00
Armin Novak
b988e8fba7 [server,proxy] fix rdpdr intercept mode 2022-12-22 15:09:03 +01:00
David Fort
d59c0a49c3 proxy: fix channel shift between front and back
When some channels are filtered, some misalignement of channel ids could happen.
This patch keeps track of the back and front channel ids to correctly identify a
channel and send packets with the correct channel id.
2022-11-30 11:38:08 +01:00
Martin Fleisz
1da0d63c78 proxy: Allow NLA when using proxy smartcard authentication
Previously smartcard authentication was only supported with TLS
connections so the proxy forced that security mode.

Since we now have a working NLA smartcard auth implementation we can
remove that code and leave the correct configuration to the proxy user.
2022-11-09 15:27:11 +01:00
Armin Novak
360c4f8188 Fixed pf_client_load_channels 2022-07-06 12:01:23 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
akallabeth
650a275ceb Added new client callback LoadChannels and freerdp_client_load_channels
Split channel loading from PreConnect as it might be necessary to
reinitialize channels on redirect
2022-06-23 07:45:55 +02:00
David Fort
aff8fdac26 proxy: correctly handle dynamic channel fragmentation
This big patch fixes fragmentation handling in the dynamic channel. We used to
have a single state to handle fragmentation at the main dynamic channel level, but
in fact packets can be fragmented per sub channel. So we have to maintain a fragmentation
state per sub channel, this involve treating dynamic and static channels differentely
(so the size of the patch that has to implement state tracking per dynamic channels).
2022-06-17 08:38:57 +02:00
akallabeth
2677ca0aaf
Always call HOOK_TYPE_CLIENT_UNINIT_CONNECT in pf_client_thread_proc (#7920) 2022-05-25 09:45:31 +02:00
akallabeth
0422cf9892 Fixed invalid argument types 2022-04-29 14:38:41 +02:00
akallabeth
667b471686 Fixed cast-quality warnings 2022-04-28 09:17:20 +02:00
akallabeth
73cdcdfe09
Logging and parser fixes (#7796)
* Fixed remdesk settings pointer

* Fixed sign warnings in display_write_monitor_layout_pdu

* Use freerdp_abort_connect_context and freerdp_shall_disconnect_context

* Added and updates settings

* info assert/dynamic timezone

* mcs assert/log/flags

* Fixed and added assertions for wStream

* Unified stream length checks

* Added new function to check for lenght and log
* Replace all usages with this new function

* Cleaned up PER, added parser logging

* Cleaned up BER, added parser logging

* log messages

* Modified Stream_CheckAndLogRequiredLengthEx

* Allow custom format and options
* Add Stream_CheckAndLogRequiredLengthExVa for prepared va_list

* Improved Stream_CheckAndLogRequiredLength

* Now have log level adjustable
* Added function equivalents for existing logger
* Added a backtrace in case of a failure is detected

* Fixed public API input checks
2022-04-19 14:29:17 +02:00
akallabeth
37d0a9e2b7 Assert function pointers in proxy 2022-04-15 12:13:03 +02:00
David Fort
63d0d3e4cf proxy: rework proxy channel treatments for statefull drdynvc
The rework introduce a stateful dynamic channel treatment, so that we can take early decisions
for data packet (dropping all the current packet or pass it), but also reassemble important
packets like channel creation.
2022-04-15 09:06:09 +02:00
David Fort
a152dec687 proxy: correctly use the RemoteApp flag
The flag was forcing the remoteApp usage when set, while all the other equivalent
flags just enable the feature. This patch fixes that, so now setting RemoteApp = TRUE
just enables the front client to do remoteApps.
2022-04-12 08:05:28 +02:00
akallabeth
770bc14d18 Cleaned up rdpSettings use in server 2022-03-28 15:52:32 +02:00
akallabeth
14568872a9
Instance cleanup (#7738)
* Cleaned up freerdp::autodetect

* Deprecate freerdp::input

* Deprecated freerdp::update

* Deprecated freerdp::settings

* Deprecated freerdp::autodetect

* Removed rdpTransport::settings

* Deprecated freerdp_per::update|settings|autodetect

* Fixed mac client and server compilation

* Fixed windows compilation

* Added deprecation warnings

* Fixed initialization of structs.

* Fixed android build

* Fixed freerdp_client_context_new const correctness

* Fixed checks for android implementation

Replaced checks with assertions where appropriate

* Fixed checks for windows client

Replaced checks with assertions where appropriate

* Fixed proxy client pointer dereference
2022-03-23 13:18:35 +01:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
akallabeth
64f47848c9
Proxy fixes (#7686)
* Fixed a memory leak in server side NLA auth

* Fixed #7675: Pass channel packets directly
2022-03-02 09:13:41 +01:00
David Fort
46eb50df2c proxy: improve channel treatment
This PR introduces per channel context so that we can speed up operations like
retrieving the channel name from its id, or knowing what shall be done for a
packet (no config ACL recomputation at each packet).
2022-02-04 08:44:22 +00:00
akallabeth
e6e6ed5dbd Cleaned up PubSub
* Callback arguments now const
* Fixed missing includes
2022-01-19 09:24:57 +01:00
Armin Novak
4e6e5be654 Added proxy intercept channels
* New configuration to intercept certain channels
* Added rdpdr intercept implementation
2022-01-11 12:34:43 +01:00
Armin Novak
41d03143b8 Always call HOOK_TYPE_CLIENT_LOGIN_FAILURE if NLA failed 2021-11-03 11:12:00 +01:00
Armin Novak
149b9bf2cc Fixed StreamStaticInit warnings. 2021-10-18 10:53:05 +02:00
Armin Novak
73fbbcf0fb Fixed const warnings 2021-10-14 13:04:59 +02:00
akallabeth
03a9ca80c8
Refactor proxy (#7312)
* Added hidden transport dump and replay options

* Added settings to enable transport dump and replay
* Added check in freerdp_connect to skip authentication on
  dump replay

* Fixed proxy issues

* Proper shutdown handling
* Uninitialized variables
* Skip proxy-client channels, initialize from peer channels and
  config
* Filter static channels like dynamic ones
* Added proxy module filtering from config data (channels, input, ...)

* Removed oboslete proxy decoding related files

* Added defines for RDPECAM channel

* Added proxy config options:

* VideoRedirection
* CameraRedirection

* Fixed duplicate channel free
2021-09-23 14:52:03 +02:00
Armin Novak
fceb108fc5 Fixed comments and duplicate checks. 2021-09-20 10:59:59 +02:00
akallabeth
695e38398d Refactored proxy
* Removed unnecessary global data lists
* Improved error handling
* Do not initialize channel code in passthrough mode
2021-09-20 10:59:59 +02:00
Armin Novak
3afd147bc0 Use wStream in pf_client_receive_channel_data_hook 2021-09-09 08:53:20 +02:00
Armin Novak
4463e5eda9 Added config dump function, improved resource cleanup 2021-09-09 08:53:20 +02:00
Armin Novak
4cc0fbca33 Proxy client cleanups
* Use proper maximum handle defines
* Gracefully handle out of memory instead of assert
2021-09-09 08:53:20 +02:00
Armin Novak
4e44003832 Expose dynamic channel PDU types 2021-09-09 08:53:20 +02:00
Armin Novak
5a2231172c Updated copyright for proxy 2021-09-09 08:53:20 +02:00
Armin Novak
976c3c2ab9 Refactored proxy and proxy-modules:
* Split out proxy headers and moved to public API to allow external
  modules to be built.
* Split proxy into proxy library and proxy binary. The library
  can be used by other applications and provides a simple API
* Improved channel passthrough, now all channels including dynamic
  channels work.
* Extended module API to hook more events, improved module samples
* Cleaned up proxy code, removed global static variables used,
  added WINPR_ASSERT
2021-09-09 08:53:20 +02:00
akallabeth
c2f1562a4b Removed freerdp_peer::input 2021-09-09 08:36:01 +02:00
Armin Novak
413dcd3c28 Fixed RDPSND_CHANNEL_NAME
RDPSND channel is special, as it has many names.
(e.g. static channel, dynamic channel and UDP one.
Use RDPSND_CHANNEL_NAME to identify the module name instad of
RDPSND_DVC_CHANNEL_NAME
2021-08-25 13:40:47 +02:00
Armin Novak
054f0ea260 Use defines instad of channel names 2021-08-25 10:54:24 +02:00
Armin Novak
5afa592244 Fixed cast-qual warnings 2021-08-24 11:10:51 +02:00
Armin Novak
880c603c26 Renamed HashTable_Add to HashTable_Insert
* Since the changes break HashTable_Add rename it so that it will
  not fail silently
2021-06-16 11:46:42 +02:00
kubistika
5daba89e83 server: proxy: add more info on proxy logs 2020-09-21 14:16:31 +03:00
Kobi Mizrachi
67cfcb0af6 server: proxy: implement external routing 2020-09-18 09:51:12 +02:00
Kobi Mizrachi
b2d15eedc9 server: proxy: proxy rdp heartbeats 2020-07-07 09:57:53 +02:00
Kobi Mizrachi
2ae7c2a6d4 server: proxy: fix race issue
Proxy server might receive input updates while client side being
redirected (and reset), then a heap-after-free might occur. To solve
this, we register server input/update callbacks only after client is
fully activated.
2020-07-06 09:14:44 +02:00
Kobi Mizrachi
0bf225ec60 server: proxy: capture: send sid in SessionInfo 2020-06-22 12:37:53 +02:00