Commit Graph

161 Commits

Author SHA1 Message Date
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
akallabeth
ceb7bd1d41 [warnings] fixed clang build warnings 2023-11-24 18:19:03 +01:00
Armin Novak
6e6559c41a [settings] fix type mismatch warnings 2023-11-24 14:54:56 +01:00
akallabeth
cd4d77af86 [settings] add deprecation warnings
direct struct access to rdpSettings now produces warnings if not
explicitly deactiaved by defining FREERDP_SETTINGS_INTERNAL_USE
2023-11-24 14:54:56 +01:00
akallabeth
1163cc4d5c [core] add internal settings.h include 2023-11-24 14:54:56 +01:00
David Fort
60ea534ccd [core] fix marshalling of DynamicTimeZone
The field is an UTF16 field, the length was announced as the length of the
UTF8 string.
2023-10-24 12:42:10 +02:00
David VERON
63e1863c9a fixes rdp_read_info_null_string api
Removed buggy "isNullTerminated" parameter, as RDP specs tells
that cbLen includes the nullTerminator if there is one.
2023-10-16 15:18:52 +02:00
akallabeth
ce41d514ab [core,info] fix rdp_read_info_string
* Use proper freerdp_set_string* functions to set string
* In case of failure clean up existing string values
2023-09-02 07:56:21 +02:00
Richard Markiewicz
f59c98eebe [core,info] Fix rdp_info_read_string conversion check 2023-08-01 07:15:59 +02:00
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
akallabeth
b9ec4ef60d [core,info] fix stream read check
read into variable of wrong type, fixed that.
2023-06-29 14:30:09 +02:00
Armin Novak
970f0c54e8 [stream] use const correct Stream_Pointer access 2023-06-08 08:09:33 +02:00
Armin Novak
a433e1b761 [core,rdp] use a dynamic logger for rdpRdp 2023-05-23 05:04:55 +02:00
Pascal Nowack
dec0f950d1 core/info: Assume compression level 0 when INFO_COMPRESSION not present
It's unlikely, that a client supports a higher compression level, when
it did not advertise that level.
2023-05-02 09:51:40 +02:00
akallabeth
ecc32eaf2e [core,info] unify string read, log unexpected
* unify reading of domain and username strings with all the checks
* add handling of (undocumented) padding in [MS-RDPBCGR]
  2.2.10.1.1.2 Logon Info Version 2 (TS_LOGON_INFO_VERSION_2)
  occurring with windows 11
2023-04-24 10:59:17 +02:00
Armin Novak
2450bf75e8 [core] improve assertions and logging 2023-03-05 17:03:18 +01:00
Martin Fleisz
35c24f208b core: Fix invalid string length 2023-02-09 12:49:47 +01:00
akallabeth
a082f2b78a [core] improve logging 2023-02-03 11:09:59 +01:00
akallabeth
31695c94a1 [client random] refactor use
* use sizeof() instead of define length
* use settings getter/setter
2023-02-03 11:09:59 +01:00
akallabeth
3f80e6a5ba [core,info] consume unsued byte of stream
The TPKT header length does not match the [MS-RDPBCGR] 2.2.1.11.1.1
Info Packet (TS_INFO_PACKET) and 2.2.1.11.1.1.1 Extended Info Packet
(TS_EXTENDED_INFO_PACKET) length. print a warning and consume the rest
of the data.
2023-01-27 16:01:33 +01:00
akallabeth
56a01603bb [core,info] do not rely on EarlyCapabilitiesFlags
now rdp_write_extended_info_packet only adds the
cbDynamicDSTTimeZoneKeyName, dynamicDSTTimeZoneKeyName and
dynamicDaylightTimeDisabled fields if both, client and server support
the dynamic timezone settings.
2023-01-27 16:01:33 +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
Martin Fleisz
103c0a983c core: Fix handling of alternate shell if set to an empty string
In case alternate shell was set to an empty string ("") the old code
would try to convert it to a WChar string. This resulted in a NULL
pointer being returned by `ConvertUtf8ToWCharAlloc` that was interpreted
as an error and the connection failed.
2022-12-15 11:56:05 +01:00
Armin Novak
74f273e593 [core,info] improve rdp_read_info_null_string
* Removed comments with invalid assumptions
* Added arguments to rdp_read_info_null_string to indicate if the string
  is expected to be '\0' terminated and what is actually read for error
  logs
2022-12-14 11:52:00 +01:00
Armin Novak
0a7d19ee7a [core,info] 0 check cbClientAddress and cbClientDir
if one of the above values is 0 do not add the size for the '\0'
2022-12-14 11:52:00 +01:00
Armin Novak
87ae9dec0d [core,info] ensure stream length
ensure the stream is large enough for all info packets
2022-12-14 11:52:00 +01:00
Armin Novak
8af5f15769 [core,info] enforce cbClientDir limits
the cbClientDir field limits defined in [MS-RDPBCGR] 2.2.1.11.1.1.1
Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now properly enforced.
2022-12-14 10:30:36 +01:00
Armin Novak
0da0f5ca54 [core,info] enforce extended info limits
the cbClientAddress field limits defined in [MS-RDPBCGR]
2.2.1.11.1.1.1 Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now
properly enforced.
2022-12-14 10:30:36 +01:00
akallabeth
37ab25e19d Fixed all Wdocumentation warnings 2022-12-12 14:24:55 +01:00
Armin Novak
bd7e2263ad fixed const and type cast warnings 2022-12-09 15:58:26 +01:00
Armin Novak
a94ae65018 [core,info] fix rdp_write_extended_info_packet
DynamicDSTTimeZoneKeyName setting might be NULL, strnlen does not allow
NULL arguments.
2022-12-07 14:43:16 +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
33827cb920 Updated RDP state machine
* More detailed states
* Better transition checks
* No more recursive calling of state machine functions
2022-11-11 11:51:27 +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
David Fort
1f08cb9a7d
Drdynvc needs love (#8059)
* winpr: add lock operation on HashTables

* drdynvc: change the listeners array for a hashtable and other micro cleanups

* logonInfo: drop warning that is shown at every connection

Let's avoid this log, we can't do anything if at Microsoft they don't respect
their own specs.

* rdpei: fix terminate of rdpei

* drdynvc: implement the channel list with a hashtable by channelId
2022-07-26 12:53:41 +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
f25261e271 Unifiy string append functions 2022-06-17 08:41:46 +02:00
akallabeth
962c5c3ef0 Fixed dead store warnings 2022-04-28 12:37:19 +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
6c0938f752 Relaxed parser, fix a bug in LogonInfoV2 length
The length should include the padding, but even ms servers send it
without.
2022-03-31 16:15:27 +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
akallabeth
97ae26d47f Fixed rdp_write_logon_info_v2:
Set size field according to
[MS-RDPBCGR] 2.2.10.1.1.2 Logon Info Version 2 (TS_LOGON_INFO_VERSION_2)
2021-12-15 13:36:15 +01:00
akallabeth
6ee60ea15a Fixed various warnings 2021-11-30 08:20:19 +01:00
akallabeth
755f2ce218 Ignore redirection password in case of smartcard auth 2021-11-05 13:00:21 +01:00
Ondrej Holy
892cbe3261 Fix various memory leaks reported by Coverity
Covscan report contains various memory leak defects which were marked
as important. I have spent some time analyzing them and although they
were marked as important, most of them are in error cases, so probably
nothing serious. Let's fix most of them anyway. The rest are false
positives, or too complicated to fix, or already fixed in master, or
simply I am unsure about them.

Relates: https://github.com/FreeRDP/FreeRDP/issues/6981
2021-04-27 14:25:20 +02:00
sss
6574fdf6e4 reverted changes from clang-format 2021-02-25 14:05:40 +01:00