You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
smart card reader driver name and version: no reader
pcsc-lite version: 1.9.9-3.fc38
the output of the command /usr/sbin/pcscd --version:
pcsc-lite version 1.9.9.
Copyright (C) 1999-2002 by David Corcoran <corcoran@musclecard.com>.
Copyright (C) 2001-2022 by Ludovic Rousseau <ludovic.rousseau@free.fr>.
Copyright (C) 2003-2004 by Damien Sauveron <sauveron@labri.fr>.
Report bugs to <pcsclite-muscle@lists.infradead.org>.
Enabled features: Linux x86_64-redhat-linux-gnu libsystemd serial usb libudev usbdropdir=/usr/lib64/pcsc/drivers ipcdir=/run/pcscd filter configdir=/etc/reader.conf.d
MAX_READERNAME: 128, PCSCLITE_MAX_READERS_CONTEXTS: 16
Platform
Operating system or GNU/Linux distribution name and version: Fedora 38 (6.5.7-200.fc38.x86_64)
Smart card middleware name and version
Smart card reader manufacturer name and reader model name: no reader
Smart card name: no card
Issue
When SCardCancel is called around the time when SCardGetStatusChange times out, it returns SCARD_E_INVALID_HANDLE. I would expect SCardCancel to either cancel SCardGetStatusChange (if it runs before the timeout) or do nothing and succeed (if it runs after the timeout).
Python script to reproduce the issue (based on SCardCancel.py):
#! /usr/bin/env python3# SCardCancel.py : Unitary test for SCardCancel()# Copyright (C) 2008-2009 Ludovic Rousseau## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License along# with this program; if not, see <http://www.gnu.org/licenses/>.fromsmartcard.scardimport*fromsmartcard.pcsc.PCSCExceptionsimport*importthreadingimporttimedefcancel():
time.sleep(1)
print("cancel")
hresult=SCardCancel(hcontext)
ifhresult!=0:
print('Failed to SCardCancel: '+SCardGetErrorMessage(hresult))
hresult, hcontext=SCardEstablishContext(SCARD_SCOPE_USER)
ifhresult!=SCARD_S_SUCCESS:
raiseEstablishContextException(hresult)
readers= [r'\\?PnP?\Notification']
print('PC/SC Readers:', readers)
readerstates= {}
forreaderinreaders:
readerstates[reader] = (reader, SCARD_STATE_UNAWARE)
t=threading.Thread(target=cancel)
t.start()
# increasing or decreasing the timeout by about 50 ms solves the issuehresult, newstates=SCardGetStatusChange(hcontext, 1000,
list(readerstates.values()))
print("SCardGetStatusChange()", SCardGetErrorMessage(hresult))
ifhresult!=SCARD_S_SUCCESSandhresult!=SCARD_E_TIMEOUT:
ifSCARD_E_CANCELLED==hresult:
passelse:
raiseBaseSCardException(hresult)
t.join()
hresult=SCardReleaseContext(hcontext)
print("SCardReleaseContext()", SCardGetErrorMessage(hresult))
ifhresult!=SCARD_S_SUCCESS:
raiseReleaseContextException(hresult)
Versions
/usr/sbin/pcscd --version
:Platform
Issue
When
SCardCancel
is called around the time whenSCardGetStatusChange
times out, it returnsSCARD_E_INVALID_HANDLE
. I would expectSCardCancel
to either cancelSCardGetStatusChange
(if it runs before the timeout) or do nothing and succeed (if it runs after the timeout).Python script to reproduce the issue (based on SCardCancel.py):
Log
Output from the script above:
Output from
pcscd
:log.txt
The text was updated successfully, but these errors were encountered: