Commit Graph

17143 Commits

Author SHA1 Message Date
akallabeth
c0dc193a39 [winpr,input] use enum for keyboard types
* move type definition to WinPR as used there too.
* supported keyboard types are defined in
  [MS-RDPBCGR] 2.2.1.3.2 Client Core Data (TS_UD_CS_CORE)]
  use a enum instead of magic numbers to make code more readable.
2023-04-21 12:31:51 +02:00
akallabeth
1318b813d6 [winpr,input] fix apple keyboard mapping
GetVirtualKeyCodeFromKeycode and GetVirtualKeyCodeFromKeycode used
an invalid index offset. this commit corrects that, but is API breaking.
2023-04-21 12:31:51 +02:00
Pascal Nowack
bb967d1533 winpr/input: Add actual evdev keyboard handling
WinPR provides APIs to convert between keycodes between virtual
keycodes.
These keycodes can currently be evdev keycodes or Apple keycodes.
The evdev handling, however, handles XKB keycodes and not evdev ones.
The main difference between these is that XKB keycodes are shifted by
the value 8, compared to evdev keycodes.

In order to fix this situation, rename the evdev keycodes to XKB ones,
and introduce additionally a new keycode evdev, including its handling
for this keycode type.
2023-04-21 12:31:51 +02:00
Martin Fleisz
73911425d4 gateway: Do not encrypt message during RPC NTLM auth
Commit 2de7a4c249 introduced major changes
in the gateway authentication code. One of these changes was to decouple
NTLM specific authentication from the gateway code.

However with these changes, gateway authenciation with the old RPC code
stopped working and returned an authentication error. The problem is
that currently `credssp_auth_encrypt` encrypts the given message along
creating a signature.

The old code prevented encryption of the message by specifying
`SECBUFFER_READONLY` on the message buffer. The native Windows SSPI then
leaves this buffer as-is and gateway authentication works again.

This fix only applies to Windows platforms using the native SSPI API.
Interestingly this works on other platforms using the WinPR SSPI so
there seems to be a difference between the implementations (but that's a
topic for another PR).
2023-04-21 08:15:00 +02:00
Pascal Nowack
4be3950fd8 rdpecam/server: Remove wrong assertion
Some PDUs, like the Activate Device Request only contain the header.
As a result, the size of the rest of the PDU is 0.
The assertion for the PDU size in device_server_packet_new only
considers the size of the body of the PDU.
When that value is 0, the assertion is hit and the server implementation
crashes.

To fix this issue, simply remove this assertion. Since the allocation
size is always at least the header size, there won't ever be an attempt
to create a stream with a size of 0.
2023-04-19 22:20:04 +02:00
akallabeth
dd57de8e19 [client,sdl] add function to context 2023-04-19 11:04:13 +02:00
akallabeth
0627baa939 [client,sdl] move functions to proper place 2023-04-19 11:04:13 +02:00
akallabeth
01293f4c3f [client,sdl] migrate sdl_kbd to class 2023-04-19 11:04:13 +02:00
akallabeth
63606b3c7c [client,sdl] migrate display channel to class 2023-04-19 11:04:13 +02:00
akallabeth
05a2291861 [client,sdl] split sdl_freerdp.hpp 2023-04-19 11:04:13 +02:00
Armin Novak
26ee0590d6 [client,sdl] use CriticalSectionLock
use c++ RAII to lock critical sections
2023-04-19 11:04:13 +02:00
Armin Novak
86470103c4 [client,sdl] rename c++ headers to hpp 2023-04-19 11:04:13 +02:00
akallabeth
c35b41c05d [client,sdl] rename update trigger helper class 2023-04-19 11:04:13 +02:00
Armin Novak
f5453aa952 [client,sdl] standalone build
* move to c++
* build out of tree
2023-04-19 11:04:13 +02:00
Armin Novak
8994d4a213 [core,license] fix length checks
check the correct stream.
2023-04-19 10:51:33 +02:00
Marc-André Moreau
32264b90cc add WITH_UNICODE_BUILTIN option to use built-in UTF conversion functions 2023-04-18 16:51:08 -04:00
Joan Torres
3bcbdeb9fc [core,rdstls] Avoid Stream_SafeSeek on pdu parsing 2023-04-18 20:14:36 +02:00
akallabeth
4d663682bc [server,proxy] ensure PEM length is strlen(pem) + 1
The decoded base64 data might contain PEM with/without/with multiple
'\0' at the end of the string. We do not want to drag this through our
code so ensure the length matches the string length including '\0'
2023-04-17 17:59:06 +02:00
akallabeth
7f2714a341 [client,cliprdr] fix missing include 2023-04-17 16:44:46 +02:00
Pascal Nowack
7fce527cff client/X11: Fix IO errors during server to client file transfer
When receiving a file list, xfreerdp3 rebuilds the content of the FUSE
filesystem.
Since fetching uri-lists can happen during a paste action too, xfreerdp3
caches the content of the last fetched mime type.
However, uri-lists exists in different variations, e.g. nautilus uses a
different mime type, than gnome-terminal does.
Furthermore, FormatLists can also contain other formats in addition to
file lists.
Fetching those contents during a paste operation leads to IO errors in
the paste operation.

In order to fix those errors, cache every mimetype in two hash tables:
One for the raw (unconverted) data, and one for the converted data.
When a content request is received, xfreerdp3 can with the already
cached converted data, directly serve the data.
If the content is not available as cached data, but its source data was
already fetched, use that source data to create the converted data.
Then serve the converted data.
Only if no cached converted data or cached raw data is available, issue
a new FormatDataRequest.
2023-04-17 08:33:53 +02:00
akallabeth
4c0b169774 [winpr,wtypes] fix BOOL definition for APPLE
* Add TargetConditionals.h include to ensure the symbols are defined
* Check for symbol existence and value != 0
2023-04-14 16:08:19 +02:00
akallabeth
48bbb08793 [server,proxy] remove too strict assert 2023-04-14 15:54:26 +02:00
akallabeth
c3f6b665cc [server,proxy] improve error message for invalid base64
If the certificate or private key are supplied as base64 encoded string
inform what happened before aborting.
2023-04-14 15:54:26 +02:00
Armin Novak
eb20b4ad5f [server,mac] fix missing includes, API changes 2023-04-14 15:50:50 +02:00
Armin Novak
54bd41e99c [winpr,collections] fix c++ warings for PubSub 2023-04-14 08:44:14 +02:00
Armin Novak
639ac20ed9 [winpr,stream] fix c++ warings for Stream_Write_UINT8 2023-04-14 08:44:14 +02:00
Armin Novak
8989386d01 [winpr,stream] fix c++ warings for Stream_Write_UINT64 2023-04-14 08:44:14 +02:00
Armin Novak
a13701f69c [winpr,assert] eliminate c++ warnings
Eliminate cast warnings when used in C++ code
2023-04-14 08:44:14 +02:00
Pascal Nowack
8362b3707e pointer: Rename position to hotspot position in Color Pointer Update
The attributes xPos and yPos for a Color Pointer Update are confusing,
as they may be confused with the xPos and yPos of the pointer bitmap on
the actual screen.
Rename these attributes to what they actually represent, and that is the
hotspot position.
xPos and yPos are still members of the hotspot. However, hotSpotX and
hotSpotY are much more clearer.
In addition to that, the Large Pointer Update uses the same names for
the hotspot coordinates.
2023-04-14 08:31:20 +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
Armin Novak
abe49dfd3d [core,settings] fix missing return path 2023-04-13 14:41:16 +02:00
Armin Novak
3c3c996974 [client,common] do not insist on 32bpp for rfx/gfx 2023-04-13 14:35:51 +02:00
Armin Novak
391f5e0ddb [settings] add freerdp_supported_color_depths_string 2023-04-13 14:35:51 +02:00
Armin Novak
fcdd3a1e75 [core,gcc] SupportedColorDepths and HighColorDepth
Split these, now independent from ColorDepth
2023-04-13 14:35:51 +02:00
Armin Novak
39767c5423 [settings] add supported color depths setting 2023-04-13 14:35:51 +02:00
Armin Novak
7a283a140a [client,sdl] improve mouse scroll speed 2023-04-13 13:20:38 +02:00
Pascal Nowack
43f0fbdc12 core/autodetect: Allow overriding connect-time autodetection handling
Currently, FreeRDP-based server implementations can do connect-time
autodetection.
However, without having any control over it.

In order to be able to override the default connect-time autodetection
handling, introduce three new states for the state machine of the
connection sequence and two new callbacks for the autodetect handling.

These are:
- CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT_BEGIN
- CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT_IN_PROGRESS
- CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT_END

- OnConnectTimeAutoDetectBegin()
- OnConnectTimeAutoDetectProgress()

The END state is pretty simple: When the autodetection is finished and
the autodetect state is FREERDP_AUTODETECT_STATE_COMPLETE, transition
into the next state of the connection sequence.

The BEGIN state is entered, when capability-wise network autodetection
is available.
In this state, the OnConnectTimeAutoDetectBegin callback is called, the
server implementation may initialize any related handling here.
If the server implementation determines, that no further handling is
required, it can end the autodetection phase by returning
FREERDP_AUTODETECT_STATE_COMPLETE.
If not, and an autodetection request is sent, it returns
FREERDP_AUTODETECT_STATE_REQUEST.
The state machine of the connection sequence will then switch into the
IN_PROGRESS state.

In the IN_PROGRESS state, any incoming PDU is handled first, then the
OnConnectTimeAutoDetectProgress callback is called.
Like in the BEGIN state, the return value will determine, whether the
state machine of the connection sequence goes into the END state or goes
into (or rather stays) in the IN_PROGRESS state.
2023-04-13 09:58:52 +02:00
Pascal Nowack
91ff145ae8 core/autodetect: Rework server side API to be closer to documentation
The current state of the autodetect API for the server side does not
include all allowed scenarios where the network autodetection can be
used.
This for example includes the connect-time autodetection, as the
related calls are hidden inside FreeRDP, and not exposed as public API.
In order to avoid duplicate send methods, check the state of the
connection sequence.
If the connection sequence is not yet done, use the connect-time request
types.
Otherwise, use the continuous request types.

The Bandwidth Measure Payload PDU is a little special case, as it is
only allowed to be sent during the connection sequence.
To ensure this, add an assertion in its sending method.

Also fix the handling for the Network Characteristics Sync PDU:
Previously, after parsing the PDU data, the read data was just sent
again to the client, which is wrong.
To fix this issue, introduce a callback for this client-to-server PDU,
so that the actual server implementation can hook up its own handling
for this PDU.
Depending on the situation, the server side may want to discard or use
the retrieved data here.

Moreover, decouple the send-handling for the Network Characteristics
Result PDU from the local autodetect variables.
Currently, these variables are shared between the send and receive
methods.
This leads to access problems, where the server side, wants to use a
different thread to send the autodetect PDU, as the receive handler may
receive an autodetect PDU and overwrite these values with possible
nonsense values.
This is especially the case with RTT response PDUs, as the written
netCharAverageRTT and netCharBaseRTT values are only correct, when only
one RTTRequest happens at a time and no stray RTTResponses are received.
2023-04-13 09:58:52 +02:00
Armin Novak
f8e8764ea8 [core,settings] unify identity from settings 2023-04-11 11:37:09 +02:00
Armin Novak
9b498efa79 [core,nla] unify identity creation 2023-04-11 11:37:09 +02:00
Armin Novak
4408521421 [winpr,sspi] match SEC_WINNT_AUTH_IDENTITY integer
windows defines them with ULONG which does not match UINT32, so keep
these types proper
2023-04-11 11:37:09 +02:00
Armin Novak
e2f85fc329 [core,nla] ensure the identity is created with unicode 2023-04-11 11:37:09 +02:00
Armin Novak
13c025e04c [winpr,sspi] remove sspi_SetAuthIdentityWithUnicodePassword
the function is useless as we always use the SetAuthIdentityW API now
2023-04-11 11:37:09 +02:00
Armin Novak
91056dc96c [client,common] fix file clipboard locking 2023-04-11 11:34:19 +02:00
Armin Novak
aac0c0d01d [core,gateway] fix expected size for rts_read_auth_verifier_no_checks 2023-04-11 11:31:57 +02:00
Armin Novak
c638c51484 [core,gateway] fix expected length rts_read_auth_verifier_with_stub 2023-04-11 11:31:57 +02:00
Armin Novak
adc6b60bcf [core,gateway] silence rts_read_common_pdu_header
rts_read_common_pdu_header is used to determine if the packet was read
successfully. In that case it might fail but there should be no logging
done to not spam it with unnecessary warnings.
2023-04-11 11:31:57 +02:00
akallabeth
6a35f11faa [core,gateway] fix warnings with static stream 2023-04-11 11:30:41 +02:00
akallabeth
f3b7c1b84d [core,gateway] log http status codes 2023-04-11 11:21:27 +02:00
akallabeth
0f1b0cac76 [core,gateway] add http_status_string_format 2023-04-11 11:21:27 +02:00