diff options
author | Timothy Pearson <[email protected]> | 2015-09-18 23:01:01 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2015-09-18 23:01:01 -0500 |
commit | 6f5e7b211009bf3a5b6816ee3cb064d7f393dfb9 (patch) | |
tree | e30e480a7524c15acd02901d3e6f0e48a9f6a12b /kdesktop | |
parent | 1ec002a8ee0c9165bedbcb6e273d9bacb0588e47 (diff) | |
download | tdebase-6f5e7b211009bf3a5b6816ee3cb064d7f393dfb9.tar.gz tdebase-6f5e7b211009bf3a5b6816ee3cb064d7f393dfb9.zip |
Streamline cryptographic card logon process
Diffstat (limited to 'kdesktop')
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 26 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 13 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 7 |
3 files changed, 39 insertions, 7 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 59ad23f28..3ae0efaa4 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -276,6 +276,10 @@ void PasswordDlg::init(GreeterPluginHandle *plugin) mLayoutButton->hide(); // no kxkb running } capsLocked(); + + if (static_cast< LockProcess* >(parent())->cryptographicCardDevice()) { + attemptCardLogin(); + } } PasswordDlg::~PasswordDlg() @@ -954,14 +958,32 @@ void PasswordDlg::attemptCardLogin() { greet->setInfoMessageDisplay(false); validUserCardInserted = true; - greet->start(); - greet->next(); + greet->setPasswordPrompt(i18n("PIN:")); + + // Force relayout + setFixedSize(sizeHint().width(), sizeHint().height() + 1); + setFixedSize(sizeHint()); + + // Attempt authentication if configured + TDECryptographicCardDevice* cdevice = static_cast< LockProcess* >(parent())->cryptographicCardDevice(); + if (cdevice) { + TQString autoPIN = cdevice->autoPIN(); + if (autoPIN != TQString::null) { + greet->setPassword(autoPIN); + greet->next(); + } + } } void PasswordDlg::resetCardLogin() { validUserCardInserted = false; greet->abort(); greet->start(); + greet->setPasswordPrompt(TQString::null); + + // Force relayout + setFixedSize(sizeHint().width(), sizeHint().height() + 1); + setFixedSize(sizeHint()); // Restore information message display settings greet->setInfoMessageDisplay(showInfoMessages); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 494852e39..38526d644 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -228,6 +228,7 @@ LockProcess::LockProcess() m_dialogPrevX(0), m_dialogPrevY(0), m_notifyReadyRequested(false), + m_loginCardDevice(NULL), m_maskWidget(NULL), m_saverRootWindow(0) { @@ -300,7 +301,7 @@ LockProcess::LockProcess() for (hwdevice = cardReaderList.first(); hwdevice; hwdevice = cardReaderList.next()) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); // connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); - connect(cdevice, TQT_SIGNAL(cardInserted(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); + connect(cdevice, TQT_SIGNAL(certificateListAvailable(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); connect(cdevice, TQT_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); // cdevice->enablePINEntryCallbacks(true); @@ -2846,6 +2847,7 @@ void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) } // Pass login to the PAM stack... + m_loginCardDevice = cdevice; if (dynamic_cast<SAKDlg*>(currentDialog)) { dynamic_cast<SAKDlg*>(currentDialog)->closeDialogForced(); TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); @@ -2867,17 +2869,18 @@ void LockProcess::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) passDlg->resetCardLogin(); } else { + m_loginCardDevice = NULL; TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); } } void LockProcess::signalPassDlgToAttemptCardLogin() { PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); - if (passDlg) { + if (passDlg && m_loginCardDevice) { passDlg->attemptCardLogin(); } else { - if (currentDialog) { + if (currentDialog && m_loginCardDevice) { // Try again later TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); } @@ -2915,6 +2918,10 @@ void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographi } } +TDECryptographicCardDevice* LockProcess::cryptographicCardDevice() { + return m_loginCardDevice; +} + void LockProcess::fullyOnline() { if (!mFullyOnlineSent) { if (kdesktop_pid > 0) { diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index dafd2ae1c..4dc2d8bab 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -105,6 +105,8 @@ class LockProcess : public TQWidget void msgBox( TQMessageBox::Icon type, const TQString &txt ); int execDialog( TQDialog* dlg ); + TDECryptographicCardDevice* cryptographicCardDevice(); + signals: void terminateHelperThread(); @@ -232,7 +234,7 @@ class LockProcess : public TQWidget bool mInfoMessageDisplayed; bool mDialogControlLock; bool mForceReject; - TQDialog *currentDialog; + TQDialog *currentDialog; TQTimer* mEnsureScreenHiddenTimer; TQTimer* mForceContinualLockDisplayTimer; @@ -250,7 +252,7 @@ class LockProcess : public TQWidget bool mHackActive; TQPixmap backingPixmap; - KRootPixmap *m_rootPixmap; + KRootPixmap *m_rootPixmap; int mBackingStartupDelayTimer; TQPixmap mArgbTransparentBackgroundPixmap; @@ -265,6 +267,7 @@ class LockProcess : public TQWidget int m_dialogPrevY; bool m_notifyReadyRequested; + TDECryptographicCardDevice* m_loginCardDevice; TQWidget* m_maskWidget; Window m_saverRootWindow; |