yubikey-manager: backport 149560689, "Better error handling when failing
to open CCID context"
This commit is contained in:
parent
d56f655e1f
commit
fb3673a65c
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.4 2020/05/23 21:56:49 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.5 2020/05/23 23:01:25 sthen Exp $
|
||||
|
||||
COMMENT = library and CLI tool (ykman) for configuring a YubiKey
|
||||
|
||||
MODPY_EGG_VERSION = 3.1.1
|
||||
REVISION = 0
|
||||
REVISION = 1
|
||||
|
||||
DISTNAME = yubikey-manager-${MODPY_EGG_VERSION}
|
||||
YK_PROJECT = yubikey-manager
|
||||
|
@ -0,0 +1,24 @@
|
||||
$OpenBSD: patch-ykman_cli___main___py,v 1.3 2020/05/23 23:01:25 sthen Exp $
|
||||
|
||||
From 14956068994f411c5631794deb8d0cca3488b1e7 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Fokin <Dennis.Fokin@yubico.com>
|
||||
Date: Fri, 31 Jan 2020 08:15:23 +0100
|
||||
Subject: [PATCH] Better error handling when failing to open CCID context
|
||||
|
||||
Index: ykman/cli/__main__.py
|
||||
--- ykman/cli/__main__.py.orig
|
||||
+++ ykman/cli/__main__.py
|
||||
@@ -131,9 +131,10 @@ def _run_cmd_for_single(ctx, cmd, transports, reader=N
|
||||
try:
|
||||
return descriptor.open_device(transports)
|
||||
except FailedOpeningDeviceException:
|
||||
- ctx.fail('Failed connecting to {} [{}]. Make sure the application have \
|
||||
- the required permissions.'.format(
|
||||
- descriptor.name, descriptor.mode))
|
||||
+ ctx.fail('Failed connecting to {} [{}]. '
|
||||
+ 'Make sure the application has the '
|
||||
+ 'required permissions.'
|
||||
+ .format(descriptor.name, descriptor.mode))
|
||||
else:
|
||||
_disabled_transport(ctx, transports, cmd)
|
||||
|
@ -0,0 +1,38 @@
|
||||
$OpenBSD: patch-ykman_descriptor_py,v 1.1 2020/05/23 23:01:25 sthen Exp $
|
||||
|
||||
From 14956068994f411c5631794deb8d0cca3488b1e7 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Fokin <Dennis.Fokin@yubico.com>
|
||||
Date: Fri, 31 Jan 2020 08:15:23 +0100
|
||||
Subject: [PATCH] Better error handling when failing to open CCID context
|
||||
|
||||
Index: ykman/descriptor.py
|
||||
--- ykman/descriptor.py.orig
|
||||
+++ ykman/descriptor.py
|
||||
@@ -35,8 +35,9 @@ from .driver_otp import open_devices as open_otp
|
||||
from .native.pyusb import get_usb_backend
|
||||
|
||||
import logging
|
||||
-import usb.core
|
||||
+import smartcard
|
||||
import time
|
||||
+import usb.core
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -153,9 +154,13 @@ def get_descriptors():
|
||||
|
||||
def _list_drivers(transports):
|
||||
if TRANSPORT.CCID & transports:
|
||||
- for dev in open_ccid():
|
||||
- if dev:
|
||||
- yield dev
|
||||
+ try:
|
||||
+ for dev in open_ccid():
|
||||
+ if dev:
|
||||
+ yield dev
|
||||
+ except smartcard.pcsc.PCSCExceptions.EstablishContextException:
|
||||
+ logger.debug('Failed to establish CCID context. '
|
||||
+ 'Is the pcscd service running?')
|
||||
if TRANSPORT.OTP & transports:
|
||||
for dev in open_otp():
|
||||
if dev:
|
Loading…
x
Reference in New Issue
Block a user