Commit Graph

10149 Commits

Author SHA1 Message Date
Ondrej Holy
b8f33aa59c winpr/crt: Make TestString endian-independent
Wide char strings use always little endian encoding since commit f722dc5.
Use only strings in little endian to make the tests endian-independent.
2016-06-10 18:18:47 +02:00
Ondrej Holy
bbcc0476c7 winpr/crt: Fix endianness in string utils
All WCHAR strings are stored as little endian after commit f722dc5,
therefor WCHAR string utils have to be changed appropriately.
2016-06-10 18:18:39 +02:00
Bernhard Miklautz
f818bab4b6 Merge pull request #3399 from nfedera/fix-winpr-library2
winpr/library: fix GetModuleFileName and tests
2016-06-10 15:08:49 +02:00
Norbert Federa
581c000435 winpr/library: fix GetModuleFileName and tests
- Use correct SetLastError values in GetModuleFileName
- Fix wrong return codes in GetModuleFileName
- Build the TestLibraryA/TestLibraryB libraries always shared and
  put them in the test output directory
- TestLibraryGetModuleFileName always returned success
- Improve TestLibraryGetModuleFileName to also check last error values
  and insufficient buffer sizes
- Change TestLibraryGetProcAddress and TestLibraryLoadLibrary to load
  the TestLibrary from the test executable's directory
2016-06-10 13:12:08 +02:00
Marc-André Moreau
0c8af43153 Merge pull request #3397 from awakecoding/master
add missing inet_pton implementation on Windows
2016-06-08 11:03:40 -04:00
Marc-André Moreau
f905861616 wayk-now: add missing inet_pton implementation on Windows 2016-06-08 10:51:58 -04:00
Bernhard Miklautz
b71f60c26e Merge pull request #3393 from nfedera/fix-winpr-library-wtimer-test
winpr: fix some tests
2016-06-08 11:50:43 +02:00
Hardening
a0520f84a3 Merge pull request #3394 from nfedera/fix-client-x11-locked-mutex
client/x11: don't close locked mutex
2016-06-08 08:21:13 +02:00
Norbert Federa
374f97aad3 client/x11: don't close locked mutex 2016-06-07 19:01:03 +02:00
Norbert Federa
f2c825bb76 winpr: fix some tests
TestNtCreateFile, TestPipeCreateNamedPipeOverlapped
- These tests are currently only expected to succeed on _WIN32
- Also reflect the reverse meaning of this fact in the return values

TestSynchWaitableTimer, TestSynchWaitableTimerAPC:
- These tests are currently expected to fail on __APPLE__
- Also reflect the reverse meaning of this fact in the return values

This logic makes sure that we don't forget to fix the tests if the
corresponding WinPR implementations are fixed.

TestLibrary:
- TestLibraryA and TestLibraryB must always get built as shared libraries
2016-06-07 17:20:56 +02:00
MartinHaimberger
0abb285c3d Merge pull request #3392 from nfedera/fix-winpr-barrier-deadlock
winpr/synch: fix barrier deadlock in release build
2016-06-07 15:33:49 +02:00
Norbert Federa
f969e60a53 winpr/synch: fix barrier deadlock in release build
Let the compiler know that we're comparing a volatile value.
Otherwise the compiler might nuke the comparison operation
and produce code that will spin endlessly.
2016-06-07 13:06:50 +02:00
Bernhard Miklautz
aa15327a3a Merge pull request #3391 from nfedera/fix-initializewaitabletimer-result
winpr/synch: fix InitializeWaitableTimer result
2016-06-07 09:34:12 +02:00
Norbert Federa
a35a1e3d9b winpr/synch: fix InitializeWaitableTimer result
InitializeWaitableTimer must not reported success if the operating
sytem does not provide the required functionality.
2016-06-06 23:06:12 +02:00
Norbert Federa
6e15931a52 Merge pull request #3390 from nfedera/fix-winpr-barrier2
winpr/synch: improve barrier test
2016-06-06 16:21:39 +02:00
Norbert Federa
131ffaa89b winpr/synch: improve barrier test
The SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY flag caused this test
to run extremely long if the system has very few processors.
Although this is expected (thread starvation) this will cause a
intolerably long execution time for automated tests.
Changed the number of threads to be calculated dyamically based
on the number of processors.
Also do proper cleanup to prevent memory leaks.
2016-06-06 15:41:05 +02:00
Bernhard Miklautz
bd71b3685b Merge pull request #3388 from nfedera/fix-winpr-pool-synch
winpr: several pool and synch fixes
2016-06-06 13:54:39 +02:00
Bernhard Miklautz
11ecda2ef3 Merge pull request #3386 from nfedera/fix-winpr-barrier
winpr/synch: rewrite barrier implementation & test
2016-06-06 13:44:48 +02:00
Bernhard Miklautz
a24d1fd4c7 Merge pull request #3389 from nfedera/fix-winpr-synch-timer-queue-segfault
winpr/synch: fix timerqueue segfault
2016-06-06 13:39:36 +02:00
Norbert Federa
e35049c20e winpr/synch: fix timerqueue segfault
The current experimental/incomplete WinPR timer queue implementation
has several race conditions.
This commit fixes a segfault caused by not unklinking freed timers
from the timer queue timers list.
2016-06-06 13:24:04 +02:00
Armin Novak
8e552e20a9 Updated readme for android. 2016-06-06 11:34:13 +02:00
akallabeth
8c4f3ba165 Merge pull request #3387 from nfedera/fix-wfreerdp-verify-cert-callback
wfreerdp: fix invalid VerifyCertificate callback
2016-06-06 09:23:41 +02:00
Norbert Federa
882f593328 wfreerdp: fix invalid VerifyCertificate callback 2016-06-04 17:13:07 +02:00
Norbert Federa
c16bee759f winpr: several pool and synch fixes
pool:
- the winpr implementation fallback was not used on older windows editions
- drop useless and conflicting TP_CALLBACK_ENVIRON_V3
- fix race conditions by using use proper one-time initialization
- on win32 WinPR tried to load several pool/callback_environment functions
  from kernel32.dll but since these are defined as inline functions in the
  windows headers, no windows edition has ever exported them in any dll.
- removed callback_environment.c and added corresponding static inline
  function to pool.h
- fix segfault in TestPoolWork: CloseThreadpoolWork() must not be called
  if there is a cleanup group associated with the work object since calling
  CloseThreadpoolCleanupGroupMember() already releases the work object

sync:
- The windows headers incorrectly define InitializeCriticalEx support if
  _WIN32_WINNT >= 0x0403 instead of >= 0x0600 (Vista)
- created a compatible define to deal with this issue
2016-06-04 17:09:48 +02:00
Norbert Federa
2dba082587 winpr/synch/barrier: fix return value and test
- According to the msdn docs DeleteSynchronizationBarrier always returns TRUE
- Added additional error checks to the barrier test
2016-06-04 13:40:01 +02:00
Norbert Federa
85f44262de winpr/synch: add spinning support to barrier
Implemented the SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY and
SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY flags.
2016-06-04 00:55:27 +02:00
Norbert Federa
341eed138f winpr/synch: rewrite barrier implementation & test
The synchronization barrier test as well as the actual WinPR
implementation were completely broken.
2016-06-03 18:56:36 +02:00
Bernhard Miklautz
8ea8b7c780 Merge pull request #3381 from nfedera/fix-winpr-misc
fix race conditions, tests and some invalid return values
2016-06-03 18:53:14 +02:00
Armin Novak
dd9cb25b3c Fixed defined symbols for function check. 2016-06-03 14:55:26 +02:00
Armin Novak
de662b9962 Setting lib64 preference now. 2016-06-03 13:02:30 +02:00
Armin Novak
20568af6a4 Updated toolchain file, added new variable for lib64 detection. 2016-06-03 13:02:13 +02:00
Armin Novak
10460d3ebc Fixed android library detection. 2016-06-03 13:01:59 +02:00
Armin Novak
be33a11754 Fixed missing arch. 2016-06-03 09:42:00 +02:00
Norbert Federa
458f606934 winpr/thread: fix SwitchToThread
On some operating systems sched_yield is a stub returning returning -1.
In that case use usleep which should at least trigger a context switch
if any thread is waiting.
2016-06-02 15:38:57 +02:00
Armin Novak
e40546485d Fixed pthread_mutex_timedlock detection. 2016-06-02 15:33:00 +02:00
Armin Novak
fc2f43e3da Added android64 support. 2016-06-02 14:25:13 +02:00
Ondrej Holy
1903537f09 winpr/crt: Make TestUnicodeConversion endian-independent
Half of the tests expects strings in little endian byte order, half of
the tests expects byte order based on a current architecture, so it
obviously can't work on big endian machines. Wide char strings use
always little endian encoding since commit f722dc5. Use only strings
in little endian to make the tests endian-independent.
2016-06-02 11:13:36 +02:00
Bernhard Miklautz
215e7b5562 Merge pull request #3382 from giox069/master
Fix some memory leaks in freerdp_settings_free()
2016-06-02 10:49:42 +02:00
Giovanni Panozzo
01a8db2c17 Fix some memory leaks in freerdp_settings_free() 2016-06-02 10:23:28 +02:00
Norbert Federa
e718fb324b fix race conditions, tests and some invalid return values
Since the current winpr implementation for overlapped operations is
incomplete and buggy, all affected functions will now fail if they are
called with a set FILE_FLAG_OVERLAPPED flag or a non-null pointer to
a OVERLAPPED structure.

winpr/nt:
- use proper one-time initialization on win32
- fix TestNtCreateFile
- fix broken/incomplete _RtlAnsiStringToUnicodeString
- unimplemented functions return appropriate error codes

winpr/pipe:
- improved TestPipeCreateNamedPipe
- rewrite the completely broken TestPipeCreateNamedPipeOverlapped test

rdtk:
- improve test and don't blindly return success

winpr/synch:
- fix race condition in TestSynchTimerQueue

winpr/ssspi:
- fix TestEnumerateSecurityPackages printf output
- fix TestQuerySecurityPackageInfo printf output

winpr/environment:
- fix GetEnvironmentStrings printf output

winpr/comm:
- unimplemented functions return appropriate error codes

winpr/io:
- unimplemented functions return appropriate error codes

winpr/thread:
- implement SwitchToThread() via sched_yield()
2016-06-01 16:26:26 +02:00
Ondrej Holy
44ce6b02ed winpr/stream: Make TestStream endian-independent
The TestStream_PeekAndRead expects LE byte order and consequently
fails on BE. Change the test to be endian-independent.
2016-05-31 16:04:16 +02:00
Norbert Federa
42d2b69de3 Merge pull request #3379 from nfedera/fix-winpr-wtsapi
winpr/wtsapi: fixed race conditions and tests
2016-05-31 09:41:09 +02:00
akallabeth
345478bd8e Merge pull request #3376 from realjiangms/fix_client_gfx
channels/rdpgfx: Fix for gfx client
2016-05-31 09:37:31 +02:00
Bernhard Miklautz
9daf129c63 Merge pull request #3371 from realjiangms/fix_x11_shadow_race
Server/shadow: Protect X operations on shared subystem X11 display with X11 display lock
2016-05-30 19:25:20 +02:00
Norbert Federa
c6aeba6a67 winpr/wtsapi: fixed race conditions and tests 2016-05-30 17:54:59 +02:00
MartinHaimberger
69f738f4bc Merge pull request #3377 from nfedera/fix-channel-name-parsing
freerdp/core/gcc: channel name hardening
2016-05-30 14:59:34 +02:00
Norbert Federa
7a42a8dd5b freerdp/core/gcc: channel name hardening
According to [MS-RDPBCGR 2.2.1.3.4.1 Channel Definition Structure]
the channel name must be an 8-byte array containing a null-terminated
collection of seven ANSI characters that uniquely identify the channel.

We did not check if the transmitted name was null-terminated which
could have the usual severe effects on stabiliy and security since
the channel name is used in several functions expecting a null-
terminated string (strlen, printf, etc.)
2016-05-30 14:40:23 +02:00
Ondrej Holy
0e353cce2e winpr/ntlm: Fix endianness in NTLM authentication
This patch fixes NTLM authentication to work properly on a big endian
machines. Freerdp exited with the following error without recent commits:
[09:50:20:914] [13821:13822] [ERROR][com.freerdp.core.transport] - BIO_read returned an error: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error
[09:50:20:914] [13821:13822] [ERROR][com.freerdp.core] - freerdp_set_last_error ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x2000D]
[09:50:20:914] [13821:13822] [ERROR][com.freerdp.client.x11] - Freerdp connect error exit status 1

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
95a1b53940 winpr/ntlm: Fix endianness in ntlm_av_pair_list
Data in ntlm_av_pair_list are accessed directly, which doesn't work on
big endian machines currently. The recieved data are stored as little
endian. Use conversion macros from endian.h to load and store the data
properly.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
8d468ea6b5 winpr/crt: Fix endianness in WCHAR case conversions
All WCHAR strings are stored as little endian after commit 12dfc5e9,
therefor CharUpperBuffW and CharLowerBuffW have to be changed appropriately
in order to fix NTLM authentication.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00