Commit Graph

1746 Commits

Author SHA1 Message Date
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
Armin Novak
4f62d848ac Refactored interlocked typedefs, avoid namespace collisions. 2016-10-06 13:43:09 +02:00
Armin Novak
64c5d78b3f Fixed clang warnings. 2016-10-06 13:43:09 +02:00
Armin Novak
081b57905f Added ios home and temp dir support. 2016-10-06 13:43:08 +02:00
Armin Novak
88be64f10b Fixed apple file times. 2016-10-06 13:43:04 +02:00
Armin Novak
35f1347d53 Fixed warnings and mac build. 2016-10-06 13:43:04 +02:00
Bernhard Miklautz
bfdab0ed4a Merge pull request #3523 from rjcorrig/tz201609
winpr: Updated time zone definitions to Sept 2016
2016-10-06 12:19:57 +02:00
Marc-André Moreau
1d06087b60 Merge pull request #3515 from akallabeth/apple_time_fix
Fixed SetFileTime for mac.
2016-10-05 09:21:11 -04:00
Robert Corrigan
fc7378f59c Updated time zone definitions to Sept 2016 2016-10-04 10:54:11 -04:00
Armin Novak
3eb136d167 Fixed SetFileTime for mac. 2016-09-27 13:28:39 +02:00
ed.velez
ed697fa4ad fix_for_xcode8_clock_gettime 2016-09-22 15:42:43 -05:00
Martin Fleisz
71765b72e3 Merge pull request #3284 from ondrejholy/endianness
Endianness fixes
2016-08-25 08:17:52 +02:00
Marc-André Moreau
14cb6d33c6 freerdp: make modifications to NLA server-side fixes according to PR comments 2016-07-22 09:06:07 -04:00
Marc-André Moreau
801dc0f826 freerdp: add configurable NTLM SAM file option for server-side NLA 2016-07-21 18:58:24 -04:00
Marc-André Moreau
1ffbd774e9 freerdp: fix sending of TLS alert on NLA failure, add better handling of server-side NLA in shadow server 2016-07-21 17:53:20 -04:00
Armin Novak
d96fbd1bce Initialise WLog PrefixString for each message type. 2016-07-05 13:00:54 +02:00
Norbert Federa
333a1110f5 winpr/sspi/ntlm: fix computer name len calculation
The lpnSize parameter for GetComputerNameEx specifies the total
size of the buffer (in characters).
However, the current code calculated the amount of bytes.
Since only GetComputerNameExA was used and because sizeof(CHAR) == 1
the result was correct but the math was wrong.
Credit goes to @byteboon
2016-06-30 17:15:40 +02:00
Norbert Federa
27c439675f winpr: fix win32 linking issues
Depending on the windows target version (_WIN32_WINNT), the used
SDK and the build configuration the linker will see multiple
libraries exporting the same symbols.
To prevent ugly hacks (e.g. modifying cmake's default system
libraries or fragile library linking order chains) we prefix
these functions with "winpr_" and create corresponding defines
to keep the current api names.
2016-06-16 11:47:33 +02:00
Norbert Federa
7a68eebb03 cmake: remove some void statements and fix winpr source group 2016-06-15 13:54:31 +02:00
Norbert Federa
26ed09a14f winpr/sspi/ntlm: fix GetComputerNameExA parameters
On input, the lpnSize [in, out] parameter for GetComputerNameEx()
specifies the total size of the buffer (in characters).
Several functions in ntlm.c were off by one which caused ntlm to fail
if the netbios hostname's strlen was exactly MAX_COMPUTERNAME_LENGTH.
2016-06-14 12:37:37 +02:00
Norbert Federa
62d73dcb75 winpr: fix PathMakePathA and TestWLog
PathMakePathA:
- This function had an endless loop if no native delimiter was in the string
- Use SHCreateDirectoryExA on Windows
- Replaced old code with a new implementation

TestWLog:
- Windows has no "/tmp" by default
- Use GetKnownPath(KNOWN_PATH_TEMP) for the WLog "outputfilepath"
2016-06-13 19:19:28 +02:00
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
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
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
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
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
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
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
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
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
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
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
c6aeba6a67 winpr/wtsapi: fixed race conditions and tests 2016-05-30 17:54:59 +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
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
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
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
Norbert Federa
1b231f9dd9 winpr/thread: fix TestThreadCreateProcess
On WIN32 TestThread now works and is expected to succeed
2016-05-25 15:47:58 +02:00
Norbert Federa
aded51f38f winpr/synch: fix tests
TestSynchTimerQueue:
- fixed race condition

TestSynchWaitableTimerAPC:
- Use WaitForSingleObjectEx since the thread must be in an alterable state

TestSynch is now expected to succeed on WIN32
2016-05-24 22:33:27 +02:00
Norbert Federa
386d290015 winpr/synch: fix mutex implementation
- Mutex is recursive on Windows; as a consequence we have to use
  the pthread PTHREAD_MUTEX_RECURSIVE type
- Adapt MutexCloseHandle accordingly
- ReleaseMutex returned TRUE even if pthread_mutex_unlock failed
- Fixed and improved the TestSynchMutex ctest
2016-05-24 15:10:57 +02:00
Bernhard Miklautz
5d030534db winpr/event: fix file descriptor leak
SetEventFileDescriptor overrides the internal file descriptor of the
event but didn't close it. Now if the descriptor is closed if it isn't
marked as attached.
2016-05-23 13:04:44 +02:00
Hardening
4e66df7228 Merge pull request #3333 from akallabeth/memleak_fixes
Memleak fixes
2016-05-13 11:32:48 +02:00
Robert Corrigan
73e13b0b29 KB3153731: May 2016 DST update for Azerbaijan, Chile, Haiti and Morocco 2016-05-12 13:24:21 -04:00
Armin Novak
eacf2b542e Fixed memory leaks. 2016-05-12 10:01:30 +02:00
Marc-André Moreau
6b73757085 Merge branch 'master' of github.com:awakecoding/FreeRDP 2016-05-11 13:13:02 -04:00
Marc-André Moreau
d4c809c4ae winpr: fix definitions of synchronization barrier and interlocked functions 2016-05-11 13:12:44 -04:00
Marc-André Moreau
915b9a15b1 Merge branch 'master' of github.com:FreeRDP/FreeRDP
Conflicts:
	winpr/libwinpr/bcrypt/CMakeLists.txt
2016-05-11 11:05:17 -04:00
Bernhard Miklautz
81d30cc480 Disable comm tests per default
comm tests require a serial device for testing. If the test environment
isn't available the tests will return errors therefore the tests are
now disabled per default. They can be (re-)enabled by using the cmake
option BUILD_COMM_TESTS.
2016-05-02 16:59:25 +02:00
Armin Novak
ee186bec73 ListDictionary handle NULL list argument. 2016-04-26 09:34:12 +02:00
Robert Corrigan
f8c42da561 KB3148851: Updates to Russian Time Zones for 2016 2016-04-13 14:44:30 -04:00
Marc-André Moreau
a192967a5b libwinpr-path: fix missing shlwapi.lib import 2016-03-30 10:58:36 -04:00
Marc-André Moreau
8fcc2aabf1 Merge branch 'master' of github.com:awakecoding/FreeRDP 2016-03-30 10:47:01 -04:00
Marc-André Moreau
cedf6d98e2 freerdp: more UWP porting 2016-03-29 20:34:52 -04:00
Marc-André Moreau
4d629a7999 freerdp: UWP porting 2016-03-29 16:03:15 -04:00
Bernhard Miklautz
9e8c6c99b6 First shot on fixing over linking
If a target is linked against libraries with cmake
(target_link_libraries) and the libraries are not marked as PRIVATE
they are "exported" and in case a other target is linked against this
target it is also linked against *all* (not private) libraries.

Without declaring private libraries PRIVATE a lot of over linking
(linking against unneeded libraries) was done.
2016-03-29 18:14:34 +02:00
Bernhard Miklautz
b184f58c1b winpr/TestFileGetStdHandle: rename variable stdout
stdout shouldn't be used as variable name (can't even be used on
windows).
2016-03-29 18:14:16 +02:00
Marc-André Moreau
2201ac5266 winpr: fix PathFileExists on UWP 2016-03-25 12:20:51 -04:00
Martin Fleisz
80cd64732f Merge pull request #3164 from akallabeth/windows_UnixChangeFileMode
Implemented UnixChangeFileMode for windows.
2016-03-16 15:19:11 +01:00
akallabeth
0c99d6a4fe Merge pull request #3226 from rjcorrig/#3198
winpr: Updates time zones and fixes bias values
2016-03-16 13:32:51 +01:00
Robert Corrigan
a4f0089d45 winpr_detect_windows_time_zone should have void argument 2016-03-16 08:29:21 -04:00
Armin Novak
3d23a772f6 Updated ConvertToUnicode return check. 2016-03-16 13:08:06 +01:00
Bernhard Miklautz
1b1563658e Merge pull request #3214 from hardening/fix_systemd_appender
Make systemd appender honor layout and logs off
2016-03-16 11:58:31 +01:00
Marc-André Moreau
9211f44e46 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-15 20:19:15 -04:00
Robert Corrigan
16796b9c9d winpr: Updates time zones and fixes bias values 2016-03-14 11:38:31 -04:00
Martin Fleisz
0249b09677 winpr: Fix definition of PathFileExists on Win32 2016-03-14 14:08:48 +01:00
Hardening
19494bd75a Make systemd appender honor layout and log off 2016-03-10 23:41:12 +01:00
Martin Fleisz
30325f189f Merge pull request #3181 from akallabeth/wlog_filter_fix
Respecting filter in WLog_GetLogLevel
2016-03-08 10:05:57 +01:00
Marc-André Moreau
c78a142388 Merge branch 'master' of github.com:awakecoding/FreeRDP 2016-03-07 21:21:17 -05:00
Marc-André Moreau
d61c2d4535 winpr: fix ini utils leak 2016-03-07 21:21:06 -05:00
Marc-André Moreau
ceefc4b099 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-07 10:19:50 -05:00
Armin Novak
34b12362cb Fixed FreeBSD support for filetime settings. 2016-03-06 15:01:58 +01:00
Norbert Federa
ef4b29e5b3 ConvertFromUnicode fixes and misc hardening
- Added missing ConvertFromUnicode checks
- If ConvertToUnicode allocates memory, guarantee the null termination
  similar to ConvertFromUnicode's implementation
- Fixed some TestUnicodeConversion.c CTest return values
- Added some CTests for ConvertFromUnicode and ConvertToUnicode
- Misc code and protocol hardening fixes in the surrounding code regions
  that have been touched
2016-03-03 16:56:19 +01:00
Armin Novak
ee2839fc7f Caching log filter after first use.
Reduce runtime penalty for log level checks by
remembering the log level found during first call.
2016-03-03 12:43:39 +01:00
Armin Novak
0ea7aea6d9 Remember filter log level. 2016-03-02 19:07:32 +01:00
Bernhard Miklautz
7075353417 winpr: fix regression in timezone detection
ConvertToUnicode can't be used if the destination is a static buffer.
StandardName and DaylightName were invalid and timezone
redirection didn't work.

This regression was introduced with PR #3151
2016-03-02 18:44:17 +01:00
Armin Novak
41fdac2667 Respecting filter in WLog_GetLogLevel 2016-03-02 14:11:15 +01:00
Martin Fleisz
857c37393b Merge pull request #3163 from akallabeth/set_file_time
Implemented SetFileTime
2016-03-02 09:43:46 +01:00
Armin Novak
c74e37dbfd Implemented UnixChangeFileMode for windows. 2016-03-02 09:41:47 +01:00
Armin Novak
65cddbc3fb Removed obsolete log message. 2016-03-02 09:16:59 +01:00
Armin Novak
227ecc4bd5 Fixed uninitialized variable. 2016-03-02 09:16:49 +01:00
Bernhard Miklautz
e02af8287e Merge pull request #3160 from akallabeth/stream_fixes
Stream fixes
2016-03-01 16:44:19 +01:00
Armin Novak
a79072a87c Added tests for remaining stream functions. 2016-03-01 12:58:09 +01:00
Bernhard Miklautz
014f31db35 Merge pull request #3171 from akallabeth/crypto_simplification
Crypto simplification
2016-02-29 17:10:53 +01:00
Armin Novak
c182be093d Removed module.def from build config. 2016-02-29 15:24:07 +01:00
Armin Novak
68c402ac58 Removed windows module.def files.
All symbols exported from libraries are declared
using *_API defines.
2016-02-29 15:18:47 +01:00
Armin Novak
4e4d2e11d4 Fixed crypto tests. 2016-02-29 14:45:03 +01:00