Commit Graph

128 Commits

Author SHA1 Message Date
Kobi Mizrachi 5d39200cd7 libfreerdp: core: add ServerHeartbeat callback 2020-07-07 09:57:53 +02:00
akallabeth b094d52d0b Fixed #6099: Add a flag for legacy hash entries
If a legacy entry is found in certificate hash store print
additional information to the user informing about the change
with FreeRDP 2.0
2020-04-22 18:14:39 +02:00
Armin Novak 3ba66db99d Unify pReceiveChannelData and psPeerReceiveChannelData
Fix definitions of the two function pointers.
Use and definition did not match, fix that.
Will create warnings in external projects
2020-03-10 12:21:14 +01:00
Armin Novak d5b5088eac Fixed misinterpretation of SendChannelData
SendChannelData was defined with a return value of type int, but
used as BOOL everywhere. Fix the definition to match use.
2020-03-10 12:21:14 +01:00
Armin Novak b3179174ec Fixed function pointer const correctness. 2020-03-04 14:44:03 +01:00
Armin Novak 895cb8f944 Added macro freerdp_set_last_error_if_not
This macro replaces the multiple instances where the current
error state is checked before setting an optional error state.

Signed-off-by: Armin Novak <armin.novak@thincast.com>
2020-01-09 10:34:27 +01:00
Armin Novak 7d252cdc8e Added freerdp_set_last_error_ex function
This new function allows better logging of call locations
for errors. Additionally added freerdp_set_error_log macro
to record function, file and line the error was set.

Signed-off-by: Armin Novak <armin.novak@thincast.com>
2020-01-08 17:39:25 +01:00
Armin Novak 72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
David Fort bd5a88e95a rdp: count in/out bytes and packets 2019-10-23 09:16:35 +02:00
Armin Novak 8d088387da Added function to get an error category for better error handling. 2019-10-03 11:19:03 +02:00
kubistika ef3a3ae9e6 Export Error Info PDU. 2019-05-19 14:42:16 +03:00
Mati Shabtay b907324009 First version of an RDP proxy (#5372)
* server: Add proxy dir with barebones server

* sever/proxy: Remove licensing

* server/proxy: Add client files

* server/proxy: rm binary

* server/proxy: Formatting

* server/proxy: Fixed includes and added basic client creation functionality

* server/proxy: Remove licensing and fix ifndef

* proxy/server: Fix cmake indentation

* server/proxy: Fix licensing

* server/proxy: Forward connection on peer_post_connect

* server/proxy: Fix function signature

* server/proxy: Changed function signature of proxy_client_start

* server/proxy: Now peer_post_connect calls proxy_client_start in a new thread

* pfreerdp.c: Clean up useless comments and logs

* server/proxy: Fix license

* server/proxy: Remove all non-connection related data from proxy_context

* server/proxy: Move Log Tag definition to pf_log.h

* server/proxy: Move context definition to pf_context

* server/proxy: Delete pfreerdp.h

* pfreerdp.c: Move context callbacks to pf_context.c

* server/proxy: Update CMakeLists.txt

* pf_channels: Use new proxy context API

* pf_client: Move context to pf_context

* pf_client.c: Remove unnessecary event handling

* server/proxy: Formatting

* proxy/server: Move server logic to pf_server.c

* server/proxy: Handle client disconnection

* Merge stash

* pf_server.c: Open GFX Connection to client

* server: CMakeLists: build proxy along with other servers

* server: proxy: get target server from rdpNego->RoutingToken

Iv'e omitted a check from  which im not sure is right. Should check in docs

* server/proxy: Handle remote server -> client disconnection

* server/proxy: Move common function  to pf_common.c

* server/proxy: Move common function  to pf_common.c

* rdpgfx.h: Add reference to freerdp.h for rdpContext

* pf_channels: Pipe GFX on channel connection

* server/proxy: Add pf_rdpgfx for proxy gfx callbacks

* pf_client: Declare dynvc and gfx capabilities on connection

* server/proxy: Add graphics callbacks

* server/proxy: Add graphics callbacks

* pf_server: Listen to channel events

* Pass user settings to server

* pf_server: Proxy mouse events

* fixup! server/proxy: Add graphics callbacks

* pf_client: Fix setting initialization

* Merge feat/proxy-gfx to feat/proxy

* pf_server: Fix double freed credentials

* server/proxy: Remove unnecessary call to freerdp_client_settings_parse_command_line

* server/proxy: Refactor re-activation code

* server/proxy: Run format scripts

* server/proxy: Fix segfault when post_disconnect return FALSE

* server/proxy: Refactor proxy_settings_mirror

* server/proxy: Redirect credentials

* server/proxy: move proxy_settings_mirror to pf_common.c

* server/proxy: Redirect desktop_resize event

* pf_client: Remove interactive CLI auth methods

* fixup! server/proxy: Redirect credentials

* server/proxy: Rename proxy_mirror_settings to pf_common_copy_settings

* pf_server.c: Fixed non-freed context

When the disconnection is forced by the target server, the function
`pf_server_handle_client_disconnection` isn't called. Therefore, the
context of the connection between the proxy to tagrget isn't freed.

* fixup! pf_server.c: Fixed non-freed context

* pf_client: Prefix all client methods with pf_client

* pf_context: Add init client to proxy context method

* pf_server: Confirm all GFX caps regardless of settings

* pf_server: Prefix all methods with pf_server

* pf_server: Move variable decleration to start of method

* pf_server: Fix client setting

* pf_server: Fix GFX init method

* pf_server: Move variable decleration to start of methods

* server/proxy: Formatting

* Merge feat/proxy

* pf_server: Proxy synchronize event

* pf_server: Proxy refresh rect update events

* pf_server: Proxy suppress output messages

* server/proxy: Fix licensing

* server/proxy: Move client input callbacks to pf_input

* server/proxy: Move client update callbacks to pf_update

* server/proxy: Fix non-terminated target host string

* Feat/proxy config (#2)

* server/proxy: Add config loading support

* server/proxy: Add config file

* server/proxy: Format code

* server/proxy: Code refactor, rename update_register_callbacks and input_register_callbacks

* server/proxy: Update config file

* server/proxy: Remove config.ini from root directory

* Remove comment from config file

* server/proxy: Fix leak in pf_server_load_config

* server/proxy: Add rdpServerProxy struct and embed it in proxyContext

* server/proxy: Load configuration and pass it inside every proxyContext instance

* server/proxy: Move rdpProxyServer to proxy.h

* server/proxy: Use configuration while proxying input events

* server/proxy: Update CMakeLists

* server/proxy: Refactor pf_input.c

* server/proxy: Add AllowedChannels, DeniedChannels in configuration

* server/proxy: Remove unnecessary variable from parse_channels_from_str

* server/proxy: Update config file

* server/proxy: config: Rename  to

* server/proxy: config: Add mode - blacklist/whitelist

* server/proxy: Refactor, fix NULL deref

* server/proxy: Add license to proxy.h

* server/proxy: Fix newline in pf_config.c

* server/proxy: config: Rename Mode to WhitelistMode

* Add target in config. Add checks for configuration validity (#3)

* Add target in config. Add checks for configuration validity

* Update config file

* libfreerdp: nego: revert commented out check of routingToken length

* pf_server: Fix target host info from RoutingToken

* pf_server: Remove hardcoded lenght of routing token prefix

* Feat/refactor context (#8)

* Refactor main structs

* Update CMakeLists.txt

* pf_server.c: Free pdata at the end of the connection

* Run format scripts

* Rename tf to pc

* Fix licenses

* pf_server: Refactor names of structs and functions

* proxy: gfx: sync caps (#4)

* proxy: gfx: sync caps

* proxy: gfx: sync caps, hook gfx client's OnClose() call and close server resources

* fixup! Feat/refactor context (#8)

* fixup! fixup! Feat/refactor context (#8)

* rdpgfx/client: Fix rdpgfx_recv_caps_confirm_pdu caps set length parsing

* Run format scripts

* proxy config.ini: Change default port to 3389

* pf_rdpgfx: Limit caps version to freerdp's supported versions

* Gfx OnOpen() wait for dynvc ready (#10)

* proxy/gfx: Wait for dynvc ready state before open

* pf_channels: Initialize pc->gfx

* pf_rdpgfx: Add log and fix comments

* rdpgfx: Fix GFX v10.6 PDUs parsing and naming according to the spec

* pf_rdpgfx: Proxy rdpgfx v10.6 PDUs

* gfx client: Publish FrameAck sending and add auto ack flag

* proxy/gfx: Forward frame ack messages

* pf_context: Forward domain on connection

* pf_rdpgfx: Change max supported caps to 10.6

* proxy: Update config

* server/proxy: Use configuration in pf_server_handle_client

* rdpgfx/client: Fix size of surface_to_scaled_window, surface_to_window

* pf_rdpgfx: Fix formatting

* pf_server.c: Fix comments

* Move pf_server_rdpgfx_init to pf_rdpgfx

* server/proxy/CMakeLists.txt: Fix formatting

* pf_client.c: Add comment in proxy_server_reactivate

* Fixed const correctness of gfx function pointer

Signed-off-by: Mati Shabtay <matishabtay@gmail.com>

* server: proxy: update copyright

* server: proxy: wrap rdpNego and add a getter for routing token

* Refactor routing token getter (#14)

* Refactor routing token getter

* pf_server_parse_target_from_routing_token change routing_token_length to be DWORD

* libfreerdp/core/nego.c: Run format script

* pf_server: Run format script

* server/proxy: Fix os msbuild tests

* pf_channels.c: Remove unused channels

* pf_client: Remove unused callbacks

* proxy: Remove encomsp callbacks from proxy's client

* client/rdpgfx_main.c: Fix msbuild test

* pf_config.c: Use StrSep instead of strsep for Windows builds

* Removed nego struct from direct access.

Signed-off-by: Mati Shabtay <matishabtay@gmail.com>

* proxy: Rename binary to freerdp-proxy

* rdpgfx_main.c: Revert unwanted double change to send_supported_caps

* Cleaned up proxy server code.

* All internal functions static
* Added simple command line argument to supply a config file
* Silence compiler warnings

Signed-off-by: kubistika <kmizrachi18@gmail.com>
2019-05-17 14:32:54 +02:00
Armin Novak 67be5258ad Exposing NLA functions to impersonate and revert context. 2019-03-08 10:10:43 +01:00
Armin Novak 8ddabd2654 Fix #1195: Implement callback for Gateway Messages 2018-12-11 15:24:24 +01:00
Armin Novak 7ab07ab980 Added certificate callbacks with source indications. 2018-12-04 09:35:24 +01:00
Armin Novak dd3276d664 Prefer VerifyX509Certificate and fixed const arguments
If VerifyX509Certificate is set use it also when doing internal
certificate management. Added flags to ensure it is possible to
find out which type of connection is being made.
2018-12-04 09:35:24 +01:00
rbarnett 5d3e76bd80 Replace cryptic names; move the disconnect ultimatum reasons enum into public API and rename; remove setter 2018-09-19 09:36:39 -05:00
rbarnett 8458266183 Store the disconnect provider ulimatum reason in a new field in struct rdp_context and move the test for a logoff reason to xf_client.c 2018-09-18 15:31:10 -05:00
Armin Novak 9a47ce3f76 Fixed missing variable type 2018-06-19 16:57:45 +02:00
Armin Novak 273655a850 Follow up fix for #4631
Remember the callback state to avoid calling reerdp_channels_post_connect
before the corresponding client callback has benn called.
This might happen during redirection and reconnection.
2018-06-18 10:44:35 +02:00
Armin Novak 7af9ba9171 Refactored reconnect and redirect API
Reconnect and redirect share the same code on disconnect.
Move that to a single function and export it as it may be required
to terminate the session properly before reconnect is called.
2018-04-09 14:04:30 +02:00
Armin Novak d119745d97 String representation of logon_error_info 2017-03-02 18:09:51 +01:00
Armin Novak 9f19da798c Added attach/detach support for channels. 2016-12-19 17:07:01 +01:00
Marc-André Moreau dee76617d9 channels: remove thread-local storage usage 2016-11-15 11:41:01 -05:00
Marc-André Moreau 70c4646722 channels: restore global tables for initHandle, openHandle mappings instead of thread local storage 2016-11-14 15:23:05 -05:00
Armin Novak dadc5262ae Removed static channel variables.
Global static variables do not work, if more than one instance
of an RDP client is running in the same process space.
Removed the varaibles where possible and replaced them with
thread local storage where necessary.
2016-10-06 13:43:09 +02:00
Armin Novak cbf2892ccc Implemented temporary certificate accept.
Certificates can now be accepted temporarily.
The callbacks for certificate validation have been
modified to extend the information presented to the user.
2016-02-05 02:04:57 +01:00
Armin Novak 035f127081 Added get_build_config functions. 2016-01-28 14:26:50 +01:00
MartinHaimberger d971116457 Merge pull request #2765 from akallabeth/connect_abort
Connect abort and unified TCP connect
2015-09-07 10:05:24 +02:00
Armin Novak 3b8043264f Resetting channel error on connect. 2015-09-03 13:46:17 +02:00
Armin Novak e6c23cb534 Implemented Async TCP connect with abort event
* Implemented unified freerdp_tcp_connect_timeout with connect abort.
* Implemented unified freerdp_tcp_connect_multi with connect abort.
* Added connect abort to freerdp_tcp_connect.
* Added freerdp_abort_connect and abortEvent.
2015-08-27 15:33:06 +02:00
Martin Haimberger 52405a3e79 Remove WIN32ERROR type
All return values are UINT now.
2015-08-27 05:38:20 -07:00
Martin Haimberger e682329eeb fixed compiler errors 2015-07-15 03:17:38 -07:00
Martin Haimberger b8c110d19b introduced channel error reporting system
The rdpContext gets an event which will
get set if an error occoured in a channel.

If a thread or a void callback has to report an
error it will get signaled by this system.
2015-07-15 00:50:35 -07:00
Armin Novak 7fc1c65165 Added subject and issuer to saved data.
When a certificate has changed, display not only the
fingerprint but also subject and issuer of old certificate.
2015-06-11 11:21:23 +02:00
Norbert Federa ef1fd12b15 Fix unchecked CreateEvent calls and misc fixes
1)
Added missing checks for CreateEvent which also required the
following related changes:

- changed freerdp_context_new API to BOOL
- changed freerdp_peer_context_new API to BOOL
- changed pRdpClientNew callback to BOOL
- changed pContextNew callback to BOOL
- changed psPeerAccepted callback to BOOL
- changed psPeerContextNew callback to BOOL

2)
Fixed lots of missing alloc and error checks in the
changed code's neighbourhood.

3)
Check freerdp_client_codecs_prepare result to avoid segfaults
caused by using non-initialized codecs.

4)
Fixed deadlocks in x11 caused by missing xf_unlock_x11() calls
in some error handlers

5)
Some fixes in thread pool:
- DEFAULT_POOL assignment did not match TP_POOL definition
- don't free the pool pointer if it points to the static DEFAULT_POOL
- added error handling and cleanup in InitializeThreadpool
2015-04-29 18:18:39 +02:00
Armin Novak d3336340ba Add *get_event_handles handle count, return check. 2015-04-21 12:24:50 +02:00
Martin Haimberger 9c0d275548 transport: added function to get bytes written
added function to get written bytes on transport.
This is needed to get a more accurate bandwidth
management.
2015-04-14 03:49:01 -07:00
Armin Novak 0adab13719 Now returning const char* 2015-03-30 18:09:02 +02:00
Armin Novak 8f228163a8 Added version and build info functions
Added functions to get
 * Version String
 * Build Time String
 * Git Revision String
and appropriate tests.
2015-03-30 17:51:29 +02:00
Armin Novak 56dc61cc06 Added error name and string functions.
Added new functions allowing to get a string representation of an error code
and a description of the error for connect and base error classes.
2015-03-19 11:05:16 +01:00
Marc-André Moreau 991f7b347d libfreerdp-core: further abstract multiple connections used internally by tsg from rdpTransport 2015-02-15 10:06:17 -05:00
Marc-André Moreau 3a906caa4a freerdp: add event handle usage instead of file descriptors 2015-01-29 22:57:58 -05:00
Martin Haimberger bba342a6be added set_error_info function
if an error_info is set, a TS_SET_ERROR_INFO_PDU
will be sent to the client on disconnect with
the error_info
2015-01-13 08:09:36 -08:00
Vic Lee 152d525a05 libfreerdp-core: server-side auto-detect feature. 2014-10-29 00:49:49 +08:00
erbth 58c392e72e Added lock key synchronization to wfreerdp 2014-10-03 16:27:47 +02:00
Marc-André Moreau c71e4e18a1 libfreerdp-core: refactor codec context management 2014-09-10 00:42:41 -04:00
Marc-André Moreau 830659fc5c libfreerdp-core: add new protocol metrics module 2014-05-26 12:30:58 -04:00
Benoît LeBlanc d1b9565f51 Added context-specific error management.
Added error codes to replace connectErrorCode.
2014-03-20 18:19:54 -04:00
Marc-André Moreau 4bbd78a80b libfreerdp-core: remove unnecessary usage of freerdp_channels_data 2014-02-15 15:26:34 -05:00