commit
b79c9bc97a
|
@ -41,7 +41,7 @@
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
|
|
||||||
#define UKUI_GREETER "/usr/sbin/ukui-greeter"
|
#define UKUI_GREETER "/usr/sbin/ukui-greeter"
|
||||||
#define UKUI_SCREENSAVER "/usr/bin/ukui-screensaver-dialog"
|
#define UKUI_SCREENSAVER "/usr/bin/ukui-screensaver-backend"
|
||||||
|
|
||||||
#define GREETER_DBUS_PATH "/"
|
#define GREETER_DBUS_PATH "/"
|
||||||
#define GREETER_DBUS_INTERFACE "org.ukui.greeter"
|
#define GREETER_DBUS_INTERFACE "org.ukui.greeter"
|
||||||
|
@ -916,13 +916,13 @@ bool ServiceInterface::sendPassword(QString username,QByteArray password)
|
||||||
rsac.decrypt(password, decryptText, priKey); // 解密
|
rsac.decrypt(password, decryptText, priKey); // 解密
|
||||||
//如果处于登录状态
|
//如果处于登录状态
|
||||||
|
|
||||||
qDebug()<<"sendPassword"<<loginAppList.count();
|
qDebug()<<"sendPassword"<<loginAppList.count()<<loginAppList;
|
||||||
if(loginAppList.contains("lightdm")){
|
if(loginAppList.contains("lightdm")){
|
||||||
qDebug()<<"login:";
|
qDebug()<<"login:";
|
||||||
isFirstLogin = false;
|
isFirstLogin = false;
|
||||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE);
|
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||||
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||||
return sendLoginPassword(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE,username,encryptText);
|
return sendLoginPassword(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||||
}
|
}
|
||||||
|
|
||||||
//处于锁屏状态
|
//处于锁屏状态
|
||||||
|
@ -934,6 +934,14 @@ bool ServiceInterface::sendPassword(QString username,QByteArray password)
|
||||||
return sendLoginPassword(loginAppList.value(username),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
return sendLoginPassword(loginAppList.value(username),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(loginAppList.count()>0){
|
||||||
|
qDebug()<<"login by screensaver:";
|
||||||
|
isFirstLogin = false;
|
||||||
|
QString publicKey = getLoginPubKey(loginAppList.value(loginAppList.firstKey()),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||||
|
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||||
|
return sendLoginPassword(loginAppList.value(loginAppList.firstKey()),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||||
|
}
|
||||||
|
|
||||||
//如果是第一次调用,则配置自动登录
|
//如果是第一次调用,则配置自动登录
|
||||||
if(isFirstLogin){
|
if(isFirstLogin){
|
||||||
qDebug()<<"isFirstLogin:";
|
qDebug()<<"isFirstLogin:";
|
||||||
|
@ -965,13 +973,13 @@ bool ServiceInterface::handleFirstSingleLogn(QString username,QByteArray decrypt
|
||||||
qDebug()<<loginAppList.count();
|
qDebug()<<loginAppList.count();
|
||||||
if(loginAppList.contains("lightdm")){
|
if(loginAppList.contains("lightdm")){
|
||||||
isFirstLogin = false;
|
isFirstLogin = false;
|
||||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE);
|
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||||
if(publicKey.isEmpty()){
|
if(publicKey.isEmpty()){
|
||||||
qDebug()<<"get Login PubKey failed!";
|
qDebug()<<"get Login PubKey failed!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||||
return sendLoginPassword(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE,username,encryptText);
|
return sendLoginPassword(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1026,6 @@ bool ServiceInterface::sendLoginPassword(QString service,QString path,QString i
|
||||||
path,
|
path,
|
||||||
interface,
|
interface,
|
||||||
QDBusConnection::systemBus());
|
QDBusConnection::systemBus());
|
||||||
|
|
||||||
QDBusReply<bool> stateReply = iface.call("sendPassword",username,array);
|
QDBusReply<bool> stateReply = iface.call("sendPassword",username,array);
|
||||||
if(!stateReply.isValid()){
|
if(!stateReply.isValid()){
|
||||||
disconnect(connection);
|
disconnect(connection);
|
||||||
|
|
Loading…
Reference in New Issue