Commit Graph

10081 Commits

Author SHA1 Message Date
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
Ondrej Holy
f722dc5c28 winpr/crt: Fix endianness in unicode conversions
Unicode conversions doesn't work on big endian machines currently.
The strings are stored as little endian. Use conversion macros from
endian.h to load and store the data properly.

Let's use wide char strings always as little endian. It seems that
Windows API also always expects data to be little endian, so it
makes sense to require wide char strings as little endian also.

The patches fixes transformations between UTF8 and UTF16 only, which are
used by freerdp. UTF32 transformations are not used by freerdp.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
e326e43e66 codec/xcrush: Fix endianness in compression
Compression 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.

The patch fixes following error (so -compression option is no more needed
on big endian machines):
[06:42:14:782] [13772:13773] [ERROR][com.freerdp.core] - Decompression failure!
[06:42:14:782] [13772:13773] [ERROR][com.freerdp.core.fastpath] - bulk_decompress() failed
[06:42:14:782] [13772:13773] [ERROR][com.freerdp.core.fastpath] - fastpath_recv_update_data() fail
[06:42:14:782] [13772:13773] [ERROR][com.freerdp.core.transport] - transport_check_fds: transport->ReceiveCallback() - -1

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
250998efb8 winpr: Be sure data points to BYTE in endian.h
The conversion macros don't work properly if input data doesn't point
to BYTE. Cast the input data to BYTE to avoid unexpected behavior and
to simplify usage of the macros.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
11221e7e2c winpr: Fix Data_Read_UINT16
There is a bug which causes that higher byte and lower byte contain
first byte of data and second byte of data is lost. The patch fixes
it similarly as it is done in Stream_Read_UINT16.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Ondrej Holy
6d2ab9cc47 winpr: Fix 64-bit architecture detection
The current definitions wrongly assume the only 64-bit architecture is
x86_64. Use the __ILP64__, __LP64__ and __LLP64__ to correctly define
the size of a long and of pointer.

The patch is needed for platforms such as ppc64, or s360x, otherwise
you can see following warnings:
warning: cast from pointer to integer of different size

The patch is modification of debian downstream patch:
http://anonscm.debian.org/cgit/collab-maint/freerdp.git/tree/debian/patches/1004_64-bit-architectures.patch

Original author is Aurelien Jarno probably.

https://github.com/FreeRDP/FreeRDP/issues/2520
2016-05-30 13:37:15 +02:00
Bernhard Miklautz
ca03b510ac Merge pull request #3375 from nfedera/fix-sizet-format-segfaults
fix segfaults casused by size_t format specifier
2016-05-30 13:00:32 +02:00
zihao.jiang
e7d9e91864 channels/rdpgfx: Make freerdp_client_codecs_prepare calls codec reset. It fix broken h264 client from #3328. Also it doesn't make sense that we don't need width and height for codec initialization while we need them for codec reset 2016-05-30 02:00:05 +08:00
Norbert Federa
e8c4910e2e fix segfaults casused by size_t format specifier
win32/msvc cc does not recognize the %z format specifier which caused
invalid references and segfaults on win32.
Until FreeRDP gets format specifier macros we'll cast size_t to
unsigned long and use the %lu specifier.

Also simplified winpr_backtrace_symbols() a little bit and fixed it
to allocate the correct amount of bytes for the return buffer.
2016-05-27 15:55:28 +02:00
Hardening
00dd6f8c51 Merge pull request #3372 from nfedera/fix-winpr-test-library
winpr/library: fix win32 test and some cleanup
2016-05-27 14:53:12 +02:00
Norbert Federa
d2b2a921f1 winpr/library: fix win32 test and some cleanup
On Windows we seem to have to load the TestLibrary[AB] test libraries
from in same folder the test executable runs.

Also removed the empty RemoveDllDirectory, SetDefaultDllDirectories,
AddDllDirectory tests and the redundant FreeLibrary test.

TestLibrary now works and succeeds on Win32.

sadasd
2016-05-27 14:34:41 +02:00
Hardening
9f37f46b66 Merge pull request #3374 from nfedera/fix-winpr-path
winpr/path: fix PathCchFindExtensionA and more
2016-05-27 11:19:50 +02:00
Norbert Federa
a45ac8dad8 winpr/path: fix PathCchFindExtensionA and more
- PathCchFindExtensionA had an off-by-one error when verifying the
  required null termination
- TestPathCchFindExtension used unicode strings when testing the
  *A (ASCII) functions
- The PathAllocCombineW implementation (which is still buggy has
  hell) used strlen to calculate the lenght of unicode strings

TestPath now succeeds on WIN32
2016-05-26 18:36:02 +02:00
Hardening
ef1ddff042 Merge pull request #3373 from nfedera/fix-winpr-test-pipe
winpr/pipe: fix CreateNamedPipe test
2016-05-26 14:07:48 +02:00
Norbert Federa
9370d98575 winpr/pipe: fix CreateNamedPipe test
GetLastError() was not always checked for ERROR_PIPE_CONNECTED which
indicates success if ConnectNamePipe returns FALSE.

TestPipe now also succeeds on Win32
2016-05-26 13:52:30 +02:00
zihao.jiang
42279834bb Server/shadow: Protect X operations on shared subystem X11 display with X11 display lock 2016-05-26 00:20:37 +08:00
Bernhard Miklautz
17c125d986 Merge pull request #3369 from realjiangms/fix_mouseback_2796
Server/shadow: Fix issue 2796. Mouse cursor draw back issue
2016-05-25 17:25:07 +02:00
zihao.jiang
9f4465ebbc Server/shadow: Fix issue 2796. Mouse cursor draw back issue 2016-05-25 23:08:36 +08:00
Bernhard Miklautz
8aec19d116 Merge pull request #3370 from nfedera/fix-winpr-test-thread-createprocess
winpr/thread: fix TestThreadCreateProcess
2016-05-25 16:39:22 +02:00