Commit Graph

341 Commits

Author SHA1 Message Date
Armin Novak
e1eacad74c [scard] fixed memory leak
card_id_and_name_* return allocated values, free after use
2022-12-02 15:08:09 +01:00
Armin Novak
bc3904ec65 [channel,smartcard] Fix message cleanup on shutdown 2022-12-02 15:08:09 +01:00
akallabeth
1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
akallabeth
cb96e6143d Fixed -Wshadow warnings 2022-06-30 10:49:02 +02:00
akallabeth
6fd71fe737 Eliminate Dead nested assignment warnings 2022-04-28 12:37:19 +02:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
akallabeth
8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +01:00
Armin Novak
3c72cc3306 Refactored rdpdr and dependent channels
* Move parsing code to core library
* Move definitions to public API to allow access from outside
* Move smartcard related parsing to core library
2022-01-11 12:34:43 +01:00
akallabeth
8c543b1de2 Added smartcard emulation layer 2022-01-11 12:34:43 +01:00
Martin Fleisz
9d031012be smartcard: Fix length of output buffer in device control response 2021-07-07 11:48:56 +02:00
Armin Novak
f03b074b01 Fixed warnings with missing prototypes 2021-06-18 11:32:16 +02:00
Armin Novak
4dfee30934 Fixed smartcard related warnings 2021-06-18 11:32:16 +02:00
Armin Novak
d36d94766e Replaced assert with WINPR_ASSERT 2021-06-14 09:37:07 +02:00
Biswapriyo Nath
173ab04b59 Use same data types as calling function prototypes. 2021-05-31 13:38:19 +02:00
Ondrej Holy
892cbe3261 Fix various memory leaks reported by Coverity
Covscan report contains various memory leak defects which were marked
as important. I have spent some time analyzing them and although they
were marked as important, most of them are in error cases, so probably
nothing serious. Let's fix most of them anyway. The rest are false
positives, or too complicated to fix, or already fixed in master, or
simply I am unsure about them.

Relates: https://github.com/FreeRDP/FreeRDP/issues/6981
2021-04-27 14:25:20 +02:00
akallabeth
fab649a1b9 Fixed return length check for SCardGetAttrib 2021-03-20 14:31:56 +01:00
akallabeth
b8a8ae4622
Fixed mac issues with smartcard context cleanup (#6890) 2021-03-12 08:56:23 +01:00
akallabeth
4599dc0a60 Check smartcard_convert_string_list for NULL string
In #6821 it has been reported that there are buggy smartcard
drivers that report a string size but fail to allocate the string
itself. This check avoids a crash with such input parameters
2021-03-09 10:20:42 +01:00
Armin Novak
c890db30c7 Fixed smartcard_convert_string_list with 0 length 2021-03-03 11:57:26 +01:00
akallabeth
71c2c3102c Fixed format string in smartcard_trace_state_return 2021-03-02 08:03:35 +01: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
59377fce5e Fixed smartcard crash on error return (invalid length) 2021-02-18 16:49:19 +01:00
Armin Novak
4b7208fb6e Always return data on SCardGetStatusChange
If the call fails just return empty data for each reader.
2021-02-10 10:36:51 +01:00
akallabeth
bad20340cc Fixed issue with GetAttr where the result buffer was not allocated 2021-02-10 10:36:51 +01:00
akallabeth
14d5ad0d79 Fixed GetAttrib return length 2021-02-10 10:36:51 +01:00
akallabeth
b0c11ebd91 Fixed smartcard_unpack_reader_state, allow empty names 2021-02-10 10:36:51 +01:00
akallabeth
8217f5a9e3 Fixed SCardTransmit return 2021-02-10 10:36:51 +01:00
akallabeth
f693a60ec2 Unified smartcard call data structs 2021-02-10 10:36:51 +01:00
akallabeth
6cf5ba4736 Unified smartcard handle converstion 2021-02-10 10:36:51 +01:00
akallabeth
09d2806ac6 Fixed various return values in case of result != SCARD_S_SUCCESS 2021-02-10 10:36:51 +01:00
akallabeth
5fc24ef408 Fixed GetAttrib call 2021-02-10 10:36:51 +01:00
akallabeth
2767940891 refactored smartcard allocations 2021-02-10 10:36:51 +01:00
akallabeth
b049265203 Fixed SCard debug WCHAR string lengths 2021-02-10 10:36:51 +01:00
akallabeth
082b4b59d3 Fixed SCardGetAttrib pbAttr=NULL argument
If fpbAttrIsNULL!=0 set pbAttr NULL on call to SCardGetAttrib
2021-01-26 13:33:27 +01:00
Martin Fleisz
b092ab3b85 channels/smartcard: Fix race in channel cleanup 2021-01-22 09:49:56 +01:00
akallabeth
6e3c00725a Cleaned up collections:
ArrayList, MessageQueue, Queue, PubSub, BipBuffer
ObjectPool and BufferPool
2020-11-06 12:30:13 +01:00
akallabeth
5c0ccb7575 Fixed formatting. 2020-06-04 07:55:12 +02:00
Ondrej Holy
c03f68059d smartcard: Teoretical fix of uninitialized values
This tries to fixes the following defects reported by covscan tool:
 - channels/smartcard/client/smartcard_operations.c:958: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".
 - channels/smartcard/client/smartcard_operations.c:932: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".

But I am not sure about it...
2020-06-04 07:55:12 +02:00
Ondrej Holy
7554154a04 smartcard: Fix usage of uninitialized values
This fixes the following defect reported by covscan tool:
 - channels/smartcard/client/smartcard_pack.c:942: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:894: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:475: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
2020-06-04 07:55:12 +02:00
akallabeth
feb7d4f362 Changed smartcard no reader log message level to info 2020-05-08 11:21:51 +02:00
akallabeth
af79aafbba Fixed int overflow in smartcard_ndr_read
Thanks to hac425
2020-05-08 11:04:03 +02:00
Armin Novak
e80316cf9a Silence SCARD_E_TIMEOUT warnings
These occur quite often for status calls, so reduce log verbosity.
2020-05-04 17:32:55 +02:00
Alex Wilson
40f23e2728 SCardReadCache/SCardWriteCache should actually cache data
Currently since the hash/keyCompare/keyClone members on the
context->cache were never being set, we were using the
HashTable_Pointer* variants, meaning that lookup always
failed (since we never ask for the same *pointer* twice).

This also revealed that the logic for autoallocate on these ops
was a bit backwards, and some error codes and support for the
"freshness" counter were missing.

In Win10 (at least with some card minidrivers) the freshness
counter is load-bearing and smartcard login won't work without
implementing a very basic version of it.
2020-04-21 08:11:54 +02:00
akallabeth
6b66aa71fb Fixi #6086: smartcard filter early abort.
Do not abort before incrementing read position.
2020-04-14 19:04:11 +02:00
Alex Wilson
c6e675bfb7 Always copy null terminator when filtering smartcard list 2020-04-09 10:44:25 +02:00
akallabeth
2749de506c Added missing context and handle read. 2020-03-30 11:07:47 +02:00
Armin Novak
f360d445e2 Pack smartcard channel structs to 1 byte alignment 2020-03-27 18:24:25 +01:00
akallabeth
ac4ec690c9 Removed a few magic numbers. 2020-03-27 15:03:59 +01:00