Commit Graph

1033 Commits

Author SHA1 Message Date
Armin Novak
92c3fd5d59 Fixed unnecessary cast in headers 2022-01-31 16:13:06 +01:00
Armin Novak
0feee85952 Fixed cast warnings due to defines 2022-01-31 16:13:06 +01:00
Armin Novak
03e454d7d0 Fixed missing brace 2022-01-31 15:55:10 +01:00
Armin Novak
e7913b4720 Fixed some reserved names 2022-01-31 15:55:10 +01:00
akallabeth
e6e6ed5dbd Cleaned up PubSub
* Callback arguments now const
* Fixed missing includes
2022-01-19 09:24:57 +01:00
David Fort
130f191392 winpr: fix some string constant in ncrypt and add reader property
Some WCHAR string constant were wrong (missing \x00 at the end).
The commit also implements the NCRYPT_READER_PROPERTY property in the pkcs11 provider.
2022-01-17 16:27:53 +01:00
David Fort
eb53b9913a winpr: interpret the scope paramater in NCryptEnumKeys
Although the official documentation claims that pszScope parameter shall be set to
NULL. In practice setting it to \\.\<reader name>\ allows to filter on the corresponding
reader.
2022-01-17 16:27:53 +01:00
Marc-André Moreau
55be5f8bb0 Fix Windows Unicode handling of environment variables 2022-01-11 12:32:14 +01:00
David Fort
599bc18f33 winpr: fix bcrypt.h string constants 2022-01-10 11:02:45 +01:00
David Fort
bfe8b464be winpr: fix and enhance ncrypt
This patch adds the NCryptEnumStorageProviders function.
It also fixes strings bugs with the compiler taking the WCHAR "Micro" string
M\x00i\x00c\x00r\x00o\x00 as
M\x00i\x0c\x00r\x00o\x00, and so generating unexpected behaviours. The solution is
to split string constants when you hit a character that is a valid hex number, so
that the compiler doesn't interpret i\x00c\x00 (ic in WCHARs) as i\x0c\x00 (weird
string).
2022-01-10 11:02:45 +01:00
Armin Novak
98348ef62a Removed ndr.h from WinPR 2021-12-23 14:27:12 +01:00
Armin Novak
ed9cc8c1cc Removed heap module from WinPR 2021-12-23 14:27:12 +01:00
Armin Novak
4f0f8e9f8c Removed credentials module from WinPR 2021-12-23 14:27:12 +01:00
Armin Novak
5365b2f5f0 Removed midl.c|h from WinPR 2021-12-23 14:27:12 +01:00
Armin Novak
3de6af34ed Removed unused module winhttp 2021-12-23 14:27:12 +01:00
Armin Novak
379aeed24e Removed unimplemented credui module 2021-12-23 14:27:12 +01:00
Armin Novak
a713d5417e Remove unimplemented wnd module 2021-12-23 14:27:12 +01:00
Armin Novak
b30f8886b2 Fixed LinkedList const correctness 2021-12-15 13:36:15 +01:00
David Fort
d4020e2328 winpr: implement ncrypt API
This implements the emulation for the ncrypt API and more specifically the smartcard
provider so that we can list available keys and certificates using pkcs11-helper.
2021-12-14 14:12:01 +01:00
David Fort
a6cadd6f97 winpr: fix compilation for mingw
Depending on the version of mingw some export macro aren't always defined.
2021-12-14 14:12:01 +01:00
akallabeth
d1adfd5ecc Fixed check for TARGET_OS_IPHONE and TARGET_OS_WATCH 2021-11-25 12:25:18 +01:00
David Fort
67986ea298 Fix compilation with mingw
This patch addresses some issues when compiling against mingw. With these changes
FreeRDP can be compiled out-of-the box on a Ubuntu 20.04.
2021-11-15 09:23:16 +01:00
Armin Novak
68eb6e4afc Drop ASN1 module stub
Not implemented, just creates confusion.
2021-11-02 15:13:20 +01:00
Armin Novak
319b0e1b7e Queue_Enqueue const argument
By default use const for the object enqueued.
If a `fnObjectNew` function is set, it is copied anyway.
For the case without cast away the const internally.
2021-10-18 16:09:13 +02:00
akallabeth
3ccb96d52f Fixed #7350: Warnings with Stream_StaticInit
* Properly initialize the stream buffer
* Add Stream_StaticConstInit accepting a const buffer
* Modify API to return a pointer to the stream initialized
2021-10-14 12:11:16 +02:00
Armin Novak
439ec62cff Hide implementation of certain stream functions 2021-10-06 09:49:07 +02:00
Armin Novak
18a3fcf2fc Updated wStream API and added torough checks
* Do length/capacity checks in every read/write/seek function
  if WINPR_ASSERT is defined.
* Ensure s->pointer is valid, e.g. within s->buffer + s->capacity
  (Stream_Rewind, Stream_Seek, ...)
* Add return values to Stream_Set* functions so inalid arguments
  can be reported to the caller
* Deprecated problematic stream manipulation functions
  (Stream_SetBuffer, Stream_SetPointer, Stream_SetCapacity)
* Ensure length/capacity functions never return a value larger
  than the actual length/capacity
2021-10-06 09:49:07 +02:00
akallabeth
cb5ccec212 Cleaned up some possible race conditions with threads
* ExitThread no longer NORETURN, this eases handling of threads.
* Fixed a (rare) race condition when starting a thread
* Made global thread_list optional (you lose the exit code from
  ExitThread)
2021-09-20 10:59:59 +02:00
akallabeth
76979a47fb Added new CMake option to dump event handles in use 2021-09-20 10:59:59 +02:00
akallabeth
d80b418bbc Added object copy support to queue
* Added object copy support to Queue_Enqueue
* Added Queue_Discard to clear the top of the queue
* Added some doxygen for queue functions.
2021-09-20 10:59:59 +02:00
Armin Novak
0fe1e2359e Fixed all reserved-id-macro warnings 2021-09-10 08:16:25 +02:00
Armin Novak
ba0da04217 Fixed compilation warnings and duplicate defines 2021-09-09 08:53:20 +02:00
Armin Novak
9f0eff604e Silence GCC reserved-id-macro warnings in compatibility header 2021-09-09 08:53:20 +02:00
Armin Novak
0f8c52b9ca Fixed const warnings with argument parser 2021-09-09 08:53:20 +02:00
Armin Novak
fbae9ba88c Added LoadLibraryX and LoadLibraryExX
These functions take a UTF8 string and load a library with
LoadLibraryW under windows.
2021-09-03 08:29:15 +02:00
Armin Novak
737f5a2036 Fixed argument const correctness 2021-08-27 13:21:02 +02:00
akallabeth
f1bde376b1
Raw channel send (#7255)
* Added raw channel data write function

* Use nego_set_state

* Added ArrayList_ForEachAP

* Provide va_copy for older VS compilers
2021-08-26 16:17:51 +02:00
Armin Novak
5afa592244 Fixed cast-qual warnings 2021-08-24 11:10:51 +02:00
Armin Novak
cbb06a7c17 Fixed DsParse implementations and tests
* Implemented DsMakeSpnW
* Removed unimplemented DsCrackSpnA and DsCrackSpnW
2021-08-24 10:45:57 +02:00
Armin Novak
af0ce13d8a Removed not implemented module 2021-08-24 10:45:57 +02:00
Fabrice Fontaine
0976cce458 winpr/include/winpr/file.h: fix build on uclibc
Include stdio.h to fix the following build failure with uclibc raised
since version 2.4.0 and
eb6777ea69:

In file included from /tmp/instance-0/output-1/build/freerdp-2.4.0/winpr/libwinpr/utils/lodepng/lodepng.c:30:
/tmp/instance-0/output-1/build/freerdp-2.4.0/winpr/include/winpr/file.h:524:11: error: unknown type name 'FILE'
 WINPR_API FILE* winpr_fopen(const char* path, const char* mode);
           ^~~~

Fixes:
 - http://autobuild.buildroot.org/results/31e770a330158035e24b7b952bec0030138482b7

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-08-01 09:37:24 +02:00
akallabeth
534d30beb3
No deprecated (#7107)
* Removed cmake options disabling compiler warnings

* Added deprecation compile options

* Fixed android client use of deprecated symbols

* Removed obsolete callback
2021-06-22 14:39:10 +02:00
akallabeth
b453d5e40e Fixed rdtk, uwac and winpr standalone builds 2021-06-22 08:54:18 +02:00
Armin Novak
09cf11ecf0 WinPR: Fixed warnings, added assertions 2021-06-18 11:32:16 +02:00
Armin Novak
2e0d1cc33c Fixed integer warnings, fixed data types 2021-06-17 10:35:22 +02:00
Armin Novak
299c962b28 Fixed warnings 2021-06-17 10:35:22 +02:00
Armin Novak
d9a8083ddf Added WINPR_NORETURN, fixed warnings 2021-06-17 10:35:22 +02:00
Armin Novak
1af7ef2f1b Fixed compilation warnings and typos 2021-06-16 15:21:56 +02:00
Armin Novak
9e94f1dace Improve WINPR_ASSERT, log backtrace 2021-06-16 14:26:06 +02:00
Armin Novak
f5bb6d12fc Fixed compilation warnings 2021-06-16 14:26:06 +02:00
Armin Novak
1b3adfae0a Added WINPR_ASSERT to Stream and StreamPool 2021-06-16 14:26:06 +02:00
Armin Novak
d7f3ce0acd Added callback deprecation attribute 2021-06-16 14:26:06 +02:00
Armin Novak
bca7bcd8b0 Cleaned up Queue API, use WINPR_ASSERT 2021-06-16 11:46:42 +02:00
Armin Novak
b9a9f50dd2 Hide HashTable_SetupForStringData implementation 2021-06-16 11:46:42 +02:00
Armin Novak
30776358bb Readded ArrayList_Add and HashTable_Add as deprecated 2021-06-16 11:46:42 +02:00
Armin Novak
96eca171e2 Removed const from HashTable_ForEach function 2021-06-16 11:46:42 +02:00
Armin Novak
d6c84c28fb Renamed ArrayList_Add to ArrayList_Append
* Do not break API silently
2021-06-16 11:46:42 +02:00
Armin Novak
a1c8e4cf85 Refactored ArrayList_Add to conform to other functions 2021-06-16 11:46:42 +02:00
Armin Novak
880c603c26 Renamed HashTable_Add to HashTable_Insert
* Since the changes break HashTable_Add rename it so that it will
  not fail silently
2021-06-16 11:46:42 +02:00
Armin Novak
cb642699c8 Modified HashTable API to be opaque
* Reuse wObject function pointers
* Add missing getters/setters
* Clean up return types, const correctness of arguments
2021-06-16 11:46:42 +02:00
akallabeth
3a75228242 Added option do disable WINPR_ASSERT 2021-06-14 09:37:07 +02:00
Armin Novak
b435e6db9b Added WINPR_ASSERT
Added a WinPR macro that can be used for WinPR and FreeRDP to
replace standard C assert.
It is more verbose and logs issues to WLog which makes it easier
for us to trace problems in the field.
2021-06-14 09:37:07 +02:00
Marc-André Moreau
96f07ea993 Windows ARM64 build fixes 2021-06-01 14:18:01 +02:00
Marc-André Moreau
73a931f941 WinPR: don't warn about thread-local storage on iOS, add comment banning its use for new code 2021-05-28 09:57:15 +02:00
Marc-André Moreau
555944f027 run clang-format 2021-05-26 08:40:29 +02:00
Marc-André Moreau
eb6777ea69 Fix Windows Unicode file path handling issues (+add winpr_fopen wrapper) 2021-05-26 08:40:29 +02:00
Biswapriyo Nath
c0c9eb5908 Check MINGW32 for duplicate type declaration. 2021-05-25 09:41:44 +02:00
Armin Novak
6f2c6625e4 Added FREERDP/WINPR prefix to define GIT_REVISION 2021-05-18 13:37:34 +02:00
David Fort
ab4fe21439 winpr: add a HashTable_Foreach function and associated tests
This useful functions allows to browse all value pairs of a hashtable without
having to allocate some memory for keys and then retrieving each element.
It may also make sense with synchronized hashtables because before you were forced to
HashTable_GetKeys() and then HashTable_GetItemValue() which is locking again for each
element of the table.
2021-05-17 09:29:25 +02:00
akallabeth
ab49694101 Added new RDP file options 2021-05-11 07:59:05 +02:00
akallabeth
d4ae65dbb5 Added version to client log, removed build_date 2021-04-22 14:07:37 +02:00
akallabeth
2ea7ac0c06 Unified bin to hex and hex to bin conversion
* Added new functions in WinPR
* Added unit tests for new functions
* Replaced existing (internal) conversion functions
2021-04-19 10:45:21 +02:00
akallabeth
ef6e4c0570
ADDIN_ARGV cleanup, added camera setting to RDP parser (#6947)
* Added camerastoredirect to RDP parser

* Refactored ADDIN_ARGV handling

* Added ADDIN_ARGV unit tests
2021-04-12 10:38:40 +02:00
David Fort
aeba30a505 winpr: correctly implement APC
This patch implements APC functions and fixes waitable timers with completions.
2021-04-07 08:15:16 +02:00
David Fort
dfbbf3b618 winpr: cleanup polling code
Externalize all the polling logic in a pollset component. This patch prepares the
support of APC and alertable state.
2021-04-07 08:15:16 +02:00
sss
6574fdf6e4 reverted changes from clang-format 2021-02-25 14:05:40 +01:00
Gluzskiy Alexandr
bee2e1526d allow to use in single threaded mode
(some client side channels and all server side channels still need to be
ported to new api)

server: build fix, do not disable threads for rfx encoder

cliprdr client channel: implemented support for DisableThreads option
looks like thread does not make sense at all for this channel

do not initialize disabled image codecs (respect settings)

channels: client: rail: added support for DisableThreads setting

changed "BOOL DisableThreads" to "UINT32 ThreadingFlags"
dropped unnecessary apu changes

draft implementation of threading settings aware message handling api
for addins/channels

rail: use new messaging api

fixed memory leak

msgs handlers external api changes (as requested)

msgs_handlers: init fix

fixed memory leak

logic fix

resolved problems appeared after rebase to master, dropped unnecessary
changes

git clang-format origin/master

fixed TestFreeRDPCodecRemoteFX.c

"formatting, run `clang-format` please"

properly use new "rfx_context_new(BOOL, UINT32)" everywhere

passed Threading Flags to "rfx_context_new" where available

in older C standarts veriables declaration must be done before any code

requested changes

clang-format as requested

use broken signatures of standert C functions for m$ s**tos

clang-format

requested changes

requested changes

moved ThreadingFlags to stable api zone

define type for channel msg handler

typo fix

clang-format

build fix

us ThreadingFlags from server settings

git clang-format origin/master

clang-format
2021-02-25 14:05:40 +01:00
akallabeth
43311130a2 Fixed CodeQL warnings 2021-02-19 11:19:49 +01:00
akallabeth
e2fd9db0b5 Added const to function arguments 2021-02-17 11:29:56 +01:00
Armin Novak
54e02e1642 Use wide char file paths for license 2021-02-04 21:22:21 +01:00
Ondrej Holy
d7566f5f5a
client: Fix exit codes for /help and similar option (#6741)
* client: Fix exit codes for /help and similar option

Currently, non-zero exit code is returned for /version, /buildconfig, /help,
/monitor-list, /kbd-list and /kbd-lang-list command-line options for several
clients. This is against conventions because 0 is usually returned in
such cases. Also, there is potentially another problem that the returned
codes overflow on UNIX systems (where the exit code is a number between 0
and 255). Let's fix the clients to return 0 in the mentioned cases to honor
conventions and 1 for the command-line parsing errors (or -1 for clients
who already use that value).

Fixes: https://github.com/FreeRDP/FreeRDP/issues/6686

* Refactored freerdp_client_settings_command_line_status_print_ex

Now returns 0 if help or version information was requested.

* Do not eliminate original error status.

Co-authored-by: akallabeth <akallabeth@posteo.net>
2021-01-22 09:44:55 +01:00
akallabeth
66dc4cc9ee Fixed compilation warnings. 2020-11-10 08:53:43 +01:00
akallabeth
6e3c00725a Cleaned up collections:
ArrayList, MessageQueue, Queue, PubSub, BipBuffer
ObjectPool and BufferPool
2020-11-06 12:30:13 +01:00
Martin Fleisz
b5fa928311 core: Fix race when deleting channel manager
This PR fixes a possible crash when the channel manager was freed and
there were pending messages in the message queue.
The problem was that even though the message queue already received the
WMQ_QUIT message, it was still possible to enqueue messages after this
point. This resulted in unprocessed messages in the queue when it was
deleted. The delete handler then called into channel handlers which
where aleady freed/deleted.
With this PR adding messages after WMQ_QUIT was posted to the message
queue returns an error and all channel messages are now processed before
the channels are closed/terminated.
2020-11-03 17:08:58 +01:00
akallabeth
516fc9b910 Fixed locking issue, removed broken functions 2020-11-02 09:23:11 +01:00
akallabeth
5133c4e424 Corrected name for FD_WRITESTIME 2020-10-15 08:33:14 +02:00
Armin Novak
a22f264189 Added backward compatibility define 2020-10-14 09:19:57 +02:00
Armin Novak
ef1c8a3b50 Updated FD_FLAGS definition. 2020-10-14 09:19:00 +02:00
akallabeth
33df98f204 Fixed definition of FILEDESCRIPTORW 2020-09-22 13:03:55 +02:00
akallabeth
1546a8b655 Fixed naming of FILEDESCRIPTORW 2020-09-18 12:49:54 +02:00
Kobi Mizrachi
920acd4c0e winpr: image: add API to construct bmp header 2020-06-05 09:22:26 +02:00
akallabeth
b9149df1e6 Fixed BehaviourSanitizer warnings in streams. 2020-05-20 15:10:07 +02:00
akallabeth
535ef57e2e Fixed BehaviorSantizer warnings. 2020-05-20 15:10:07 +02:00
akallabeth
ddb388e152 Refactored sam functions to utilize strtok_s 2020-05-18 12:07:59 +02:00
akallabeth
7b1d440945 Refactored StreamPool 2020-05-13 17:11:17 +02:00
akallabeth
8d70a3492b Added warning to all collection structs 2020-05-12 14:05:28 +02:00
akallabeth
844ec8f74c Fixed #6136: Cleaned up Stack API 2020-05-12 14:05:28 +02:00
Armin Novak
a161bafa5f Fix #6066, #6045: Disable spincount by default. 2020-04-13 09:56:19 +02:00
Martin Fleisz
99786970a3
Merge pull request #5884 from akallabeth/smartcard_ndr_strict
Smartcard tighter input validation
2020-03-31 08:34:04 +02:00
Armin Novak
8b85913ac0 Added winpr_md_type_from_string and winpr_md_type_to_string 2020-03-06 11:37:35 +01:00
Armin Novak
9d13729617 Added sha3 hashes for openssl. 2020-03-06 11:37:35 +01:00
Armin Novak
e3acc01bfb Added missing WINPR_*_DIGEST_LENGTH definitions. 2020-03-06 11:37:35 +01:00
Armin Novak
959be9d946 Fixed warnings in pcsc layer 2020-02-20 14:03:29 +01:00
Armin Novak
ef93109f42 Fixes for GetAttrib and some refactroing
* Fix accidental buffer free before transfer
* Refactored code to eliminate a bunch of warnings
* Updated copyright headers
2020-02-20 13:59:28 +01:00
Armin Novak
2acce6214c SCardFreeMemory non const argument. 2020-02-20 13:59:28 +01:00
David Fort
245fc6014d
Merge pull request #5830 from akallabeth/smartcard_updates
Smartcard updates
2020-02-07 14:11:00 +01:00
Kobi Mizrachi
8c5d96784d cmdline: export CommandLineParseCommaSeparatedValues 2020-01-22 14:18:21 +01:00
Kobi Mizrachi
1543664343 winpr: collections: add ArrayList_ForEach 2020-01-14 07:58:47 +01:00
Armin Novak
4798af5132 Fix smartcard structs, conform to [MS-RDPESC] 2020-01-13 10:49:22 +01:00
Armin Novak
a392b266c0 Added NtStatus2Tag function to stringify NTSTATUS
For higher level applications it is easier to translate known
strings instead of error codes. this function allows
to retrieve known string identifiers that can be translated.

Signed-off-by: Armin Novak <armin.novak@thincast.com>
2020-01-09 16:14:44 +01:00
Armin Novak
3143570f54 Added missing Stream_Write_INT32 2019-12-04 13:44:08 +01:00
Martin Fleisz
71feb974ac
Merge pull request #5739 from akallabeth/improve_function_hiding
Improve function hiding
2019-12-02 11:31:35 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
David Fort
5e6775ce95 winpr: fix anonymous enum members and menbers without a size 2019-11-25 13:39:31 +01:00
Armin Novak
53f7d023b1 Fixed GetEnvironmentStrings test
Some os return an invalid/wrong character count if a string with
unknown symbols is printed to stdout.
Instead use the sprintf family and print to a buffer / determine
the required buffer size.
2019-11-21 15:05:57 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
700470876b Cleaned up ini.h and added error checks. 2019-10-29 11:54:55 +01:00
kubistika
b3f78d2f4d winpr: utils: image: fix const correctness 2019-10-24 12:19:31 +02:00
Martin Fleisz
583045e2e5 rail: Update to latest spec version 28.0 2019-10-02 14:51:45 +02:00
Martin Fleisz
a907f003e1
Merge pull request #5596 from akallabeth/wlog_cache_ptr
Speedup for WLog_* macros, cache the log pointer
2019-10-01 15:57:17 +02:00
Armin Novak
b1d0eaff6d Fix #5603: Prefer absolute path for /drive: syntax. 2019-09-24 16:42:27 +02:00
Armin Novak
d46a3cb11d Speedup for WLog_* macros, cache the log pointer
WLog_Get(tag) is quite expensive if called repeatedly.
With this patch the pointer is cached on first call.
2019-09-15 10:04:36 +02:00
Armin Novak
f39ec50101 Converted BitStream_* defines to inline functions 2019-09-03 08:55:59 +02:00
Armin Novak
d99486096b Added deprecation macro. 2019-09-02 15:13:09 +02:00
Armin Novak
2cc714a57d Updated RAILS implementation
* Implement new messages and callbacks
* Announce most recent channel features
* Added settings to configure flags to announce
2019-05-08 17:25:15 +02:00
Martin Fleisz
3e2be308eb
Merge pull request #5266 from akallabeth/file_list_synth
Added a proper synthesizer for FileGroupDescriptorW to text/uri-list
2019-05-08 15:05:05 +02:00
Armin Novak
ebb93a1273 Improved implementation of LoadLibrary functions. 2019-04-05 09:14:35 +02:00
Armin Novak
7b246121b4 Improved mutex and event functions
* Added name for debugging to handle.
* Implemented *Ex functions
2019-04-05 09:14:35 +02:00
Armin Novak
7dfc453858 Cast SEC_* return values to HRESULT (Same as WIN32 API) 2019-04-05 09:13:24 +02:00
Armin Novak
9757d536c3 Case SCARD_* return values to HRESULT (Same as WIN32 API) 2019-04-05 09:13:24 +02:00
Armin Novak
25751517e5 Cast E_* errors to HRESULT (same as defined in WIN32 API) 2019-04-05 09:13:24 +02:00
David Fort
37358e81d0
Merge pull request #5285 from akallabeth/urbdrc_preparations
Channel, log debug and semaphore related fixes
2019-04-04 18:21:47 +02:00
Armin Novak
e5fbff357e Fixed Stream_* macros, bracing arguments. 2019-03-07 09:29:32 +01:00
MartinHaimberger
46b1e88a70
Merge pull request #5027 from akallabeth/wlog_off_fix
Fix #5024: Update inherited log level for all child loggers when setting a new one.
2019-02-28 10:55:12 +01:00
Armin Novak
32aa11251b Added a logger dump function operating on a preallocated logger. 2019-02-26 15:31:47 +01:00
Armin Novak
32ea44c037 Added a proper synthesizer for FileGroupDescriptorW to text/uri-list
The file clipboard delegate needs a base URI to operate on for
systems that are not WIN32. Added that to the context and abort
conversion, if that is not set. (currently not fully implemented)
2019-02-21 16:44:40 +01:00
Martin Fleisz
3169b77d70
Merge pull request #5230 from akallabeth/sign_compare_fixes
Sign compare fixes
2019-02-08 09:35:50 +01:00
Martin Fleisz
6415cfec48
Merge pull request #5131 from akallabeth/cmd_line_error_logging
Added extended error logging for assistance, rdp file and command line parser
2019-02-08 09:11:35 +01:00
Armin Novak
3679eefbd4 Fixed BipBuffer Read/Write, limit to SSIZE_MAX. 2019-01-30 18:05:49 +01:00
Armin Novak
650f63c7ca Added missing SSIZE_MAX define 2019-01-30 18:05:49 +01:00
Armin Novak
585391dfbf Fixed sign-compare warning 2019-01-30 18:05:49 +01:00
Armin Novak
fc9e88d64f Added flag to silence command line parser logging during detection. 2019-01-16 14:32:19 +01:00
Peter Åstrand (astrand)
30cd1ba1ab Use lowercase for includes and libs
Makes build possible on case sensitive systems such as MinGW on Linux.
2019-01-09 09:36:28 +01:00
Armin Novak
5dea64a468 Added backtrace function working on allocated logger. 2018-12-17 09:24:57 +01:00
Armin Novak
66e71ef963 Added missing define for _wcsnlen for windows. 2018-12-10 14:02:57 +01:00
Armin Novak
1e644fc37e Added _wcsnlen function for WCHAR string length. 2018-12-10 12:39:32 +01:00
Armin Novak
617c00c8f5 WLog_IsLevelActive is now a exported function istead of inline.
Since this function calls WLog_GetLogLevel anyway better only
export the API to allow internal checks to be modified in the
future without breaking API
2018-11-22 16:34:38 +01:00
Armin Novak
37a01a19d8 Fix #5024: Update inherited log level for all child loggers when setting a new one. 2018-11-19 12:19:12 +01:00
Armin Novak
a2cd934184 Fixed windows build warnings. 2018-11-15 09:01:53 +01:00
Armin Novak
b7f272cd16 Fixed casts in Data_Read macros. 2018-10-25 15:52:12 +02:00
Armin Novak
97e68deea5 Fixed initialisation in DEFINE_EVENT_ENTRY define 2018-10-24 16:50:05 +02:00
akallabeth
16d37b1a17
Merge pull request #4932 from hardening/stream_static
winpr: add some functions to use wStream in a static way
2018-10-22 21:16:36 +02:00
Norbert Federa
0572572eb9 fix issue with fnObjectFree and related casts
- remove unnecessary/dangerous OBJECT_xxx function-style casts
- fix -Wstrict-prototypes issue with OBJECT_NEW_FN definition
2018-10-19 11:30:01 +02:00
Armin Novak
554e18780b USe const compare function pointer arguments 2018-10-18 09:06:55 +02:00
David Fort
13e2a8834d winpr: add some functions to use wStream in a static way
It's sometime useful to create a stream aliasing a buffer on the stack, and
it's nice if we don't need some extra malloc for this.

Example use:
   BYTE buffer[20];
   wStream s;

   Stream_StaticInit(&s, buffer, sizeof(buffer));
   Stream_Write_UINT16(&s, 0xff01);
   Stream_Free(&s, FALSE);
2018-10-17 19:07:48 +02:00
Marc-André Moreau
1b42e512ee winpr: add WINPR_DLL definition 2018-10-04 15:09:49 -04:00
Armin Novak
bfeac80ed3 Fixed macro _stream_read_n16_le and _stream_read_n16_be
Cast to appropriate type to avoid integer truncation warnings.
2018-09-14 10:08:38 +02:00
Armin Novak
c159b2e9c8 Fixed missing check before calling memcpy 2018-08-24 13:40:36 +02:00
Martin Fleisz
0afba58405
Merge pull request #4814 from akallabeth/linked_list_add_object
Linked list add object for user defined functions
2018-08-24 08:37:41 +02:00
Ondrej Holy
4813a70897 winpr/utils/ntlm: Prevent releasing function argument
The patch changes API of functions instead of fixing unused and broken code.

freed_arg: "free" frees parameter "NtHash".
2018-08-23 09:11:24 +02:00
Ondrej Holy
1c1d00aac0 winpr/utils/ntlm: Format code by astyle
Run ./scripts/format_code.sh before the following changes.
2018-08-22 14:34:02 +02:00
Armin Novak
b77dc13b5f Implemented linked list compare and value copy functions. 2018-08-22 12:39:11 +02:00
Pascal J. Bourguignon
15f2bafeab Cleaned up const char** -> char** for argv, since we definitely do modify the argv!
(we overwrite the password and pin arguments).
This implies changes in the argument parsing tests that now must pass a mutable argv
(copied from the statically declared test argvs).
Some other const inconsistency have been dealt with too.
2018-06-06 16:43:09 +02:00
Armin Novak
e0d112d548 Removed all calls to WLog_Init and WLog_Uninit
Since the calls are no longer required remove their usage.
2018-04-03 13:06:41 +02:00
Armin Novak
d249335708 Removed winpr_exit
As the cleanup functions are called by atexit a dedicated
cleanup call is no longer required.
2018-04-03 12:56:33 +02:00
Martin Fleisz
8df96364f2 cssp: Add support for protocol version 6 2018-03-20 10:37:38 +01:00
Martin Fleisz
5d1ff02d02
Merge pull request #4414 from akallabeth/pthread_cleanup_fix
Pthread cleanup fix
2018-02-15 11:02:37 +01:00
Armin Novak
5903d5b375 Fixed winpr digest type. 2018-02-14 12:48:45 +01:00
Armin Novak
53d2150e00 Fixed windows unicode authentication. 2018-02-13 11:29:56 +01:00
Armin Novak
2d58e96dcc Exit main thread with winpr_exit to trigger resource cleanup.
When using pthread_once with destructors they are only called,
if each thread (including the main thread) is exited with pthread_exit.
Introducing winpr_exit as a wrapper for that purpose.
2018-02-12 10:33:02 +01:00
akallabeth
e3e65734e8
Merge pull request #4303 from krisztian-kovacs-balabit/use-redirection-password
Use redirection password
2017-12-20 17:01:58 +01:00
Martin Fleisz
bfe8359b5b
Merge pull request #4239 from akallabeth/test_memleak_fixes
Test memleak fixes
2017-12-20 12:38:38 +01:00
Bernhard Miklautz
389b7f218b feat winpr: add WINPR_UNUSED macro
WINPR_UNUSED can be used to mark intentionally unused function parameters.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
e3d45c4580 fix channel/smartcard: remove SCardAddReaderName
SCardAddReaderName isn't part of the SCard API.

Note: removing this also removes the possibility to redirect single
smartcard readers with /smartcard:READERNAME. However this features
wasn't implemented in a general way and will be re-added as part of
the smart card channel directly.
2017-12-13 17:04:06 +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
KOVACS Krisztian
3c56300afa winpr/sspi: add possibility to set auth identity with Unicode password
To be able to avoid password conversion if the password is already unicode
this change adds the sspi_SetAuthIdentityWithUnicodePassword() function
that is identical to sspi_SetAuthIdentity() except that the password is
used without further conversions in the Unicode identity.
2017-12-06 16:30:57 +01:00
David Fort
2f4a2f8595
Merge pull request #4272 from akallabeth/static_channel_checks
Fix #3378: 31 static channels are supported.
2017-11-27 22:46:23 +01:00
Bernhard Miklautz
50105c8157
Merge pull request #3991 from akallabeth/stream_string_helper
Stream convenience functions to read/write strings.
2017-11-27 11:49:46 +01:00
Armin Novak
377bfeb227 Fix #3378: 31 static channels are supported. 2017-11-23 16:18:44 +01:00
Ondrej Holy
6973b14eed Enable FIPS mode automatically
FreeRDP aborts if OpenSSL operates in FIPS mode and +fipsmode is not
manually specified. Let's prevent the abortion and enable the necessary
options in that case automatically.
2017-11-23 10:09:17 +01:00
Brent Collins
9ca9df1ead Make the new winpr_Digest*MD5_Allow_FIPS functions more generic to no longer be MD5 specific in design. This way the FIPS override
could easily be extended to more digests in the future. For now, an attempt to use these functions with anything other than MD5 will
not work.
2017-11-17 12:43:07 +01:00
Brent Collins
d98b88642b Add new command-line option to force xfreerdp into a fips compliant mode.
This option will ensure that NLA is disabled(since NTLM uses weak crypto algorithms), FIPS
encryption is enabled, and ensure fips mode is enabled for openssl.

Selectively override specific uses of MD5/RC4 with new API calls specifically tailored to override FIPS.

Add comments on why overriding the use of these algorithms under FIPS is acceptable for the locations where overrides happen.

Remove check of server proprietary certificate which was already being ignore to avoid use of MD5.

Initialize winpr openssl earlier to ensure fips mode is set before starting using any crypto algorithms.
2017-11-17 12:43:06 +01:00
Armin Novak
4eb5b8e349 Replaced atoi 2017-11-15 15:52:16 +01:00
Armin Novak
8c2bd951ae Allow printing of custom arguments in help. 2017-11-15 15:25:34 +01:00
dodo040
1d97286a76 fix undeclared identifier on Windows 2017-11-13 16:20:56 +01:00
dodo040
335de159b0 use SSIZE_T instead of ssize_t 2017-11-13 16:20:56 +01:00
dodo040
9adb971181 handle missing ssize_t on Windows 2017-11-13 16:20:56 +01:00
dodo040
e0a9999fb2 fix: GSS API init, enterprise name management, variable names and format code 2017-11-13 16:20:56 +01:00
dodo040
b81f168f0e initial commit for kerberos support 2017-11-13 16:20:55 +01:00
Armin Novak
c3d4b7d262 fseeko and ftello for 64bit file support. 2017-08-14 08:42:49 +02:00
Armin Novak
2d18267538 Stream convenience functions to read/write strings. 2017-07-24 08:58:15 +02:00
dodo040
722e927c64 redirect specific smartcard readers 2017-07-19 13:16:08 +02:00
David Fort
5ef9232703 Merge pull request #3905 from ilammy/x11-cliprdr/file-clipping
Local-to-remote file clipping for xfreerdp
2017-06-07 21:20:34 +02:00
davewheel
4bfb4dddbf Add a callback to provide NTLM hashes on server-side
Adds a callback that allows servers to compute NTLM hashes by themselves. The typical
use of this callback is to provide a function that gives precomputed hash values.

Sponsored by: Wheel Systems (http://www.wheelsystems.com)
2017-05-18 14:24:24 +02:00
ilammy
843ab1c234 winpr: fix field names of FILEDESCRIPTOR struct
The file name field is actually called cFileName on Windows. Use this
name in WinPR's struct definition as well for compatibility.
2017-04-21 14:13:52 +03:00
ilammy
d341973247 winpr: include Windows headers in <winpr/shell.h>
This header file (currently) provides definitions of FILEDESCRIPTOR
structure and GetUserProfileDirectory() function. However, it does so
only when included on non-Windows platforms. The code which includes it
fails to build on Windows because the definitions are absent and it
causes weird compilation errors (like FILEDESCRIPTOR being treated as
the name of a function argument).

Inculde <shlobj.h> to get FILEDESCRIPTOR and <userenv.h> for the
GetUserProfileDirectory() function. (And hope that this will not
pull more Windows headers than we need in the files which include
<winpr/shell.h>.)
2017-04-21 00:44:46 +03:00
Norbert Federa
736675aa01 Merge pull request #3901 from akallabeth/openssl_1_1_no_legacy
Fixed OpenSSL 1.1 no legacy compile issues.
2017-04-11 15:00:30 +02:00
ilammy
44b04cafef wClipboard: disallow Windows reserved names
Another issue revealed during testing is that older Windows systems
cannot handle the reserved file names well. While Windows 8 and 10 are
fine (they silently abort the file transfer), using reserved names with
Windows 7 can flat out crash explorer.exe or result into weird error
messages like "fatal error: 0x00000000 ERROR_SUCCESS".

This is not required by MS-RDPECLIP specification, but we should try to
avoid this issue as not using reserved file names seems to be assumed
a common sense in Windows protocols.

The most convenient way to handle the issue would be on wClipboard level
so that WinPR's clients do not bother with it. We should prohibit the
reserved names from being used in FILEDESCRIPTOR, failing the conversion
if we see such a file.

POSIX subsystem (the only one at the moment) handles remote file names
in two places so move the Unicode conversion and the new validation
check into a separate function.

The reserved file name predicate is placed into <winpr/file.h> so that
it can be used in other places too. For example, other wClipboard local
file subsystems will need it. (It would be really nice to enforce this
check somewhere in the common code, so that the subsystems can't miss
it, but other places can miss some errors thus we're doing it here, as
early as possible.)

The predicate acts on separate file name components rather than full
file names because the backslash is a reserved character too. If we
process full file names this can result in phantom directory entry in
the remote file name. Not to say that handling ready-made components
spares us from splitting the full file name to extract them :)

The implementation is... a bit verbose, but that's fine by me. In the
absence of functions for case-insensitive wide string comparison and
the need to check for the [0-9] at the end of some file names this is
quite readable. Thanks to FAT and NTFS for being case-insensitive and
to MS-DOS for having reserved file names in the first place.
2017-04-09 03:17:07 +03:00
ilammy
092e870d2a wClipboard/posix: implement file range retrieval
This is another bunch of callbacks which provide the file contents to
the clients. We jump through some extra hoops in order to have more
pleasant user experience.

Simple stuff goes first. The file offset (or position) is split into the
low and high parts because this is the format in which the clients
receive the request from the server. They can simply copy the values as
is into the struct without repackaging them (which we do instead in the
end to get a 64-bit off_t).

Another thing is that we try to minimize the number of lseek() calls and
to keep as few file descriptors open as possible. We cannot open all the
files at once as there could be thousands of them and we'll run out of
the allowed number of the fds. However, the server can (in theory)
request the file ranges randomly so we need to be prepared for that. One
way to do that would be to always open the file before reading and close
it immediately afterwards. A dead simple solution with an acceptable
performance, but... some file systems do not support seeking, such as
FTP directories mounted over FUSE. However, they handle sequential
reading just fine *and* the server requests the data sequentially most
of the time so we can exploit this.

Thus open the file only once, during the first range request and keep
it open until the server reads all the data. In order to know how much
data is left we keep an accurate account of all reads and maintain the
file offset ourselves. This also allows us to avoid calling lseek() when
the file offset will not be effectively changed. However, if the server
requests some weird offset then we have no choice and will attempt
seeking. Unfortunately, we cannot tell whether it is a genuine failure
or the file system just does not support seeking, so we do not handle
the error further. (One workaround would be to reopen the file and keep
reading it until we're at the correct offset.) In this way we can
support sequential-only file systems if the server requests the contents
sequentially (and it does).

Also note that we do an fstat() right after opening the file in order to
have an accurate value of file size, for this exact file descriptor we
will be using. We should have it filled it by now, but just in case...

There is one more thing to explain. The cbRequested field specifies the
maximum number of bytes the server can handle, not the required number.
Usually this is some power-of-two number like 64 KB, based on the size
of the files on the clipboard. This is why posix_file_read_perform()
does not attempt to fill the whole buffer by repeatedly calling read()
if it has read less data than requested. The server can handle underruns
just fine (and this spares us from special-casing the EOF condition).
2017-04-09 03:15:49 +03:00
ilammy
33719d24ce wClipboard/posix: implement file size retrieval
This is an example of wClipboardDelegate method implementation. POSIX
subsystem uses synchronous methods, but the interface can be used for
asynchronous request processing as well. The client should call a
Client* callback to request some action and the wClipboard will process
the request and report the result by calling an approriate Clipboard*
callback. Usually there will be two callbacks: one for reporting success
and one to report errors.

All callbacks have at least two arguments: the wClipboardDelegate itself
to pass the system context, and the wClipboard*Request structure with
the arguments to pass the call context. The request context is also
passed to the result callbacks by wClipboard so that the client can
match up the result with its previous request.

The fields of wClipboard*Request structures are heavily influenced by
the MS-RDPECLIP spec and mirror the respective fields of
CLIPRDR_FILECONTENTS_REQUEST. wClipboard should not depend on
MS-RDPECLIP, that's the reason we don't use CLIPRDR_FILECONTENTS_REQUEST
directly. However, I believe that we should not have void* fields in the
request structs so that they can be easily copied around if needed.
This is why have the weird 'streamId' field there which has nothing to
do with wClipboard and will be used only by the clients when sending
replies to the server.

Return values of the callbacks are to be used for reporting errors with
processing the request or reply per se, not for errors encountered while
performing the action requested. Thus, for example, we return NO_ERROR
from posix_file_request_size() even when we fail to report the result to
the client, because we have successfully performed the request and do
not care if the client could not handle our reply for some reason.

Also note that setup_delegate() fills in dummy implementations of
Clipboard* reply callbacks so that we do not crash in case the client
does not fill them and do not have to perform paranoid NULL checks
before calling every single callback.
2017-04-09 03:15:49 +03:00