Commit Graph

176 Commits

Author SHA1 Message Date
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
Marc-André Moreau
3782c2ad72 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2014-01-25 16:34:34 -05:00
Mike McDonald
c4f6dcc24f Added auto reconnect to FreeRDP core and X11 client 2014-01-16 17:38:56 -05:00
Benoît LeBlanc
8c1f836ac8 - SSL verification callback: send correct hostname and port
- Gateway Authentication callback.
- Handling “use same credentials”
2013-12-06 22:15:45 -05:00
Benoît LeBlanc
56c517170f Added hostname and port to callback function for SSL certification verification. 2013-11-25 14:30:43 -05:00
Marc-André Moreau
b0369cf284 libfreerdp-core: add external certificate management, pass X509 PEM certificate through client callback 2013-11-18 13:54:33 -05:00
Marc-André Moreau
b70ecbbf62 libfreerdp-core: decouple initialization of rdpSettings from freerdp* instance 2013-10-12 18:20:25 -04:00
Armin Novak
2f20a8c12b Fixed various memory leaks and resource deallocation problems. 2013-08-19 17:44:52 +02:00
Marc-André Moreau
5926fa36dd libfreerdp-client: use PubSub for OnChannelConnected/OnChannelDisconnected 2013-07-11 08:53:15 -07:00
Marc-André Moreau
59b7c53c5f freerdp: remove temporary rdpClient* interface and replace with pubSub hooks 2013-06-15 17:39:45 -04:00
Marc-André Moreau
6c9a3b8e64 freerdp: start using pubSub for client GUI events 2013-06-15 17:01:10 -04:00
Marc-André Moreau
010f1dfdd9 xfreerdp: add rdpClientContext common section 2013-06-14 15:07:17 -04:00
Marc-André Moreau
208c9f844a freerdp: fix core API bugs 2013-06-13 21:34:46 -04:00
Marc-André Moreau
d96249e19f libfreerdp-client: start propagating channels initialization to client 2013-05-13 17:39:53 -04:00
Nigel Reeves
7dedd884b9 Merge branch 'master' of https://github.com/FreeRDP/FreeRDP.git 2013-04-15 11:15:49 +01:00
Nigel Reeves
fb2a087dbf Fix to issue #773. Ensure resume in correct NumLock state, when reconnectin to a session 2013-04-15 11:14:09 +01:00
Marc-André Moreau
68e253e209 libfreerdp-core: add client interface 2013-04-08 15:37:56 -04:00
Marc-André Moreau
066d3384c2 xfreerdp: fix RemoteApp with system message (don't show full desktop on every single connection, just when needed) 2013-03-28 22:26:28 -04:00
Marc-André Moreau
8c8a82c31f libfreerdp-utils: purge old STREAM utils 2013-03-21 16:45:25 -04:00
hardening
865ff2a5f8 Fixed compilation with -Wstrict-prototypes 2013-02-14 22:20:43 +01:00
Marc-André Moreau
bbcf081243 libfreerdp-core: cleanup message interface 2013-02-04 15:47:13 -05:00
Marc-André Moreau
353376abd3 libfreerdp-core: added input event queue 2013-01-27 21:07:17 -05:00
Marc-André Moreau
10a35a9224 libfreerdp-core: add +async-update and +async-input command-line options 2013-01-27 18:22:46 -05:00
Marc-André Moreau
e1d0fad519 libfreerdp-core: fix memory leaks 2013-01-25 17:52:37 -05:00
Marc-André Moreau
d8f8be192e xfreerdp: add asynchronous dequeuing of graphical messages 2013-01-25 12:08:00 -05:00
Marc-André Moreau
c14cf1e203 libfreerdp-core: add message callback registration 2013-01-24 20:05:03 -05:00
Marc-André Moreau
3c8c9aab62 libfreerdp-core: add default message post calls in message queue stubs 2013-01-24 19:08:30 -05:00
Marc-André Moreau
709e66a596 libfreerdp: header cleanup 2012-12-14 00:25:48 -05:00
Marc-André Moreau
9d064171a7 freerdp: get rid of old types 2012-10-09 03:26:39 -04:00
Marc-André Moreau
1bf8a45519 freerdp: change uint8, sint8, uint16, sint16 to BYTE, INT8, UINT16, INT16 2012-10-09 03:01:37 -04:00
Marc-André Moreau
1ed644786c freerdp: change boolean type to BOOL type 2012-10-09 02:38:39 -04:00
Marc-André Moreau
5612bc43f8 freerdp: change true/false to TRUE/FALSE 2012-10-09 02:31:28 -04:00
Marc-André Moreau
e60a092d81 freerdp: fix headers 2012-10-08 23:02:04 -04:00
Dorian Johnson
3b3f05a0b1 libfreerdp-crypto: Allow clients to accept a changed cert 2012-06-28 20:05:10 -05:00
norrarvid
86faf2d268 connect error codes added 2012-04-13 13:16:08 +02:00
Julien Ropé
b928f6844e Missed comment starting format for doxygen in rdp_context structure 2012-03-12 14:45:11 +01:00
Julien Ropé
23ce03b8bd Continue documenting the freerdp.h file 2012-03-12 14:45:11 +01:00
Julien Ropé
9fbbadb7cd Completing rdp_freerdp structure's documentation 2012-03-12 14:45:11 +01:00
Julien Ropé
43360b0453 Adding new comments to xfreerdp.c, going down to the functions it calls in the core lib.
Continue adding comments to struct rdp_freerdp fields.
2012-02-25 21:55:59 +01:00
LittleJawa
37b35b3558 First round of comments while reading the code. 2012-02-23 16:22:05 +01:00
Marc-André Moreau
a932835f44 libfreerdp-auth: resolve cyclic dependency with libfreerdp-core 2012-02-19 12:50:30 -05:00
Marc-André Moreau
8cab067498 libfreerdp-auth: move authentication code out of libfreerdp-core 2012-02-17 17:12:21 -05:00
Pawel Jakub Dawidek
b75b5eb8a1 After DEACTIVATE ALL PDU server can send MCS Disconnect Provider Ultimatum PDU to disconnect.
Handle such condition and exit from xfreerdp gracefully (almost, exit status is still != 0).
2012-02-06 23:10:45 +01:00
Marc-André Moreau
3f91e24a4d libfreerdp-core: added freerdp_get_version() 2012-01-14 13:33:04 -05:00
Marc-André Moreau
fcd03260d6 xfreerdp: added select() timeout 2011-12-11 18:05:32 -05:00
Marc-André Moreau
e2014b65ec freerdp: adopt padding strategy not based on explicit offsets 2011-11-20 14:25:59 -05:00
Marc-André Moreau
7b78bd855f freerdp: fix offset padding for 64-bit architectures 2011-11-19 13:30:36 -05:00
Marc-André Moreau
300fe32eba freerdp: fix offsets in padding 2011-11-19 11:18:45 -05:00
Marc-André Moreau
666fbb0405 freerdp: pad multiple interfaces for improved ABI stability 2011-11-19 02:33:49 -05:00
Eduardo Beloni
b9a008ae8a libfreerdp-core: facilities for storing and retrieving 'error info' 2011-10-25 09:59:18 -02:00
Marc-André Moreau
55b32a9ea9 libfreerdp-core: fix credssp check for Authenticate callback 2011-10-21 11:18:11 -04:00
Marc-André Moreau
488a4161f5 libfreerdp-core: refactoring of callback prefix 2011-10-20 23:15:18 -04:00
Marc-André Moreau
b7e7067176 libfreerdp-core: refactoring of core bitmap objects 2011-10-20 17:28:59 -04:00