Commit Graph

130 Commits

Author SHA1 Message Date
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
Armin Novak
d18b0fbeb4 Handle API updated. 2015-07-03 09:52:52 +02:00
zihao.jiang
75407edf37 Fix event created for WSAEventSelect: The event we pass to WSAEventSelect should be WSAEVENT instead of normal event.
From MSDN, it looks same as CreateEvent(NULL, FALSE, FALSE, NULL):
	The WSACreateEvent function creates a manual-reset event object with an initial state of nonsignaled. The event object is unnamed.
However they are not really equivalent. When we use normal event, the WSAEventSelect still works but the event appears to be 'auto-reset'.
2015-07-01 01:52:59 +08:00
Bernhard Miklautz
bf73f4e4f1 Fix unchecked strdups
* add missing checks
* adapt function return values where necessary
* add initial test for settings
2015-06-22 19:09:59 +02:00
Marc-André Moreau
35e26020aa freerdp: patch multiple leaks and OOM errors 2015-05-22 14:14:57 -04:00
Marc-André Moreau
30dd40e10a wfreerdp: fix and improve remote assistance 2015-05-07 14:20:49 -04:00
Marc-André Moreau
6b1fefea40 freerdp: fix remote assistance mode, add multi-address connection 2015-05-06 16:32:45 -04:00
Norbert Federa
af79c30913 Merge pull request #2554 from akallabeth/event_fix
Fix for transport event reset
2015-04-22 11:04:37 +02:00
Bryan Everly
8c75127a67 Necessary changes to get latest branch working on OpenBSD 5.6 2015-04-21 14:42:06 -04:00
Armin Novak
f634e52289 Using auto reset event now. 2015-04-20 15:04:44 +02:00
Armin Novak
5525d9f88b Fixed uninitialized return value. 2015-04-15 10:38:04 +02:00
Bernhard Miklautz
388d014888 core/tcp: set TCP_USER_TIMEOUT if available
Keepalive settings are usually (depending on the implementation) only
used if the TCP connection is idle.
If the network is interrupted/disconnected/... click or keyboard input
generates outgoing traffic therefore the connection isn't idle
anymore and keepalives might not be used causing the connection to
stay open and the client to stall.

Linux 2.6.36 added a TCP_USER_TIMEOUT TCP socket option that lets a
program specify the maximum time transmitted data may remain
unacknowledged before TCP will close the corresponding connection with
ETIMEDOUT.

Setting TCP_USER_TIMEOUT allows us to detect a network problem (like
cable disconnect) even if the connection isn't idle.
2015-02-20 13:22:01 +01:00
Marc-André Moreau
44d06888bb libfreerdp-core: fix BIO leaks 2015-02-18 15:36:57 -05: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
edfc5120b7 libfreerdp-core: replace rdpTcp by BufferedSocket BIO 2015-02-14 10:14:13 -05:00
Marc-André Moreau
e904195e49 libfreerdp-core: more rdpTcp refactoring 2015-02-13 16:51:08 -05:00
Marc-André Moreau
e241330daf libfreerdp-core: rewrite tls_write_all to use front BIO only 2015-02-13 16:02:37 -05:00