refactor(*):Remove the context class;ConfigHelper is responsible for obtaining device configuration information based on the id, and DeviceCreator is responsible for creating the device;After the vid and pid are obtained, the configuration file is read. The driver name in the configuration file can generate the specific driver object and device object;Fixed an issue where fish's UKey device could not Verify on arm machines

- 修复fish的UKey设备在arm机器上无法进行Verify的问题
  去掉context类;
  根据id获取相应设备配置信息的功能由ConfigHelper承担,创建设备的功能由DeviceCreator承担
  获取到vid,pid之后读取配置文件,通过配置文件中的驱动名,就可以生成具体的驱动对象和设备对象
This commit is contained in:
luoqing 2023-06-28 16:54:22 +08:00
parent 38cb726619
commit d1f35be2c1
7 changed files with 11 additions and 1589 deletions

View File

@ -1,78 +0,0 @@
From bdb3eb90ad2ab0f08365b71fefb33c76b96c4359 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Fri, 2 Jun 2023 19:09:11 +0800
Subject: [PATCH] fix(feature-db):Fix the issue of not obtaining features from
the database when deviceSerialNumber is empty
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复deviceSerialNumber为空时从数据库获取不到feature的问题
---
src/device/fingerprint/fp-zk-device.cpp | 1 +
src/feature-db.cpp | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/device/fingerprint/fp-zk-device.cpp b/src/device/fingerprint/fp-zk-device.cpp
index 4d8abc0..16ceb37 100644
--- a/src/device/fingerprint/fp-zk-device.cpp
+++ b/src/device/fingerprint/fp-zk-device.cpp
@@ -398,6 +398,7 @@ QString FPZKDevice::identifyFeature(QByteArray fpTemplate, QStringList featureID
if (saveList.count() == 0)
{
+ KLOG_DEBUG() << "no found feature";
return QString();
}
diff --git a/src/feature-db.cpp b/src/feature-db.cpp
index ee0a4bd..a8aa883 100644
--- a/src/feature-db.cpp
+++ b/src/feature-db.cpp
@@ -92,7 +92,7 @@ bool FeatureDB::addFeature(const QString &featureID, QByteArray feature, DeviceI
query.bindValue(":idVendor", deviceInfo.idVendor);
query.bindValue(":idProduct", deviceInfo.idProduct);
query.bindValue(":deviceType", (int)deviceType);
- query.bindValue(":deviceSerialNumber", deviceSerialNumber);
+ query.bindValue(":deviceSerialNumber", deviceSerialNumber.isEmpty() ? QVariant(QVariant::String) : deviceSerialNumber);
return query.exec();
}
@@ -121,12 +121,19 @@ QByteArray FeatureDB::getFeature(const QString &featureID)
QList<QByteArray> FeatureDB::getFeatures(const QString &idVendor, const QString &idProduct, DeviceType deviceType, const QString &deviceSerialNumber)
{
QSqlQuery query(m_database);
- query.prepare("SELECT feature FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType AND deviceSerialNumber = :serialNumber");
+ QString sql = "SELECT feature FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType";
+ if (!deviceSerialNumber.isEmpty())
+ {
+ sql.append(" AND deviceSerialNumber = :serialNumber");
+ }
+
+ query.prepare(sql);
query.bindValue(":Vid", idVendor);
query.bindValue(":Pid", idProduct);
query.bindValue(":devType", (int)deviceType);
query.bindValue(":serialNumber", deviceSerialNumber);
query.exec();
+
QByteArrayList featuresList;
while (query.next())
{
@@ -153,7 +160,12 @@ QList<QByteArray> FeatureDB::getAllFeatures()
QStringList FeatureDB::getFeatureIDs(const QString &idVendor, const QString &idProduct, DeviceType deviceType, const QString &deviceSerialNumber)
{
QSqlQuery query(m_database);
- query.prepare("SELECT featureID FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType AND deviceSerialNumber = :serialNumber");
+ QString sql = "SELECT featureID FROM feature WHERE idVendor = :Vid AND idProduct = :Pid AND deviceType = :devType";
+ if (!deviceSerialNumber.isEmpty())
+ {
+ sql.append(" AND deviceSerialNumber = :serialNumber");
+ }
+
query.bindValue(":Vid", idVendor);
query.bindValue(":Pid", idProduct);
query.bindValue(":devType", (int)deviceType);
--
2.33.0

View File

@ -1,29 +0,0 @@
From 3fe0189b4bb5cd0d8fb3698dcdf136d5f1a64e8e Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Wed, 24 May 2023 17:40:53 +0800
Subject: [PATCH] fix(mf-iristar-driver):Fix compilation issues with std::
function in lower versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复std::function在低版本的编译问题
---
src/driver/multi-function/mf-iristar-driver.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/driver/multi-function/mf-iristar-driver.cpp b/src/driver/multi-function/mf-iristar-driver.cpp
index 4af8cff..298a0e8 100644
--- a/src/driver/multi-function/mf-iristar-driver.cpp
+++ b/src/driver/multi-function/mf-iristar-driver.cpp
@@ -12,6 +12,7 @@
* Author: luoqing <luoqing@kylinsec.com.cn>
*/
+#include <functional>
#include "mf-iristar-driver.h"
#include <dlfcn.h>
#include <qt5-log-i.h>
--
2.33.0

View File

@ -1,44 +0,0 @@
From aab75172b1f174daf68c401b6e350f994f14fad1 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Mon, 12 Jun 2023 15:23:30 +0800
Subject: [PATCH] fix(ukey):Fix the issue of duplicate binding of the same UKey
device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复同一个UKey设备可以重复绑定的问题
Related #I78P3F
---
src/device/ukey/ukey-ft-device.cpp | 1 +
src/feature-db.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/device/ukey/ukey-ft-device.cpp b/src/device/ukey/ukey-ft-device.cpp
index e8f5070..14f09ef 100644
--- a/src/device/ukey/ukey-ft-device.cpp
+++ b/src/device/ukey/ukey-ft-device.cpp
@@ -210,6 +210,7 @@ ULONG UKeyFTDevice::createContainer(const QString &pin, DEVHANDLE devHandle, HAP
bool UKeyFTDevice::isExistBinding()
{
QStringList featureIDs = FeatureDB::getInstance()->getFeatureIDs(deviceInfo().idVendor, deviceInfo().idProduct, deviceType(), deviceSerialNumber());
+ KLOG_DEBUG() << "Existing Binding featureIDs:" << featureIDs;
for (auto id : featureIDs)
{
FeatureInfo info = FeatureDB::getInstance()->getFeatureInfo(id);
diff --git a/src/feature-db.cpp b/src/feature-db.cpp
index a8aa883..6cf8735 100644
--- a/src/feature-db.cpp
+++ b/src/feature-db.cpp
@@ -166,6 +166,7 @@ QStringList FeatureDB::getFeatureIDs(const QString &idVendor, const QString &idP
sql.append(" AND deviceSerialNumber = :serialNumber");
}
+ query.prepare(sql);
query.bindValue(":Vid", idVendor);
query.bindValue(":Pid", idProduct);
query.bindValue(":devType", (int)deviceType);
--
2.33.0

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,16 +1,12 @@
Name: kiran-authentication-devices
Version: 2.5.1
Release: 5
Version: 2.5.2
Release: 1
Summary: Kiran Authentication Devices
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-mf-iristar-driver-Fix-compilation-issues-with-st.patch
Patch0002: 0001-fix-ukey-Fix-the-issue-where-only-one-ukey-can-be-bo.patch
Patch0003: 0001-fix-feature-db-Fix-the-issue-of-not-obtaining-featur.patch
Patch0004: 0001-fix-ukey-Fix-the-issue-of-duplicate-binding-of-the-s.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -57,8 +53,9 @@ systemctl enable kiran-authentication-devices.service
%{_datadir}/dbus-1/system-services/com.kylinsec.Kiran.AuthDevice.service
%{_sysconfdir}/dbus-1/system.d/com.kylinsec.Kiran.AuthDevice.Device.conf
%{_sysconfdir}/dbus-1/system.d/com.kylinsec.Kiran.AuthDevice.conf
%{_sysconfdir}/kiran-authentication-devices/drivers.conf
%{_sysconfdir}/kiran-authentication-devices/third-party-devices.conf
%{_sysconfdir}/kiran-authentication-devices/driver.conf
%{_sysconfdir}/kiran-authentication-devices/device.conf
%{_sysconfdir}/kiran-authentication-devices/ukey-manager.conf
%{_usr}/lib/systemd/system/kiran-authentication-devices.service
%files devel
@ -68,6 +65,12 @@ systemctl enable kiran-authentication-devices.service
rm -rf ${buildroot}
%changelog
* Wed Jun 28 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.2-1
- KYOS-F: Fixed an issue where fish's UKey device could not Verify on arm machines
- KYOS-F: Remove the context class;
- KYOS-F: ConfigHelper is responsible for obtaining device configuration information based on the id, and DeviceCreator is responsible for creating the device
- KYOS-F: After the vid and pid are obtained, the configuration file is read. The driver name in the configuration file can generate the specific driver object and device object
* Fri Jun 16 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.1-5
- KYOS-F: Fix the issue of duplicate binding of the same UKey device (#I78P3F)