Commit Graph

316 Commits

Author SHA1 Message Date
akallabeth
72350e2587
[channels,cliprdr] log clipboard format requested 2024-10-01 13:05:27 +02:00
akallabeth
11b7633dc0
[channels] use Stream_BufferAs
For WTSVirtualChannelRead and WTSVirtualChannelWrite use Stream_BufferAs
to cast to correct type.
2024-10-01 10:28:13 +02:00
akallabeth
8ddb678639
[channels,cliprdr] fix server side send routine 2024-10-01 10:16:18 +02:00
akallabeth
586f40631f
[warnings] fix shorten-64-to-32 2024-09-17 16:13:48 +02:00
akallabeth
965d231e49
[return checks] fix use of CloseHandle 2024-09-16 08:22:31 +02:00
akallabeth
7d67b8e204
[return checks] fix use of SetEvent 2024-09-16 06:47:58 +02:00
akallabeth
8b6091a007
[winpr,wtsapi] improve API usage
* Mark WTSVirtualChannelOpen and WTSVirtualChannelOpenEx with
  WINPR_ATTR_MALLOC to enforce compiler checks for resource cleanup
* Fix unused result warnings, use the result or cast to (void) where not
  requierd
2024-09-14 21:29:31 +02:00
akallabeth
c9b0c9ecd5
[warnings] remove unused variables 2024-09-12 10:08:10 +02:00
akallabeth
15456e1ee1
[warnings] fix implicit widening conversion 2024-08-29 10:47:20 +02:00
akallabeth
1d33095500
[warnings] fix cert-err33-c
Fix unused return values, cast to void if on purpose
2024-08-29 10:19:27 +02:00
akallabeth
1e19ccd76d
[channels,cliprdr] refactor cliprdr_packet_format_list_new
* Simplify function
* Add missing arguments for ASCII names
2024-08-14 09:19:51 +02:00
David Fort
6e2cc358ba cliprdr: fix message of error code log 2024-08-13 15:08:30 +02:00
Armin Novak
83b253dc84
[channels,cliprdr] fix cliprdr_packet_format_list_new
* Fix length calculations
* Fix format name write, skip empty strings
2024-08-12 13:23:33 +02:00
Armin Novak
1b2533674b
[channels,cliprdr] stringify logged values 2024-07-17 11:27:51 +02:00
akallabeth
23229859d7
[channel,cliprdr] warn on invalid msgFlags in requests 2024-05-16 18:27:38 +02:00
akallabeth
4236f46b33 [coverity] 1543262 Resource leak 2024-04-12 09:45:09 +02:00
Ilya Shipitsin
822537be0e channels/cliprdr/client/cliprdr_main.c: fix resource leak
found by coverity

655        if (Stream_Write_UTF16_String_From_UTF8(s, tmpDirCharLen - 1, tempDirectory->szTempDir,
656                                                ARRAYSIZE(tempDirectory->szTempDir), TRUE) < 0)

CID 424748: (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable s going out of scope leaks the storage it points to.
657                return ERROR_INTERNAL_ERROR;
658        /* Path must be 260 UTF16 characters with '\0' termination.
659         * ensure this here */
2024-04-08 11:39:20 +02:00
akallabeth
9a7d30d174 [clang,tidy] fix a few warnings 2024-02-27 14:15:43 +01:00
akallabeth
d7ebec5a65 [tidy] move loop variable declaration to loop 2024-02-22 12:31:50 +01:00
akallabeth
0e44b2c674 [clang-tidy] clang-analyzer-unix.Malloc 2024-02-15 11:49:16 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
Raphaël ZHOU
ad7b41c997 (clipboard) Make sure there is always a Client Format List PUD after a Client Clipboard Capabilities PDU. 2023-11-09 11:40:00 +01:00
akallabeth
bb5345c60e [freerdp,api] add FREERDP_ENTRY_POINT
C requires prototypes or compilers will complain about them missing. Our
library entry points do not have such, therefore add the macro
FREERDP_ENTRY_POINT which declares the function prototype automatically
before the function.
2023-08-25 14:36:05 +02:00
akallabeth
41bd8bd3fb [various] fix integer conversions 2023-08-04 15:07:56 +02:00
Pascal Nowack
b8c2b6abd7 channels/cliprdr: Fix writing incorrect PDU type for unlock PDUs 2023-07-20 11:36:11 +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
Martin Fleisz
3b9a19e993 cliprdr: Fix an issue with file format filtering on Windows
This PR fixes an issue caused by clipboard format filtering which
discarded all formats but `FileGroupDescriptorW` to enable clipboard
file transfer. However at least on windows we also need `FileContents`
to be placed in the clipboard to make file transfer work correctly.

The PR also unifies list filtering into a single functions instead of
having two different functions.
2023-06-14 17:14:14 +02:00
Armin Novak
970f0c54e8 [stream] use const correct Stream_Pointer access 2023-06-08 08:09:33 +02:00
Armin Novak
e3f660e11f [channels,cliprdr] fix sending of empty format list 2023-05-30 13:42:28 +02:00
akallabeth
98fb56b767 [channels,cliprdr] implement client clipboard direction filter
* Filter remote -> local or local -> remote clipboard depending on
  setting.
* Filter remote -> local or local -> remote file clipboard
  depending on setting.
2023-05-25 16:26:39 +02:00
akallabeth
7073aef79f [channel,cliprdr] add missing include in header 2023-05-12 13:57:56 +02:00
akallabeth
a5b42f0f84 [includes] untangled circular includes 2023-03-15 08:22:23 +01:00
Armin Novak
1b28bd0d36 [channels,cliprdr] use logger tag macros 2023-03-05 17:55:28 +01:00
akallabeth
cf9777cd92 [channels] simplified server linking 2023-03-01 08:18:34 +01:00
akallabeth
c3a82daad6 [channels] simplified client linking 2023-03-01 08:18:34 +01:00
Armin Novak
6256933e75 [channels,cliprdr] remove clipboard data hex dump
just too noisy for logging
2023-02-23 20:28:15 +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
8d917698ea cliprdr: Fix sending of server-side PDUs
The old implementation used `Stream_GetLength` to obtain the amount of
data to send. However some PDUs (i.e. CLIPRDR_FILECONTENTS_REQUEST) are
overallocated as they contain optional data (clipDataId in this case).

We now use the position to determine the actual data written to the PDU
instead of the amount of bytes allocated, avoid sending garbage data to
the client.
2023-01-09 07:47:17 +01:00
akallabeth
7e1065a9b9 Fixed Wshadow warnings 2022-12-09 15:58:26 +01:00
Armin Novak
1422136e81 [channel,cliprdr] append '\0' to format names 2022-12-03 10:53:18 +01:00
Armin Novak
cfe09892be [channel,cliprdr] log debug information
Log cliprdr debug information without compile flags
2022-12-03 10:53:18 +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
2da280b8a1 Fixed compilation warnings 2022-07-04 14:59:21 +02:00
akallabeth
9a2a37786e Refactored clipboard structs 2022-07-04 14:31:08 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
akallabeth
1dcc5a180a Fixed warnings 2022-04-28 11:24:51 +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
c6924cb126 Moved clipboard utils to core library, fixes #6760 2022-03-28 14:59:30 +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