Commit Graph

1473 Commits

Author SHA1 Message Date
akallabeth e40b1614f2 [server,shadow] fix assertion in shadow context free 2023-03-14 17:38:59 +01:00
Armin Novak 85cff3a7dc [server,proxy] fix private/public library linking 2023-03-10 11:40:08 +01:00
Armin Novak c23dc3ba9d [CMake] Fix use of BUILD_SHARED_LIBS
the option is named BUILD_SHARED_LIBS and not CMAKE_BUILD_SHARED_LIBS
2023-03-10 11:40:08 +01:00
Armin Novak 49f44303b1 [server,shadow] clean up certificate generation 2023-03-08 13:07:20 +01:00
Armin Novak 00f8cd350b [server,shadow] abort on invalid key/certificate 2023-03-08 13:07:20 +01:00
Armin Novak 340101e35e [server,shadow] do not fall back to surfacebits
If GFX channel is desired, do not fall back to surface bits command.
This will break mstsc connections after a DesktopResize was sent.
2023-03-06 21:46:51 +01:00
Armin Novak e796508c1a [server,shadow] disable AVC modes if none compiled in 2023-03-06 21:46:51 +01:00
Armin Novak 1bf0bb1a26 [server] fixed build without CHANNEL_AUDIN_SERVER 2023-03-06 21:46:51 +01:00
akallabeth 273bb6a7a8 [build] use static libraries as intermediate 2023-03-01 08:18:34 +01:00
akallabeth b4e9c8b39f [build] removed complex libraries
* remove obsolete complex libraries helper
* fix static linking
2023-03-01 08:18:34 +01:00
David Fort b8814e723a fix some warning with the use of new crypto functions 2023-02-28 07:59:40 +01:00
Armin Novak f0e9797b4c [build] require CMake >= 3.13
required for target_link_options
2023-02-27 11:18:02 +01:00
akallabeth abec62c3af [server,mac] fixed certificate loading 2023-02-16 10:06:17 +01:00
akallabeth ea42df2ccd [server,windows] update certificate loading 2023-02-16 10:06:17 +01:00
akallabeth ad1af95438 Removed duplicate rdp security checks 2023-02-16 10:06:17 +01:00
akallabeth 87e90903ab [server,proxy] use rdpPrivateKey and rdpCertificate 2023-02-16 10:06:17 +01:00
akallabeth fe287e199b [server,shadow] use rdpPrivateKey and rdpCertificate 2023-02-16 10:06:17 +01:00
akallabeth 4d4be4d892 [server,sample] only use rdpRsaKey and rdpCertificate 2023-02-16 10:06:17 +01:00
Armin Novak a7dac52a42 [license] updated copyright headers 2023-02-12 20:17:11 +01:00
akallabeth b869927407 [proxy,config] extract PEM from config file
* Read a PEM file if provided via config
* Base64 decode if the certificate/private key are provided in the
  config file
2023-02-12 20:17:11 +01:00
akallabeth ab2de5d60c [proxy,filter] fixed uninitialized value in bitmap-filter 2023-02-12 20:17:11 +01: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
akallabeth d96860780f Fixed compiler warnings 2023-02-03 11:09:59 +01:00
akallabeth 97e397e768 [server,shadow] simplify resource cleanup 2023-02-03 11:09:59 +01:00
akallabeth 17895714c2 [proxy,modules] fix missing link dependency
bitmap-filter requires freerdp functions to be linked
2023-01-27 16:01:33 +01:00
Armin Novak 4043658d04 [proxy,modules] add persist-bitmap-filter plugin
This plugin allows the proxy to filter persistent bitmap
capabilities and [MS-RDPEGFX] cache import offer
2023-01-26 09:30:17 +01:00
akallabeth ee07a13130 [cleanup] fix compiler warnings 2023-01-26 09:30:17 +01:00
akallabeth 353d796476 [proxy,modules] update demo plugin 2023-01-26 09:30:17 +01:00
akallabeth f26079edf2 [proxy] implement dynamic channel filter
* Allow modules to configure intercept channels
* Allow modules to rewrite packets
2023-01-26 09:30:17 +01:00
akallabeth 2067a480e9 [proxy] clean up channeltracker
Use getter/setter and unify stream allocation/reset
2023-01-26 09:30:17 +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
akallabeth 075506f6c8 [winpr,stream] use new Stream_CheckAndLogRequiredLength* 2023-01-25 14:27:32 +01:00
akallabeth 74530a7931 [format strings] ensure __LINE__ is of type size_t
__LINE__ is not particularily well defined (most fall back to int).
We want to ensure that all the uses in a format string match the format
specifier, so do an explicit cast
2023-01-25 14:27:32 +01:00
akallabeth 26c967a083 [server,shadow] fix missing return check 2023-01-24 10:16:55 +01:00
akallabeth 275741cc75 [core,utils] add drdynvc stringification functions 2023-01-12 22:54:25 +01:00
akallabeth 0234204130 [proxy,channel] make tracker opaque 2023-01-12 22:54:25 +01:00
akallabeth 08a2d61d6d [proxy] fix possible NULL crash on shutdown 2023-01-12 22:54:25 +01:00
Armin Novak c7868e7a3f [proxy,rdpdr] added translation layer for rdpdr versions
rdpdr filesystem has 2 different versions and mstsc uses the older one
under certain conditions.
2023-01-10 11:49:38 +01:00
Armin Novak f1e7cc0d48 [rdpdr] unify header read/write 2023-01-10 11:49:38 +01:00
Armin Novak 5a0b8fb688 [proxy,rdpdr] keep capability versions consistent 2023-01-10 11:49:38 +01:00
Armin Novak 22c47b7def [server,proxy] use cached channel id 2022-12-22 15:09:03 +01:00
Armin Novak c4bbe09649 [server,proxy] rewritten Stream_CheckAndLogRequiredLengthRx
make it windows compatible
2022-12-22 15:09:03 +01:00
Armin Novak b614a2da37 [server,proxy] improve rdpdr channel logging 2022-12-22 15:09:03 +01:00
Armin Novak 37454c7420 [utils] improve rdpdr packet dump 2022-12-22 15:09:03 +01:00
Armin Novak 318b55adc1 [rdpdr] filter empty device announce 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
Armin Novak c11f47db89 [server,shadow] do treat deactivate/reactivate
if a resolution change is required, run postconnect just as if it was
successful.
2022-12-22 15:09:03 +01:00
Armin Novak 5680a347d2 [server,proxy] fixed dump config elements 2022-12-22 15:09:03 +01:00
Armin Novak d6ab9d5f63 [server,shadow] abort connection if a resize fails
The shadow server tries to resize the client to use a compatible
resolution. If that fails, e.g. if there is another resize request after
the disconnect/reconnect sequence, abort the connection.
2022-12-19 10:38:18 +01:00
akallabeth b56bef23dd [proxy] clean up config parser
* Use constant strings to identify sections, keys, bool, ...
2022-12-18 15:14:30 +01:00
akallabeth 76bd3ee8f8 [proxy] use proxy logging macros
use proxy logging macros so we know which session a message belongs to
2022-12-18 15:14:30 +01:00
Armin Novak 7fd6278bc6 [server] fixed key press checks
Do not test KBD_FLAGS_DOWN, this only indicates key repeat. Check for
the absence of KBD_FLAGS_RELEASE
2022-12-13 14:37:05 +01:00
Armin Novak 917e392f1e [client] fix connection active checks
* use freerdp_is_active_state for session active checks
* fix state transitions
2022-12-12 12:59:32 +01:00
Armin Novak 0cd823e991 [server,sample] handle peer when key file missing
When a certificate or private key file can not be opened handle the peer
disconnect properly.
2022-12-09 12:30:14 +01:00
Armin Novak b25234da66 [channels] Abort event wain on abortEvent 2022-12-09 12:30:14 +01:00
David Fort 7041517ed6 proxy: prepare intercept mode for dynamic channels
This patch introduce the basic architecture to intercept content of dynamic
channel. When a dynamic channel is in intercept mode, we accumulate and reassemble
the current packet so that it can be passed for inspection.
2022-12-02 22:08:10 +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
akallabeth 5799fb2018 Replace ConvertFromUnicode and ConvertToUnicode
* Use new ConvertUtf8ToWChar, ConvertUtf8NToWChar,
  ConvertUtf8ToWCharAlloc and ConvertUtf8NToWCharAlloc
* Use new ConvertWCharToUtf8, ConvertWCharNToUtf8,
  ConvertWCharToUtf8Alloc and ConvertWCharNToUtf8Alloc
* Use new Stream UTF16 to/from UTF8 read/write functions
* Use new settings UTF16 to/from UTF8 read/write functions
2022-11-28 10:42:36 +01:00
Armin Novak f775e16302 [server,proxy] added --buildconfig option
Add command line option to print out build configuration
2022-11-23 16:19:42 +01:00
akallabeth c2bd2c8617 [server,proxy] fix const correctness
pf_context_create_client_context only creates a copy of the rdpSettings,
so just make the pointer const.
2022-11-22 15:30:31 +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 6a0df205b0 [proxy] add mouse ex and unicode event filters 2022-11-06 19:12:27 +01:00
akallabeth 92b40a1c1d Added fix for TestConnect
* copy test_icon.ppm to build directory
* Add client pre|post_connect and disconnect callbacks
2022-11-04 14:46:58 +01:00
akallabeth 43c5289928 Replaced memset/ZeroMemory with initializer
* Addes WINPR_ASSERT on many occations
* Replaced memset with array initializer
* Replaced ZeroMemory with array initializer
2022-10-14 12:11:01 +02:00
akallabeth 59eae5dbc3 Fixed tautological-unsigned-zero-compare 2022-10-11 13:28:30 +02:00
Armin Novak 43ea3c0132 Fixed function prototype for proxy rdpdr 2022-10-10 15:29:45 +02:00
akallabeth 60720e7706 Improved streamdump file format 2022-10-07 10:38:03 +02:00
Martin Fleisz a42a765cc3 proxy: Fix crash due to format specifier/type mismatch in debug logging
The cmd parameter (type int) has been logged using the %s format
specifier causing an access violation.

Fixed by using get_packet_type to convert cmd to a string.
2022-09-29 16:51:54 +02:00
akallabeth 1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
Martin Fleisz e4f476fce4 proxy: Fix handling of in drdynvc DATA_FIRST_PDU in proxy
During tests I sometimes received DATA_FIRST_PDUs that were not part of
a fragmented message but contained a complete PDU.

The documentation is not quite clear about if this is a possible
scenario or a protocol violation. However in the description of the Data
field it says:

If the sum of the DVC header size and the value specified by the Length
field is less than 1600 bytes, then the actual data length equals the
value specified by the Length field.

This hints that DATA_FIRST_PDU might also contain complete Data and does
not necessarily mean to be the first part of a fragmented PDU.
2022-09-29 14:45:30 +02:00
Kang Lin 7e8bb42005 CMAKE: Fix install export FreeRDP-ShadowTargets 2022-09-27 11:06:39 +02:00
Martin Fleisz fd96ed0acd proxy: Fix unicode flag parsing in proxy rdpdr client name request
Only the least significant bit is valid in the unicode flag UINT32. Some
clients send garbage data in the other bits which caused the proxy to
drop the connection which is wrong.
2022-09-08 17:39:02 +02:00
Martin Fleisz f647296122 proxy: Fix smartcard emulation with clients with active rdpdr channel 2022-08-30 14:11:56 +02:00
David Fort 4fc7a9417d
Various fixes / improvements (#8146)
* xfreerdp: fix typo in logs

* winpr: file appender, small code cleanup

* shadow-server: add an option for TLS secrets

This allows to dissect connections to the shadow server.
2022-08-22 09:42:15 +02:00
David Fort fff746f1f8
shadow-server: fix state machine (#8133)
The shadow server was setting up the dynamic channel too quickly, leading
to unexpected packets during the negotiation (unexpected licence packet error
message on the client side). So let's starts dynamic channel once the activation is
done.
2022-08-18 09:20:51 +02:00
fifthdegree 7901a26a16
Kerberos User 2 User support (#8070)
* add support for 64-bit big-endian encoding

* kerberos: drop reliance on gssapi and add user 2 user support

* Fix local variable declared in the middle of the function body

* kerberos: add ccache server option

Co-authored-by: fifthdegree <fifthdegree@protonmail.com>
Co-authored-by: David Fort <contact@hardening-consulting.com>
2022-08-17 12:25:26 +02:00
Martin Fleisz 1ec228a177 proxy: Use closesocket instead of close 2022-07-21 15:59:43 +02:00
Martin Fleisz 33f76d6012 proxy: Add missing build dependency 2022-07-21 15:59:43 +02:00
Armin Novak 360c4f8188 Fixed pf_client_load_channels 2022-07-06 12:01:23 +02:00
Armin Novak b672bda85e Removed RdpKeyFile and RdpKeyContent settings
They are a duplicate of PrivateKeyFile and PrivateKeyContent
2022-07-06 12:01:23 +02:00
Armin Novak 72fcbc59d8 Use settings setter 2022-07-06 12:01:23 +02:00
akallabeth 3a6ee1155d Shadow XDamage define guards 2022-07-05 09:37:22 +02:00
akallabeth cb96e6143d Fixed -Wshadow warnings 2022-06-30 10:49:02 +02:00
akallabeth bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
akallabeth b542598834 Fixed function pointer type mismatch 2022-06-23 07:45:55 +02:00
akallabeth 90ce22283d Replaced direct settings access with getter/setter 2022-06-23 07:45:55 +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
akallabeth 03e20cb541 Clean up pcap capture module 2022-06-23 07:45:55 +02:00
fifthdegree 8f7be42540 return check 2022-06-21 10:27:17 +02:00
fifthdegree eeece1a027 server-side kerberos (and some fixes) 2022-06-21 10:27:17 +02:00
akallabeth f44554e16d
Added proxy module callbacks for session init and started (#7976) 2022-06-20 13:02:25 +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
David Fort cfe80694da proxy: add fixed user/domain/passwd
This adds a User, Domain and Password parameter in the Target section of the configuration
to specify and use a fixed backend user, domain or password (overriding the one
passed by the front user).
2022-06-15 14:05:45 +02:00
akallabeth 1cc06dc3a5 Fixed mac compilation warnings 2022-06-03 08:51:40 +02:00
akallabeth 1aacf504a1 Increase C standard to C11 2022-06-03 08:51:40 +02:00
akallabeth a0ca2b4a6e Add LTO settings 2022-06-03 08:51:40 +02:00
akallabeth 46ccf6d0d7
Fixed RDPGFX_CAPVERSION_106 according to errata (#7924)
The [MS-RDPEGFX] spec is not really sure which value to use, so we
just announce both, the one from the spec and the one from errata.
2022-05-25 13:11:29 +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
Armin Novak 40f5578206 Add GFX 10.7 capsets 2022-05-24 10:08:53 +02:00
Martin Fleisz 8a06ed9299 proxy: Reset stream position before length check 2022-05-19 09:23:32 +02:00
Martin Fleisz ed53038daa proxy: Add handling of server caps when in rdpdr client running state 2022-05-19 09:23:32 +02:00
David Fort 77413f49b2 winpr: rework alignment functions
_align_XXX functions aren't widely available depending on the C runtime. That causes
problems with mingw where we can easily have some runtime mixes (which lead to mysterious
segfaults most of the time). This patch introduce winpr_aligned_XXX functions that will
either use the function available, or use an emulation layer.
2022-05-12 11:36:01 +02:00
Alex Wilson 9591dd1f0d shadow: convert incoming key scancode to DWORD before |= KBDEXT
KBDEXT is 0x100, so if we |= it onto a UINT8 it actually does
nothing, making us interpret all scancodes as if they're
non-extended.
2022-05-05 08:41:09 +02:00
akallabeth 0422cf9892 Fixed invalid argument types 2022-04-29 14:38:41 +02:00
akallabeth ec699f6c75 scanbuild fixes 2022-04-28 12:37:19 +02:00
akallabeth 667b471686 Fixed cast-quality warnings 2022-04-28 09:17:20 +02:00
akallabeth fb90ac280a Refactored color.h
* Remove implementations from header
* Rename functions to be FreeRDP specific
* Add deprecation define for old names
* Fixed missing includes
2022-04-28 08:40:47 +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
akallabeth eda7cf785b Fixed compilation warnings, added some asserts 2022-04-15 09:06:09 +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
akallabeth 752ac3b479
Fix #7793: Do not expose internal input API (#7794)
* Fixed GetFileInformationByHandle initializers

* Fix #7793: Do not expose internal input API

Slow-Path input uses UINT16 for scancodes on wire, but only the
lower byte is actually used. (the extended fields are sent in
keyboardFlags field)
Hide this implementation detail and adjust the API to use UINT8
for the code instead just like the corresponding Fast-Path PDU

* Added a warning for problematic slow path keyCodes
2022-04-13 09:34:05 +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
Armin Novak 944e14ab82 Fixed mac peer context functions 2022-04-06 10:25:41 +02:00
akallabeth 00adf1a6a0 Fixed leak in shadow_client_logon 2022-03-28 15:52:59 +02:00
akallabeth 54938efc77 Removed function pointer casts 2022-03-28 15:52:32 +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
akallabeth a685d90ccd Fixed integer cast warnings 2022-03-18 07:50:54 +01:00
akallabeth fa59c4b705 Fixed compile warnings 2022-03-18 07:50:54 +01:00
Armin Novak 71aac852d6 Remove async-input from clients 2022-03-08 15:37:19 +01:00
Armin Novak 46e0adda93 Removed HAVE_CONFIG_H uses 2022-03-03 11:26:48 +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
Armin Novak fd027d1bf0 Removed BUILTIN_CHANNELS
Building client channels out of tree does not work reliable as the
dependencies can not be easily split. (exceptions may be simple ones
as echo channel)
It does complicate the build system and code though, so remove this
for maintainability reasons.
2022-02-23 10:43:46 +01:00
Armin Novak 3bb36f4caa Fixed clang-scanbuild warnings 2022-02-22 16:15:05 +01:00
Armin Novak f03059e718 Extended AINPUT API:
* Each event now has a timestamp
* Relative and absolute events are sent simultaneously
* Added a flag indicating relative events are available
2022-02-22 09:44:13 +01:00
akallabeth 7641710f60 Use a client/common context component
* Allows moving common client code from specific client to a
  generic client/common implementation
2022-02-22 09:44:13 +01:00
akallabeth c4e14f7fd6 Added Advanced Input Channel support to sample server 2022-02-22 09:44:13 +01:00
Armin Novak 80a352366f Fixed windows shadow warnings 2022-02-18 08:38:28 +01:00
Armin Novak 21d8bab08d Fixed mingw build 2022-02-18 08:38:28 +01:00
Armin Novak 3a609fb920 Fixed mingw build warnings 2022-02-18 08:38:28 +01:00
akallabeth 8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +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
Armin Novak cefb4e1237 Use freerdp_settings_set and _strdup 2022-02-02 13:43:31 +00:00
Armin Novak a40467b3b0 Added Stream_ConstBuffer function 2022-02-01 10:25:37 +00:00
Armin Novak a403848e61 Fixed const/type warnings 2022-02-01 08:48:21 +01:00
akallabeth 8560803211 Removed BITMAP_UPDATE::count use 2022-01-27 10:52:02 +01:00
Armin Novak 9c7ec3888a Added deprecation to *get_fds functions 2022-01-21 08:59:09 +01:00
akallabeth 724c6f8192
Proxy cleanups (#7568)
* Fixed C++ issues with proxy context

* Added freerdp_settings_get_string_writable

* Define WITH_PROXY_EMULATE_SMARTCARD in config.h
2022-01-20 11:12:36 +01:00
akallabeth e6e6ed5dbd Cleaned up PubSub
* Callback arguments now const
* Fixed missing includes
2022-01-19 09:24:57 +01:00
Armin Novak 5b2cb753bb Fix access to wrong variable in sample server 2022-01-18 11:24:23 +01:00
Armin Novak 1fedd36f65 Fixed proxy compilation issues after rdpUpdate refactoring 2022-01-18 11:24:23 +01:00
Armin Novak f1adfb0e5c Added client redirect to proxy demo module 2022-01-11 12:34:43 +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 fd5ac4eed0 Cleaned up wnd.h includes 2021-12-23 14:27:12 +01:00
akallabeth 88f4e72853 Added WITH_RDTK to disable rdtk build 2021-12-15 13:36:15 +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 a4be45dd5d
Fixed proxy to string functions (#7333) 2021-10-07 10:25:59 +02:00
Armin Novak 18a3fcf2fc Updated wStream API and added torough checks
* Do length/capacity checks in every read/write/seek function
  if WINPR_ASSERT is defined.
* Ensure s->pointer is valid, e.g. within s->buffer + s->capacity
  (Stream_Rewind, Stream_Seek, ...)
* Add return values to Stream_Set* functions so inalid arguments
  can be reported to the caller
* Deprecated problematic stream manipulation functions
  (Stream_SetBuffer, Stream_SetPointer, Stream_SetCapacity)
* Ensure length/capacity functions never return a value larger
  than the actual length/capacity
2021-10-06 09:49:07 +02:00
akallabeth 32994b02f5
Fix pf_server_new: pass own copy of proxyConfig (#7328)
* Fix pf_server_new: pass own copy of proxyConfig

The lifecycle of proxyConfig passed to pf_server_new is unknown,
so pass proxyServer->config copy to modules.

* Early free parsed proxyConfig
2021-10-06 09:17:59 +02:00
Alexandru Bagu 7f7bf2d731 Remove passthrough channel name limit 2021-10-05 09:40:53 +02:00
Alexandru Bagu 1f4ae26a6f add missing filter type strings
* fixes crash that happens while debugging the proxy
2021-10-05 09:32:21 +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
akallabeth e4cd8674d7
Win proxy fix (#7311)
* Do not change warning level for MSVC builds

* Fixed windows PDB paths.
2021-09-22 16:00:00 +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
akallabeth 4d23bc9372
Added proxy input state sync (#7282)
The proxy server component might receive input related events
before the proxy client has established the connection to the
target machine.
With this change, the current keyboard state is cached and sent
to the target when it is ready. All input events received before
the target is ready are discarded.
2021-09-10 10:39:07 +02:00
Armin Novak 673fb46836 Fixed uninitialized warnings 2021-09-10 08:16:25 +02:00
Armin Novak 0fe1e2359e Fixed all reserved-id-macro warnings 2021-09-10 08:16:25 +02:00
Armin Novak 210c56d0fb Options to specify sfreerdp-server cert and private key 2021-09-10 08:16:25 +02:00
Armin Novak ba0da04217 Fixed compilation warnings and duplicate defines 2021-09-09 08:53:20 +02:00
Armin Novak 5bd096cfc2 Fixed client context cleanup 2021-09-09 08:53:20 +02:00
Armin Novak 680dc81bad Added dump option for proxy config. 2021-09-09 08:53:20 +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 0f8c52b9ca Fixed const warnings with argument parser 2021-09-09 08:53:20 +02:00
Armin Novak f7c7211aad Fixed compilation warnings 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
akallabeth 83104fda9c Updated sample-server
* Refactored code to remove global static variables
* Added better error checks and WINPR_ASSERT
2021-09-06 10:11:14 +02:00
Armin Novak bc9ef8327e Fixed #5382: Remove checked in test certificates
The sample servers did have checked in test certificates.
Remove them and let the user generate them when required.
2021-09-04 18:01:30 +02:00
Armin Novak 737f5a2036 Fixed argument const correctness 2021-08-27 13:21:02 +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 64d675a728 Fixed warnings in shadow server. 2021-08-25 10:54:24 +02:00
Armin Novak 054f0ea260 Use defines instad of channel names 2021-08-25 10:54:24 +02:00
akallabeth 617293e0d3
Cleanups (#7239)
* Use freerdp_settings_* for shadow and sample server

* Added freerdp_peer_set_local_and_hostname

* Code cleanups and WINPR_ASSERT

* Code cleanups

* Use CHANNEL_NAME_LEN where appropriate
* Use temporary variables in loop instead of direct array access
2021-08-24 14:09:40 +02:00
Armin Novak 5afa592244 Fixed cast-qual warnings 2021-08-24 11:10:51 +02:00
Armin Novak 610396e197 Fixed compilation warnings
Try to get the number of warnings down
2021-08-02 10:28:06 +02:00
Armin Novak 61b46adaf1 Fixed WITH_WINPR_VERBOSE_ASSERT compile flag
* Compile flag was not always set
* Fix broken WINPR_ASSERT usages detected
2021-07-29 15:09:53 +02:00
akallabeth 7dfdd248ee
Monitor coordinates are exclusive (#7145)
* Monitor coordinates are exclusive

* Remove force override of shadow resolution.

The client might ignore the server requested values, in that case
retry
2021-07-07 11:54:01 +02:00
akallabeth 30520ff5e0 Fixed surface width 2021-07-02 09:53:24 +02:00
akallabeth 2ac12c558a Added option to allow planar topdown encoding. 2021-07-02 09:53:24 +02:00
akallabeth be88fa6705 Fixed surface buffer alignment 2021-07-02 09:53:24 +02:00
akallabeth 645cc8bb69 Use variable surfaceId 2021-07-02 09:53:24 +02:00
akallabeth 2101aadceb Fixed missing assertions and default color depth 2021-07-02 09:53:24 +02:00
akallabeth 5a85a824d2 Used settings getter/setter for NSCodec 2021-07-01 11:56:17 +02:00
akallabeth 6deb65175f Added GFX planar and rfx encoder to shadow 2021-07-01 11:56:17 +02:00
akallabeth bd256b91bc Fixed disabling of AVC444 mode if requested 2021-07-01 11:56:17 +02:00
akallabeth 4ce3063b16 WINPR_ASSERT shadow client 2021-07-01 11:56:17 +02:00
akallabeth 3ac50697a0 Added RDPGFX_CODECID_UNCOMPRESSED path to shadow 2021-06-30 15:59:07 +02:00
akallabeth 242f1734ec Fixed dpkg-buildpackage warnings 2021-06-30 11:57:23 +02:00
Armin Novak 4622c58332 Added extended shadow support for mouse and unicode 2021-06-29 13:48:14 +02:00
Armin Novak 98ed05ff5c Added PROGRESSIVE codec to shadow 2021-06-28 16:51:27 +02:00