Commit Graph

189 Commits

Author SHA1 Message Date
Martin Fleisz
622a2a8df0 misc: More int to BOOL conversion fixes
This is a follow up to #9129.

This PR fixes some problematic `int` to `BOOL` conversions that might
cause overflows when checking for bit flags.
2023-07-04 09:45:20 +02:00
Armin Novak
52ec17309a [core,caps] use settings getter/setter for unicode 2023-06-23 08:18:16 +02:00
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
Armin Novak
a433e1b761 [core,rdp] use a dynamic logger for rdpRdp 2023-05-23 05:04:55 +02:00
Pascal Nowack
50c3559a43 core/capabilities: Fix handling of Virtual Channel Capability Set
The VirtualChannelChunkSize can only be larger than 1600 Bytes, when
both client and server write that value in their capability set
regardless of the value itself.
Also, Microsoft clients and servers only advertise the capabilities that
are relevant for the other peer, e.g. mstsc only tells the server that
it supports decompressing compressed data from the server, but it does
not advertise, that it is able to compress data for the server.

Additionally, correctly apply the read capabilities after reading them.
2023-05-02 09:51:40 +02:00
Armin Novak
ca706e3099 [core,caps] fix invalid imeFileName
imeFileName might contain invalid characters, ignore these
2023-03-06 08:35:24 +01:00
akallabeth
a082f2b78a [core] improve logging 2023-02-03 11:09:59 +01:00
akallabeth
f355c9addd [core,capability] Fix reallocation of ReceivedCapabilityData
if the size is 0 do not abort but continue.
2023-01-27 10:07:01 +01:00
Armin Novak
70f6c09ff4 [core] fix persistent bitmap cache setting
* Only activate if both, client and server support the capability
* Use settings getter to access setting
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
8ed37e68d2 [stream] use logging capacity checks 2023-01-25 14:27:32 +01:00
Armin Novak
d4d2b4403c [core] Improve redirection logging 2023-01-23 11:37:44 +01:00
Martin Fleisz
9c6a0eeeb1 core: Fix handling of RAIL HandshakeEx flag
When using Enhanced RAIL the HandshakeEx flag must also be set. However
in the current code it was always overwritten by the server flags (which
might lack the flag).
2023-01-20 10:37:56 +01:00
Armin Novak
6ff458bb34 [core] Make remote rdpSettings* context wide
The settings struct containing the data sent by the remote is now
context wide. This way it is always possible to retrieve the data.
2023-01-18 09:55:06 +01:00
akallabeth
37ab25e19d Fixed all Wdocumentation warnings 2022-12-12 14:24:55 +01:00
akallabeth
ca5684c968 [settings,caps] Removed ColorPointerFlag
* The setting is obsolete and can be replaced by a constant
* Only check the receive function for proper value and print a warning
2022-12-06 09:08:12 +01:00
akallabeth
6aa8253b6c [core,capabilities] Fix pointer cache size logic 2022-12-06 09:08:12 +01:00
akallabeth
f2545a2ad7 [core,capabilities] Always send PointerCacheSize
While the field is optional it can always be sent with a value of 0 to
have the same meaning as leaving it out.
2022-12-06 09:08:12 +01:00
akallabeth
6e82adea17 [cache,pointer] Fixed cache size checks
PointerCache and ColorPointerCache can be of different size
2022-12-06 09:08:12 +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
akallabeth
7faf13a811 [core,capabilities] fix pointer cache size read 2022-11-22 15:30:31 +01:00
Armin Novak
31c1700c0c Fixed -Wunused-variable 2022-11-21 10:12:31 +01:00
Armin Novak
4ddef3e141 [capabilities] properly set RemoteFxOnly
The check was inverted, setting the flag properly now
2022-11-16 11:02:10 +01:00
akallabeth
bc31bae2b5 [core] Unify RDP state machine
Up to this commit the client and server state machine handling used
different return values for state machine changes.
This is fixed with this commit:
* Use common enum return values
* Use common helper functions
2022-11-15 09:57:46 +01:00
Martin Fleisz
ebc8cd1d4a core: Fix applying of pointer capabilities
Only apply the pointer cache size to the settings if we are in server
mode. This check got lost in a recent refactoring to caps parsing.
2022-11-07 13:02:39 +01:00
akallabeth
01fba61670 Fixed rdp_apply_order_capability_set
Read value from correct settings struct
2022-11-04 14:46:58 +01:00
Armin Novak
d171f4a1d5 Added assertions in capability parser 2022-11-03 17:02:15 +01:00
akallabeth
3af13a0fb2 Add proper read/write for ordersupportflags et al
* Add new settings for OrderSupportFlags, OrderSupportFlagsEx,
  TerminalDescriptor and TextANSICodePage
* Add proper read/write routines for the new settings
* Add proper default values for the new settings
2022-11-03 17:02:15 +01:00
Armin Novak
7cef0cb8d6 Refactored capability parsing
* Add new settings for previously ignored capability options
* Store raw capability data in settings for later use
* Add function to extract settings from raw capability data
* Split capability read/write from client/server logic (e.g. enforce
  limits, ...)
2022-11-03 17:02:15 +01: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
Armin Novak
a72f101739 Fixed undefined shift behaviour
BOOL must be cast to UINT32 before shifting to avoid undefined
behaviour
2022-09-20 13:25:44 +02:00
Pascal Nowack
6492a00959 client/X11: Relieve CLIPRDR filename restriction when possible
Microsoft Windows imposes strict filename restrictions on its platform.
As RDP is developed by Microsoft and the RDS in MS Windows is typically
used as remote desktop server for the RDP protocol, these filename
restrictions are also enforced in WinPR, when copy-pasting files over
the clipboard.
However, in some connections no peer on MS Windows is involved and in
these situations, these filename restrictions are just an annoyance.

With a recent API addition in WinPR, it is now possible to override the
callback, where the filename is checked, whether it is valid.
So, use this new API to relieve the filename restriction, when the
connected remote desktop server is not on MS Windows.
2022-07-07 07:45:26 +00:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
Marc-André Moreau
161617c4a4 Implement RDP persistent bitmap cache 2022-06-08 23:37:06 +02:00
Ely Ronnen
934fbe37d1 fix parntheses syntax error 2022-04-21 08:29:27 +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
Armin Novak
eebb0c59b0 Removed rdpRdp instance pointer 2022-03-29 12:13:37 +02: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
Armin Novak
ca30e749e9 Fixed unused-but-set-variable and reserved identifier warnings 2022-02-01 08:48:21 +01:00
Armin Novak
0b3d5351e1 Removed internal members of rdpSecondaryUpdate from API header 2022-01-18 11:24:23 +01:00
akallabeth
204f9a4678 Capability debug level set to verbose 2022-01-13 17:20:48 +01:00
Armin Novak
33f87e3349 Fix checks for input flags:
The settings have double meaning:
* Setting the default in client preconnect callback can disable
  announcement of a flag to the server regardless of support
* If set it is overridden with the value the server supports
2022-01-13 16:34:05 +01:00
Armin Novak
007e061f77 Fixed capability debugging 2021-12-15 13:36:15 +01:00
akallabeth
3ccb96d52f Fixed #7350: Warnings with Stream_StaticInit
* Properly initialize the stream buffer
* Add Stream_StaticConstInit accepting a const buffer
* Modify API to return a pointer to the stream initialized
2021-10-14 12:11:16 +02:00
akallabeth
41aaafef77 Added unicode input for xfreerdp 2021-09-17 07:21:45 +02:00
akallabeth
5a85a824d2 Used settings getter/setter for NSCodec 2021-07-01 11:56:17 +02:00
sss
6574fdf6e4 reverted changes from clang-format 2021-02-25 14:05:40 +01:00
Gluzskiy Alexandr
bee2e1526d allow to use in single threaded mode
(some client side channels and all server side channels still need to be
ported to new api)

server: build fix, do not disable threads for rfx encoder

cliprdr client channel: implemented support for DisableThreads option
looks like thread does not make sense at all for this channel

do not initialize disabled image codecs (respect settings)

channels: client: rail: added support for DisableThreads setting

changed "BOOL DisableThreads" to "UINT32 ThreadingFlags"
dropped unnecessary apu changes

draft implementation of threading settings aware message handling api
for addins/channels

rail: use new messaging api

fixed memory leak

msgs handlers external api changes (as requested)

msgs_handlers: init fix

fixed memory leak

logic fix

resolved problems appeared after rebase to master, dropped unnecessary
changes

git clang-format origin/master

fixed TestFreeRDPCodecRemoteFX.c

"formatting, run `clang-format` please"

properly use new "rfx_context_new(BOOL, UINT32)" everywhere

passed Threading Flags to "rfx_context_new" where available

in older C standarts veriables declaration must be done before any code

requested changes

clang-format as requested

use broken signatures of standert C functions for m$ s**tos

clang-format

requested changes

requested changes

moved ThreadingFlags to stable api zone

define type for channel msg handler

typo fix

clang-format

build fix

us ThreadingFlags from server settings

git clang-format origin/master

clang-format
2021-02-25 14:05:40 +01:00
akallabeth
bf8a01cb63 Fixed rdp_capability_set_start checks 2020-11-20 09:39:25 +01:00