Bug 1765199

Summary: SCARD_INSUFFICIENT_BUFFER error when connecting to Windows 10 system
Product: Red Hat Enterprise Linux 7 Reporter: Andrew Mike <amike>
Component: freerdpAssignee: Ondrej Holy <oholy>
Status: CLOSED CURRENTRELEASE QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: high    
Version: 7.7CC: agilmore, alanm, ayadav, brclark, jwright, mkolbas, oholy, tpelka
Target Milestone: rcKeywords: OtherQA, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freerdp-2.0.0-2.rc4.el7_8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1803054 1818718 (view as bug list) Environment:
Last Closed: 2020-05-12 18:48:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1803054, 1818718    

Description Andrew Mike 2019-10-24 14:00:58 UTC
Description of problem: When connecting to a Windows 10 system with smartcard authentication, it fails to connect with an error.


Version-Release number of selected component (if applicable):
2.0.0-rc4.el7.x86_64


How reproducible: Consistently.


Steps to Reproduce:
1. Configure the system for smartcard authentication.
2. Run the command "/usr/bin/xfreerdp -g 2555x1565 --plugin cliprdr --plugin rdpsnd --no-nla --rfx --plugin rdpdr --data scard: --  $REMOTE_HOST"

Actual results: Connection fails with the following errors:

==============================================================
[WARN][com.freerdp.channels.smartcard.client] - IRP failure: SCardStatusW (0x000900CC), status: SCARD_E_INSUFFICIENT_BUFFER (0x80100008)
[WARN][com.freerdp.channels.smartcard.client] - IRP failure: SCardStatusW (0x000900CC), status: SCARD_E_INSUFFICIENT_BUFFER (0x80100008)
[WARN][com.freerdp.channels.smartcard.client] - IRP failure: SCardGetStatusChangeW (0x000900A4), status: SCARD_F_COMM_ERROR (0x80100013)
[ERROR][com.freerdp.channels.smartcard.client] - SCardReleaseContext failed with error -2146435043
==============================================================


Expected results: Connection succeeds.

Additional info:
- Reverting to version 1.0.2-15.el7_6.1 seems to work properly.
- This appears to be a bug upstream (linked to the ticket).
- There also appears to be a patch upstream: https://github.com/FreeRDP/FreeRDP/pull/5499

Comment 3 Ondrej Holy 2019-10-24 14:15:16 UTC
Just a note that there is a similar Bug 1722311, but it is for RHEL 7.6, so it is not duplicate.

Comment 15 agilmore 2019-12-12 16:48:19 UTC
I had to downgrade back to freerdp 1.0.2 to get back this functionality to Server 2012. Please continue to assist upstream in fixing this. 

In August, 2016, I built a freerdp versioned 2.0.0-5.git.b02943a that works fine in RHEL6, if that helps at all. 

I'll bring up a bug mentioned upstream. Fixing the issue where the Linux clients don't trigger the smart card manager service to start in Windows would be awesome. We currently run a scheduled task to restart it every minute. If it's related to this bug, please fix both!

This regression was unpleasant to deal with. The upgrade was also not mentioned in the 7.7 release notes.

This has my customer vote!

Comment 18 Ondrej Holy 2019-12-19 08:15:07 UTC
(In reply to agilmore from comment #15)
> I had to downgrade back to freerdp 1.0.2 to get back this functionality to
> Server 2012. Please continue to assist upstream in fixing this. 

I'm sorry about it, but we are working on it. It is confirmed that https://github.com/FreeRDP/FreeRDP/pull/5499 fixes the SCARD_INSUFFICIENT_BUFFER errors and restore the functionality, but still, SCardListReadersW errors are reported (https://github.com/FreeRDP/FreeRDP/issues/5791), although it seemingly doesn't affect functionality. We are trying to figure out why.

> In August, 2016, I built a freerdp versioned 2.0.0-5.git.b02943a that works
> fine in RHEL6, if that helps at all. 
> 
> I'll bring up a bug mentioned upstream. Fixing the issue where the Linux
> clients don't trigger the smart card manager service to start in Windows
> would be awesome. We currently run a scheduled task to restart it every
> minute. If it's related to this bug, please fix both!

Also, we are currently trying to fix the autostarting of smartcard service, see https://github.com/FreeRDP/FreeRDP/pull/5793. However, we don't have a proper environment for testing right now and rely on feedback. If you are willing to help, support team can you provide testing builds, or alternatively you can try building freerdp master yourself. Thanks for understanding.

Comment 19 agilmore 2019-12-23 20:19:03 UTC
The test build I got from the support case fixed the main issue that smart card auth no longer worked.

I might be able to check on the smart card redirect/service autostart thing given test builds. Looks like the upstream jenkins has RPM builds https://ci.freerdp.com/job/freerdp-nightly-rpm-mock/ but they probably won't install in RHEL7.

Andrew

Comment 21 Ondrej Holy 2020-01-08 08:35:19 UTC
(In reply to agilmore from comment #19)
> ...
> I might be able to check on the smart card redirect/service autostart thing
> given test builds. Looks like the upstream jenkins has RPM builds
> https://ci.freerdp.com/job/freerdp-nightly-rpm-mock/ but they probably won't
> install in RHEL7.

Thanks. I haven't tested those builds on RHEL 7, but we have already feedback for https://github.com/FreeRDP/FreeRDP/pull/5793 from other people and it causes some undocumented behavior for them, unfortunately.

Comment 22 Ondrej Holy 2020-01-08 08:46:34 UTC
It is confirmed that https://github.com/FreeRDP/FreeRDP/pull/5499 fixes SCARD_INSUFFICIENT_BUFFER error, so I would suggest using this report to fix only this issue as it caused regression after rebasing to 2.0-rc4.

The problem with autostarting smartcard service on the server is not a regression as it never worked with freerdp and it is pretty unclear what needs to be done to fix it. So I would suggest using Bug 1722311 for it to not block fixing the SCARD_INSUFFICIENT_BUFFER errors. Fortunately, the server-side workaround exists.

Comment 25 agilmore 2020-01-21 18:29:53 UTC
This bug is about the regression. I understand the lack of autostart is a separate issue. I would appreciate this bugfix getting into an errata.