Commit Graph

4472 Commits

Author SHA1 Message Date
Steve Pronovost
49d9e61884 Fix protocol violation when uploading large ICON
When uploading large ICON (96x96), we end up growing the stream
mid-update. Stream_EnsureCapacity end up reallocating the stream
with a larger capacity to accomodate the large ICON size, but in
doing so, also updating the sealed length for the data currently in
the stream. This breaks the assumption between update_begin_paint
and update_end_paint where the sealed lenght is used to keep track
of the location where we need to update the orders counts after
we're done accumulating update. As a result of the growth and lost
of that location, the number of orders is written to the wrong
location and the resulting stream is invalid which result in a
protocol violation and a connection drop.

The current fix uses a new offsetOrder in the update object to
keep track of where update_end_paint needs to write the number
of orders contained. I think a better fix would be for
Stream_EnsureCapacity to preserve the sealead length of the
stream on growth, but this has a much more significant impact and
careful analysis needs to be done to ensure this doesn't violate
other assumption. Need to follow up with FreeRDP developer to get
their take on this one.
2021-10-21 13:11:21 +02:00
Steve Pronovost
dba2a7e4a6 Add support for HyperV socket connection
This commit add support for connection over HyperV socket (hvsock) which are
used in scenario like WSLg on Windows. hvsock requires accept and close
to monitor in addition to read. Also mark hvsock connection as local.
2021-10-21 13:11:21 +02:00
Steve Pronovost
592f8d95be Fix connection negotiation with mstsc/msrdc
mstsc/msrdc includes an optional correlation info
(RDP_NEG_CORRELATION_INFO) during connection negotiation. This confuses
FreeRDP which interpret this as a cookie and eventually fails the
negotiation, preventing a successful connection to these RDP client.

This commit addresses 3 things.

1) When processing connection token or cookie, skip if the remaining
bytes are neither.
2) After processing the RDP_NEG_REQ info, skip the optional correlation
info (RDP_NEG_CORRELATION_INFO) if one is present.
3) Allow local connection without server certificate when the client
inherently trust the server.
2021-10-21 13:11:21 +02:00
akallabeth
a71235be74
Cert update fix (#7382)
* Fixed certificate thumbprint default format

* Fixed VerifyChangedCertificateEx call arguments
2021-10-21 09:07:52 +02:00
Alexandru Bagu
95cb4672b3 fix build issues for VS2010 2021-10-20 08:35:16 +02:00
Alexandru Bagu
07ea60e960 add optional support for win32 console
* add option to build as console by using WITH_WIN_CONSOLE
* add passphrase read from stdin for Win32
* fix windows authentication with stdin password
* allow redirected stdin to be used for stdin input
* flush stdout to help with automation
* use stdin when /from-stdin is present
* add error log for stdin flag but stdin redirected
2021-10-20 08:35:16 +02:00
Armin Novak
0e991a1078 Use original height for h264 context, but allocate padded height. 2021-10-19 15:41:49 +02:00
Armin Novak
76c419e690 Remember avc420 allocation width and height 2021-10-19 15:41:49 +02:00
Armin Novak
5037659859 Fixed freerdp_device_clone for serial devices 2021-10-18 16:09:13 +02:00
Armin Novak
ceee946e0b Fixed warnings 2021-10-18 16:09:13 +02:00
Armin Novak
95d9365dc8 Fixed warnings 2021-10-18 16:09:13 +02:00
Armin Novak
ed11a22edb Fixed device copy 2021-10-18 16:09:13 +02:00
Armin Novak
be0433a1fb Use freerdp_settings_set_pointer_len instead of calloc 2021-10-18 14:48:27 +02:00
Armin Novak
0848ad1a71 Use realloc and Stream_StaticConstInit for certificate 2021-10-18 14:48:27 +02:00
Armin Novak
d491031be2 Fixed copy of ServerCertificate 2021-10-18 14:48:27 +02:00
Armin Novak
dec4cb4d73 Fixed rdpdr device name setting 2021-10-18 12:49:38 +02:00
Armin Novak
990400aedd Close SVC channels in WTSVirtualChannelClose 2021-10-18 12:49:38 +02:00
Armin Novak
41d77cae46 Fixed /video buffer alignment, added assertions 2021-10-18 10:53:05 +02:00
Armin Novak
a1a7724b88 Fixed freerdp_image_fill scanline detection 2021-10-18 10:53:05 +02:00
Armin Novak
7d80c74e97 Cleaned up RDPDR channel interhitance
* All channels inheriting from RDPDR_DRIVE base struct
* Add functions to create/free a new device of a type
* Fixed settings array resize code, prevent 0 sizes
2021-10-18 09:21:02 +02:00
akallabeth
07b789c880
Gateway legacy parser fix (#7362)
* Implemented missing TSG debug functions

* Refactored RPC gateway parser

Utilize wStream instead of custom binary parsing code, add proper
input validation.
Reported by Sunglin from the Knownsec 404 team & 0103 sec team
2021-10-15 11:45:08 +02:00
Armin Novak
73fbbcf0fb Fixed const warnings 2021-10-14 13:04:59 +02:00
Armin Novak
cf74a6ea3f Fixed const cast warnings in generated settings setter 2021-10-14 13:04:59 +02:00
Armin Novak
07df48c91d Removed unused variable 2021-10-14 13:04:59 +02:00
akallabeth
da3c1197a2 Fixed GFX alpha painting 2021-10-14 13:01:26 +02: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
217e0caa18
Bitmap update fix (#7349)
* Added checks for bitmap width and heigth values

Data received from the server might have invalid values for bitmap
with or height. Abort parsing if such a value is found.
Reported by Sunglin from the Knownsec 404 team & 0103 sec team

* Added checks for glyph width & height
2021-10-12 12:26:22 +02:00
Hans-Peter Jansen
74d7b4c9b7 Add some ADDIN_PATH debug messages 2021-10-11 08:38:53 +02:00
akallabeth
51268bbcba
Lock updates during gdi_resize (#7330) 2021-10-07 10:25:09 +02:00
Armin Novak
33bc2ba2ab Fixed static-in-line warnings 2021-10-06 09:49:07 +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
Armin Novak
103ff6a758 Fixed certificate store double free. 2021-10-06 09:49:07 +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
Martin Fleisz
e7bfcc37fc core: Fix invalid memory access in local peer detection 2021-09-22 14:32:26 +02:00
akallabeth
e0a531f728
Channel fixes (#7309)
* Added missing CHANNEL_NAME defines.

* Fixed FreeRDP_ChannelDefArray setter

* Fixed code duplication due to merge error

* Added public function freerdp_channels_from_mcs

* Fixed const correctness in mcs
2021-09-22 14:27:21 +02:00
akallabeth
1c84690c2f
Fixes from tests (#7308)
* Fixed memory leak in tls_verify_certificate

* Fixed missing NULL checks

* Fixed missing checks for FreeRDP_DeactivateClientDecoding

* Added WINPR_ASSERT for client common new/free

* Added /disable-output switch to deactivate client decoding

Allows low resource remote connections that do not require visual
feedback. (e.g. load testing/...)
2021-09-21 09:56:56 +02:00
akallabeth
7b7e2d6f32 Prefer constant division over multiplication for length checks 2021-09-21 08:55:22 +02:00
Jeremy Cross
6547db2f17 early bail from update_read_window_state_order when handling WINDOW_ORDER_FIELD_WND_RECTS breaks subsequent protocol parsing 2021-09-21 07:43:03 +02:00
Armin Novak
0ccebb2a0f Fixed missing NULL checks. 2021-09-20 10:59:59 +02:00
akallabeth
3ce622b638 Fixed FreeRDP_WTS* failure handling 2021-09-20 10:59:59 +02:00
akallabeth
bc800175d1 Fixed proper reset ov member variable to NULL 2021-09-20 10:59:59 +02:00
akallabeth
bc80fe3580 Improved server accept log message 2021-09-20 10:59:59 +02:00
akallabeth
d1b58ab263 Refactored rdpRdp cleanup handling 2021-09-20 10:59:59 +02:00
akallabeth
6b24c2be10 Added WINPR_ASSERT and cleanup fixes in freerdp.c 2021-09-20 10:59:59 +02:00
akallabeth
c1e38b24a6 Replaced manual settings value allocation with setter 2021-09-20 10:59:59 +02:00
akallabeth
04a8ced567 Added WINPR_ASSERT and proper error reset in client.c 2021-09-20 10:59:59 +02:00
akallabeth
bfb9a89639 Loop data type fix in certificate.c 2021-09-20 10:59:59 +02:00
akallabeth
73223638dd WINPR_ASSERT in bulk.c 2021-09-20 10:59:59 +02:00
akallabeth
c2d126cdd8 Streamlined rdpCodec cleanup routines 2021-09-20 10:59:59 +02:00
akallabeth
ce8ef33ea4 Added WINPR_ASSERT in transport 2021-09-20 10:59:59 +02:00