Commit Graph

64 Commits

Author SHA1 Message Date
akallabeth
78acedb40e
[warnigns] fix Wshorten-64-to-32 2024-11-11 10:22:37 +01:00
akallabeth
997ff57301
[proxy,rdpdr] fix integer narrow 2024-10-03 18:58:53 +02:00
akallabeth
490ca0453b
[winpr,stream] use Stream_BufferAs instead of casting 2024-10-01 10:34:42 +02:00
akallabeth
a19305569d
[assert] fix ULONG_MAX use
most of the time this was used to check ULONG limits. Replace with
correct UINT32_MAX
2024-09-16 08:22:40 +02:00
akallabeth
f1be630637
[server,proxy] fix unchecked return 2024-09-15 09:07:49 +02:00
akallabeth
3820858c63
[server,proxy] discard closed dyn channel data
If a dynamic channel does no longer exist or has been closed discard the
channel data received from client
2024-07-25 12:02:51 +02: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
81d2c1f057 [clang-tidy] clang-analyzer-core.NullDereference 2024-02-15 11:49:16 +01:00
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
bb42d425ed [gcc,clang] add support for attribute(malloc)
Mark all malloc like functions and add their appropriate free function
to let the compiler complain on mismatches
2024-02-02 15:10:40 +01:00
Armin Novak
c0df9a50e5 [proxy,drdynvc] fix #9303 broken format string 2023-08-21 10:42:33 +02:00
ehdgks0627
d04ba8d6ef Correct typos and formatting errors in format strings
In several files, fixed typos in format strings that were causing unexpected output and formatting issues.
2023-07-28 15:34:46 +02:00
Armin Novak
e61880d077 [standard] replace __FUNCTION__ with __func__ 2023-07-27 20:02:43 +02:00
akallabeth
be7ff37069 [proxy,rdpdr] fix boroken logger calls 2023-06-29 21:06:47 +02:00
akallabeth
2ac8946950 [proxy,channels] drdynvc logging context
* Use a dynamic logger for dynamic proxy channel
* Set logger context for dynamic channel
2023-06-29 14:30:09 +02:00
akallabeth
ead2be382c [proxy,channels] use logger context for rdpdr 2023-06-29 14:30:09 +02:00
Armin Novak
133585cd5e [proxy,drdynvc] remove dynamic channels on open
dynamic channels can be opened at any time during a session. If we
receive a CREATE_REQUEST_PDU and the channel id is already in use, print
out a warning with the existing channel details and discard it before
creating the newly requested channel.
2023-06-29 11:05:37 +02:00
Armin Novak
970f0c54e8 [stream] use const correct Stream_Pointer access 2023-06-08 08:09:33 +02:00
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
akallabeth
2b3c8c47a4 [build] fix install with BUILD_SHARED_LIBS=OFF
generate proper CMake targets so static linking works again.
2023-05-12 08:03:56 +02:00
Armin Novak
ba7840f8ad [server,proxy] fix rdpdr rewrite
do not touch the stream if no rewrite is done.
2023-04-14 08:02:49 +02:00
akallabeth
273bb6a7a8 [build] use static libraries as intermediate 2023-03-01 08:18:34 +01:00
akallabeth
ee07a13130 [cleanup] fix compiler warnings 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
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
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
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
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
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
Armin Novak
43ea3c0132 Fixed function prototype for proxy rdpdr 2022-10-10 15:29:45 +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
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
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +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
Martin Fleisz
8a06ed9299 proxy: Reset stream position before length check 2022-05-19 09:23:32 +02:00