fix(userid): Error in obtaining user ID for default device
Description: 获取默认设备的用户id错误 Log: 167371 【提权】A用户添加生物识别特征,B用户登录使用A用户进行提权时没有生物识别选项
This commit is contained in:
parent
aabc3792fe
commit
bafd48dc53
|
@ -150,7 +150,10 @@ unsigned LoginOptionsWidget::getLoginOptCount()
|
||||||
DeviceInfoPtr LoginOptionsWidget::getFirstDevInfo()
|
DeviceInfoPtr LoginOptionsWidget::getFirstDevInfo()
|
||||||
{
|
{
|
||||||
DeviceInfoPtr devInfo = nullptr;
|
DeviceInfoPtr devInfo = nullptr;
|
||||||
int nDrvId = m_bioDevices->GetLastDevice(getpwuid(getuid())->pw_name);
|
struct passwd* pwdInfo = getpwuid(m_uid);
|
||||||
|
if (!pwdInfo)
|
||||||
|
return devInfo;
|
||||||
|
int nDrvId = m_bioDevices->GetLastDevice(pwdInfo->pw_name);
|
||||||
if (nDrvId >= 0) {
|
if (nDrvId >= 0) {
|
||||||
qDebug()<<"GetLastDevice:"<<nDrvId;
|
qDebug()<<"GetLastDevice:"<<nDrvId;
|
||||||
DeviceMap::iterator itDevInfo = m_mapDevices.begin();
|
DeviceMap::iterator itDevInfo = m_mapDevices.begin();
|
||||||
|
@ -364,11 +367,16 @@ void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid)
|
||||||
qDebug()<<"deviceInfo:"<<device->device_id;
|
qDebug()<<"deviceInfo:"<<device->device_id;
|
||||||
this->m_curDevInfo = device;
|
this->m_curDevInfo = device;
|
||||||
this->m_uid = uid;
|
this->m_uid = uid;
|
||||||
this->m_strUserName = getpwuid(uid)->pw_name;
|
struct passwd *pwdInfo = getpwuid(uid);
|
||||||
|
if (pwdInfo) {
|
||||||
|
this->m_strUserName = pwdInfo->pw_name;
|
||||||
|
}
|
||||||
this->m_isStopped = false;
|
this->m_isStopped = false;
|
||||||
this->m_curLoginOptType = convertDeviceType(this->m_curDevInfo->biotype);
|
this->m_curLoginOptType = convertDeviceType(this->m_curDevInfo->biotype);
|
||||||
updateUIStatus(true);
|
updateUIStatus(true);
|
||||||
m_bioDevices->SetLastDevice(getpwuid(getuid())->pw_name, this->m_curDevInfo->device_id);
|
if (pwdInfo) {
|
||||||
|
m_bioDevices->SetLastDevice(pwdInfo->pw_name, this->m_curDevInfo->device_id);
|
||||||
|
}
|
||||||
startAuth_();
|
startAuth_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ void MainWindow::onConfigurationChanged(QString key)
|
||||||
|
|
||||||
void MainWindow::restart_bio_identify()
|
void MainWindow::restart_bio_identify()
|
||||||
{
|
{
|
||||||
DeviceInfoPtr device = bioDevices.getDefaultDevice(getuid());
|
DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName));
|
||||||
if(device){
|
if(device){
|
||||||
m_loginOptsWidget->startAuth(device, getUid(userName));
|
m_loginOptsWidget->startAuth(device, getUid(userName));
|
||||||
setMessage(tr("Please enter your password or enroll your fingerprint "));
|
setMessage(tr("Please enter your password or enroll your fingerprint "));
|
||||||
|
@ -744,7 +744,7 @@ void MainWindow::switchAuthMode(Mode mode)
|
||||||
ui->btnBioAuth->hide();
|
ui->btnBioAuth->hide();
|
||||||
|
|
||||||
// if(enableBioAuth && useDoubleAuth){
|
// if(enableBioAuth && useDoubleAuth){
|
||||||
// DeviceInfoPtr device = bioDevices.getDefaultDevice(getuid());
|
// DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName));
|
||||||
// if(device){
|
// if(device){
|
||||||
// widgetBioAuth->startAuth(getUid(userName), device);
|
// widgetBioAuth->startAuth(getUid(userName), device);
|
||||||
// }
|
// }
|
||||||
|
@ -769,7 +769,7 @@ void MainWindow::switchAuthMode(Mode mode)
|
||||||
emit accept(BIOMETRIC_IGNORE);
|
emit accept(BIOMETRIC_IGNORE);
|
||||||
return;
|
return;
|
||||||
} else if(authMode == BIOMETRIC) {
|
} else if(authMode == BIOMETRIC) {
|
||||||
QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(getuid());
|
QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid);
|
||||||
//如果默认设备为空的话,第一次不启动生物识别认证
|
//如果默认设备为空的话,第一次不启动生物识别认证
|
||||||
if(strDeviceName.isEmpty() && !m_deviceInfo)
|
if(strDeviceName.isEmpty() && !m_deviceInfo)
|
||||||
{
|
{
|
||||||
|
@ -799,7 +799,7 @@ void MainWindow::switchAuthMode(Mode mode)
|
||||||
|
|
||||||
if(enableBioAuth) {
|
if(enableBioAuth) {
|
||||||
qDebug() << "enable biometric authenticaion";
|
qDebug() << "enable biometric authenticaion";
|
||||||
QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(getuid());
|
QString strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid);
|
||||||
//如果默认设备为空的话,第一次不启动生物识别认证
|
//如果默认设备为空的话,第一次不启动生物识别认证
|
||||||
if(strDeviceName.isEmpty() && !m_deviceInfo)
|
if(strDeviceName.isEmpty() && !m_deviceInfo)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue