Commit Graph

146 Commits

Author SHA1 Message Date
akallabeth e6d10041c1 Fix #6033: freeaddrinfo must not be called with NULL arguments. 2020-04-09 14:26:46 +02: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 639174e7d3 Added configurable TcpKeepAliveDelay setting. 2019-11-07 16:07:18 +01:00
Armin Novak 09dd01a78f Implemented configurable tcp keepalive and timeout detection 2019-11-07 13:03:33 +01:00
Armin Novak 72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak f25488a7ab Reset last error state after a hostname was resolved successfully. 2019-09-11 10:43:17 +02:00
Armin Novak f51a9bafcc Fixed sign-compare warnings 2019-04-05 09:13:24 +02:00
Armin Novak 5623a4761f Fixed a possible NULL dereference. 2018-11-23 10:32:52 +01:00
akallabeth d0d414dfa0 Fix #5059: Changed return type of peer_free to void. 2018-11-22 19:08:25 +01:00
Armin Novak 8df39fdad4 Use blocking sockets in freerdp_tcp_connect_multi
The non blocking connect in freerdp_tcp_connect_multi did not
work reliably.
Fall back to blocking connect (which might take longer until the connection
is established) instead of not being able to connect at all.
2018-11-22 11:11:31 +01:00
Armin Novak 1ed436c8fc Fixed socket cleanup in connect multi. 2018-11-22 11:11:31 +01:00
Armin Novak 4b3f4cc2fc Fixed event check in freerdp_tcp_connect_multi 2018-11-22 11:11:31 +01:00
Armin Novak 5f4843191b Replaced BIO_free with BIO_free_all
There is no point in using BIO_free with a custom recursion
to free up stacked BIOs if there is already BIO_free_all.
Using it consistently avoids memory leaks due to stacked BIOs
not being recursively freed.
2018-11-08 12:09:49 +01:00
Armin Novak 5eca5ebde8 Fixed #4993: Allow uninitialized bio socket in transport_bio_simple_uninit
When the TLS connection is aborted early (certificate issues, ...)
the bio simple socket might not have been initialized.
Do not access the NULL pointer on cleanup.
2018-11-07 17:02:07 +01:00
Armin Novak 88d310ff2c Fixed compiler warnings (casts, ...) 2018-10-18 09:09:30 +02:00
Armin Novak 47ba37fbcb Unified dns resolving of host 2018-09-27 16:08:28 +02:00
Armin Novak 114abad767 Removed use of strcpy. 2018-08-27 14:34:09 +02:00
Ondrej Holy 1a413b5b4e core/tcp: Prevent buffer overflow found by covscan
buffer_size_warning: Calling strncpy with a maximum size argument of 108 bytes on destination array "addr.sun_path" of size 108 bytes might leave the destination string unterminated.
2018-08-22 14:34:02 +02:00
Ondrej Holy 26bc52f79c core/tcp: Format code by astyle
Run ./scripts/format_code.sh before the following changes.
2018-08-22 14:34:02 +02:00
Martin Fleisz 99346d19c6
Merge pull request #4611 from akallabeth/argument_warnings
Argument warnings
2018-05-04 10:06:42 +02:00
Armin Novak 5765e9a422 Fixed #4476: broken casts/variable sizes for custom BIO calls. 2018-05-03 12:30:40 +02:00
Armin Novak f631958a08 Fixed argument warning. 2018-05-02 13:08:17 +02:00
Martin Fleisz 855af9e941
Merge pull request #4557 from akallabeth/connect_error_fix
Set connection error if TCP connect fails.
2018-04-12 12:10:56 +02:00
Armin Novak 2fc31fcb37 Set connection error if TCP connect fails. 2018-04-11 09:09:23 +02:00
Andre Esteve d240069b5e Gateway (RDG) use same IP for both channels 2018-04-10 20:59:33 -07:00
Armin Novak 26d9957608 Fix pointer type mismatch struct sockaddr_storage* and struct sockaddr* 2018-04-05 10:47:50 +02:00
Martin Fleisz ff8b2c1b0e core: Fix IPv6 handling on Windows
On Windows the sockaddr struct is smaller than sockaddr_in6.
This causes getsockname to fail because the buffer is too small.
The new code uses sockaddr_storage which should be large enough to
hold any supported protocol address structure.

See: http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/socket.h.html
2018-04-04 17:19:18 +02:00
Armin Novak 78de329f1f Fixed IPv4/IPv6 to string 2018-02-08 17:26:31 +01:00
Armin Novak 7305828122 Fix #4239: Various memory leaks
* Fixed all tests, now can be run with -DWITH_ADDRESS_SANITIZER=ON compiled.
* Enabled address sanitizer for nightly builds.
2017-12-12 11:40:48 +01:00
Armin Novak 2cc64298f2 Fix #4281: Added option to prefer IPv6 over IPv4 2017-11-27 11:43:54 +01:00
Jura Sasek 4edb5cf7e6 Build for Solaris 2017-05-24 04:27:01 -07:00
Armin Novak 8250bbd6c8 Setting DNS error if lookup fails. 2016-12-19 13:49:40 +01:00
Norbert Federa f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Norbert Federa c6e6b44143 countless WLog/printf format specifier fixes 2016-11-25 17:06:25 +01:00
Norbert Federa 7befab856c Support for OpenSSL 1.1.0 2016-11-24 17:50:09 +01:00
Armin Novak 9c64e77a84 Disabled thread local storage on iOS.
iOS does not support Thread Local Storage.
Disabling it for now until a solution is found.
Print a compiler warning informing developers about this issue.
2016-10-06 13:43:10 +02:00
akallabeth 7c5fcc9ee2 Merge pull request #3149 from bmiklautz/feb22
Misc fixes
2016-02-23 20:23:52 +01:00
Bernhard Miklautz be02849ece tcp: set the timeout to 9s
Set the TCP_USER_TIMEOUT to 9s as suggested by @giox069.
See #3015 for details
2016-02-23 15:40:20 +01:00
volth 8b9c40248a Increase TCP_USER_TIMEOUT to avoid disconnections.
TCP_USER_TIMEOUT value is too small, it is only 4 seconds. 
That causes random disconnections reported in the bug report https://github.com/FreeRDP/FreeRDP/issues/2802
This patch should fix the bug report https://github.com/FreeRDP/FreeRDP/issues/2802
2016-02-23 15:40:20 +01:00
Bernhard Miklautz e6f013eac7 fix spelling
replace occured with occurred
Fixes #3142
2016-02-22 17:01:43 +01:00
Armin Novak 22f704c0a8 Fixed _socket error check. 2016-02-03 11:45:22 +01:00
Nito Martinez 2d5c78849e Fix formatting: else if in its own line and no brackets for single statements 2015-11-26 09:50:03 +01:00
Nito Martinez 89d8a68f4a Disable setting socket options for preexisting socket like: keepalive and tcp_nodelay, these should be set extenally if needed. Do not close the socket if the clientaddress could not be set 2015-11-25 08:36:49 +01:00
Nito Martinez 428cbd802d Fixes #2982. The idea is to be able to create the socket externally and pass that socket FD to FreeRDP so that it can be used there.
The idea suggested is to use the following interface:

settings->ServerHostname = "|"
settings->ServerPort = SocketFD
2015-11-20 02:44:35 +01:00
Armin Novak 7d8ab23877 WSAEvent fixes ported from realjiangms pull 2870. 2015-09-05 15:18:01 +02:00
Armin Novak 7ebf4879f0 Fixed uninitialised events. 2015-08-27 15:33:06 +02:00
Armin Novak 134a16d522 Fixed WSAEventSelect mode reset. 2015-08-27 15:33:06 +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
Bernhard Miklautz 68e8569110 winpr/synch: remove the dependency on winsock.h
winsock.h pulls in a lot of defines and dependencies that are not
required and partially unwanted in winpr's core (for parts that are not
related to network). In order to get rid of this dependency and have an
independent defines for extended winpr functions the WINPR_FD_* defines
are used internally (and for exposed functions). Where required, like in
WSAEventSelect, the FD_* is mapped to WINPR_FD_*.
2015-07-14 11:39:41 +02:00