Commit Graph

279 Commits

Author SHA1 Message Date
Armin Novak
11d3ea3b43 Fix #5847: Missing length check to trace smartcard buffers. 2020-02-10 14:28:38 +01:00
Armin Novak
11f2532242 Added unified NDR pointer reading. 2020-01-24 13:52:43 +01:00
Armin Novak
7b50ed887e Fixed missing length checks for smartcard IRP read. 2020-01-24 13:23:40 +01:00
Armin Novak
f4ee8d92a7 Fixed smartcard type mismatches. 2020-01-23 10:39:43 +01:00
Armin Novak
f0db6f2ead Unified smartcart multistring conversion. 2020-01-23 10:07:54 +01:00
Armin Novak
ee7950c95c Fixed type mismatches on allocation. 2020-01-23 09:48:20 +01:00
Armin Novak
ec5881e3f2 Fixed smartcard_SetAttrib_Decode call type 2020-01-23 09:32:34 +01:00
Armin Novak
dfe7b8c8da Implement missing functions for new smartcard
Newer smartcard channel behaviour expects a lot more callbacks
being implemented. This change provides them.
2020-01-13 11:27:37 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
59b4988f56 Fixed compilation warnings. 2019-10-16 14:54:05 +02:00
Bernhard Miklautz
a311075202 fix [channels/smartcard]: fix StatusW_Call
According to 2.2.2.18 Status_Call cbAtrLen is unused an must be ignored
upon receipt.
2019-07-30 09:48:47 +02:00
Armin Novak
60a82854c1 For smartcard trace functions use const arguments 2019-05-08 15:13:03 +02:00
Armin Novak
4b72a85e91 Fixed possible memory leak. 2019-05-08 15:12:40 +02:00
Armin Novak
8f7e1579fd Silenced unused parameter warnings in smartcard trace 2019-05-08 12:27:51 +02:00
r-barnett
40ef08ddc5 Fix smartcard segfault when no devices are present (#5364)
* Don't assume smartcard reader list is not empty.

* Check status of retrieval of smartcard device list before trying to filter it

* style fixes
2019-05-02 06:11:57 +02:00
Pascal J. Bourguignon
431c37f3a9 5360 segfault using smartcard without any readers (#5361)
* Fix: corrected test for astyle.

* Fix: added test for NULL readers returned by ConvertFromUnicode.
2019-04-26 09:10:41 +02:00
Armin Novak
b9b3f3eda7 Fixed sign-compare warnings 2019-04-05 09:13:24 +02:00
Armin Novak
ef1728faf5 Fixed NULL dereferences and uninitialized values 2019-01-30 16:11:10 +01:00
Armin Novak
a8a6accc15 Fixed compiler warnings. 2018-10-03 15:16:59 +02:00
Armin Novak
f63286dbea Fixed smartcard filter for empty arguments. 2018-09-19 11:13:02 +02:00
Armin Novak
4596588e0f Set freed pointer to NULL avoiding double free. 2018-09-04 15:22:06 +02:00
Armin Novak
b2ce309b28 Added multi filter for smartcard. (based on #4837 by @informatimago) 2018-09-04 14:34:32 +02:00
Ondrej Holy
97f25e8ab4 channels/smartcard: Fix leak found by covscan
leaked_storage: Variable "operation" going out of scope leaks the storage it points to.
2018-08-22 13:35:43 +02:00
Ondrej Holy
3baa716706 channels/smartcard: Format code by astyle
Run ./scripts/format_code.sh before the following changes.
2018-08-22 13:35:43 +02:00
Ruben De Visscher
1835a39aaf Fix inconsistent cBytes value between WinScard and pcsc-lite. 2018-04-24 10:33:44 +02:00
Armin Novak
2517755d25 Fixed thread function return and parameters. 2018-03-07 14:36:55 +01:00
Jukka-Pekka Virtanen
2e8f2c693d [MS-RDPESC] 2.2.2.18 Status_Call.cbAtrLen: Unused. MUST be ignored upon receipt.
The [MS-RDPESC] clearly states in section 2.2.2.18 that Status_Call's
cbAtrLen must not be used when generating Status_Return response. This
is also how FreeRDP 1.1 behaves.
2018-01-11 16:23:15 +02:00
Armin Novak
bb7ba6ff26 Fixed smartcard related scanbuild warnings. 2017-12-21 10:53:36 +01:00
Armin Novak
6a21bdae3d Fixed various scanbuild warnings. 2017-12-21 09:34:35 +01:00
Bernhard Miklautz
36c6478627 fix client/smartcard: indentation and return value
Integrate feedback from pull request review.
2017-12-14 16:21:19 +01:00
Bernhard Miklautz
5a1c0081c5 fix smartcard: SCardStatus unicode handling
* fix StatusW_Call to rely and use SCardStatusW
* fix trace call in  StatusW_Call - needs to be called after the sizes
  are set
* unify SCardStatus functions for pcsc - let the internal function handle unicode directly

This fixes an issue with size calculations of SCardStatusW.
2017-12-14 15:46:14 +01:00
Bernhard Miklautz
94b35cb4f7 fix channel/smartcard: leak in Connect[AW]
smartcard_Connect[AW] leaked the reader buffer in error case.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
9fc754170b fix channel/smartcard: SCardStatus
Add support for fmszReaderNamesIsNULL. Formating of the touched files
was also updated.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
bc8bdc3e54 fix channel/smartcard: compiler warnings
* remove unused variables
* remove unused jump label
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
Bernhard Miklautz
1e6fea7fa7 fix channel/smartcard: simplify channel variables
Path was not really used and name was duplicated. Use the device->Name
directly.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
f8a3e7acd4 fix channel/smartcard: GetStatusChange return code
In case SCardGetStatusChange returned an error the call didn't return
any data but STATUS_NO_MEMORY as the calloc failed. This caused problems
with multiple applications server side (hangs and incorrect behavior).

Now the case when no readers are returned is handed correctly and the
data is also filled and send if the call fails.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
46a7538322 fix channel/smartcard: async request handling
The smart card channel tried to mimic mstsc's behavior on if an IRP was
processed synchronously or asynchronously. As the channel uses one thread per
context it could happen, especially with PCSC, that the main
channel thread was blocked waiting for an smart card operation to
complete. To prevent that behavior only call known safe functions in the
main thread (like CreateContext) and call the rest asynchronously.

For example the channel would block if a ListReaders is invoked on
the same context where a GetStatusChange (infinite timeout)
was already pending. Only when a status change happened the channel
would continue.

Note: Due to the one context per thread design it's important that
cancel isn't queued an alway run synchronously. Otherwise a specific
context might lock.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
3dc4e283db fix channel/smartcard: return value handling
Device control calls always returned SCARD_S_SUCCESS even if an error
occurred. This caused server side software (including the card manager)
to behave incorrectly.
2017-12-13 17:04:06 +01:00
Bernhard Miklautz
99c69cde27 fix channel/smartcard: error handling
According to MS-RDPESC the smart card channel must set the IoStatus to
an NTSTATUS in case a encoding or decoding error happens. The smart card
channel did this correctly but the output stream was modified
incorrectly causing the smart card remote manager to stop in error
cases.
2017-12-13 17:04:06 +01:00
Armin Novak
0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
dodo040
03723c2738 fix wrong declaration 2017-07-19 13:16:08 +02:00
dodo040
722e927c64 redirect specific smartcard readers 2017-07-19 13:16:08 +02:00
Armin Novak
b2c29158be Scanbuild warning, argument checks and leak fixes.
* Added Stream_GetRemainingCapacity to check remaining stream size
  before writes.
* Fixed shadow server memory leak.
* Fixed lots of scanbuild warnings
* Added missing argument checks in many functions
* Added missing static function declarations
2017-03-02 18:13:43 +01:00
Armin Novak
ff56f75893 Fixed format specifier and unused variables. 2017-02-17 14:25:59 +01:00
Andreas Schultz
d2f98261f7 smartcard: implement ListReaderGroups
Conflicts:
	channels/smartcard/client/smartcard_operations.c
	channels/smartcard/client/smartcard_pack.c
	channels/smartcard/client/smartcard_pack.h

smartcard_operations: move handling of call argument into functions

The call argument was only use by static functions and was always equal
to operation->call. Remove the argument and use operation-call directly.

Also put the memory allocation and check into the same place.

Conflicts:
	channels/smartcard/client/smartcard_operations.c

Updated formatting and API
2017-02-16 16:59:03 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Norbert Federa
c6e6b44143 countless WLog/printf format specifier fixes 2016-11-25 17:06:25 +01:00
Marc-André Moreau
dee76617d9 channels: remove thread-local storage usage 2016-11-15 11:41:01 -05:00