Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
Re: security/keepassxc,-yubikey: Fix USB listener callback handler
To:
Rafael Sadowski <rafael@sizeofvoid.org>, ports <ports@openbsd.org>
Date:
Sun, 9 Jun 2024 09:43:38 +0000

Download raw body.

Thread
09.06.2024 09:52, Rafael Sadowski пишет:
> On my system, libusb_hotplug_register_callback fails, resulting in long
> open and closed DB tasks when my YubiKey is involved.
> 
> I have not found out why libusb_hotplug_register_callback fails which is
> clear the root cause. However, I had to realize that keepassxc uses
> "handle" even if it is not valid.
> 
> This means that everything works as usual for me.
> 
> gonzalo@ also reported the issue and tested the diff below with success.
> 
> I don't want to wait for upstream. OK to commit?

OK kn

> 
> Rafeal
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/security/keepassxc/Makefile,v
> diff -u -p -r1.62 Makefile
> --- Makefile	12 May 2024 12:09:16 -0000	1.62
> +++ Makefile	9 Jun 2024 06:45:13 -0000
> @@ -2,6 +2,7 @@ COMMENT =	management tool for passwords 
>  
>  V =		2.7.8
>  DISTNAME =	keepassxc-${V}
> +REVISION =	0
>  
>  CATEGORIES =	security
>  
> Index: patches/patch-src_gui_osutils_nixutils_DeviceListenerLibUsb_cpp
> ===================================================================
> RCS file: patches/patch-src_gui_osutils_nixutils_DeviceListenerLibUsb_cpp
> diff -N patches/patch-src_gui_osutils_nixutils_DeviceListenerLibUsb_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_gui_osutils_nixutils_DeviceListenerLibUsb_cpp	9 Jun 2024 06:45:13 -0000
> @@ -0,0 +1,20 @@
> +https://github.com/keepassxreboot/keepassxc/pull/10872
> +
> +Index: src/gui/osutils/nixutils/DeviceListenerLibUsb.cpp
> +--- src/gui/osutils/nixutils/DeviceListenerLibUsb.cpp.orig
> ++++ src/gui/osutils/nixutils/DeviceListenerLibUsb.cpp
> +@@ -94,11 +94,12 @@ int DeviceListenerLibUsb::registerHotplugCallback(bool
> +         // Avoid race conditions
> +         m_usbEvents.waitForFinished();
> +     }
> +-    if (!m_usbEvents.isRunning()) {
> ++    if (handle > 0 && !m_usbEvents.isRunning()) {
> +         m_completed = false;
> +         m_usbEvents = QtConcurrent::run(handleUsbEvents, static_cast<libusb_context*>(m_ctx), &m_completed);
> +     }
> +-    m_callbackHandles.insert(handle);
> ++    if (handle > 0)
> ++        m_callbackHandles.insert(handle);
> +     return handle;
> + }
> + 
>