diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-10-02 19:58:14 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-10-02 19:58:14 -0500 |
commit | 37b6d0d80ff63156326d46ba1e0a19f3b7c02e5b (patch) | |
tree | cb73e51e4ec907e2721bbdc305d7d0024c21ded1 | |
parent | 48cf3058c5543a65026cb1cc9d8fc7450c4ccc68 (diff) | |
download | tdebase-37b6d0d80ff63156326d46ba1e0a19f3b7c02e5b.tar.gz tdebase-37b6d0d80ff63156326d46ba1e0a19f3b7c02e5b.zip |
Fix cryptographic card login process
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 31 | ||||
-rw-r--r-- | tdm/kfrontend/kgreeter.cpp | 19 | ||||
-rw-r--r-- | tdm/kfrontend/kgverify.cpp | 17 | ||||
-rw-r--r-- | tdm/kfrontend/kgverify.h | 4 | ||||
-rw-r--r-- | tdmlib/kgreet_classic.cpp | 2 |
5 files changed, 56 insertions, 17 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 677b4129f..8202a7f68 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -546,9 +546,24 @@ void PasswordDlg::handleVerify() // Reset password entry and change text greet->start(); greet->textPrompt( arr, false, false ); + // Force relayout setFixedSize( sizeHint().width(), sizeHint().height() + 1 ); setFixedSize( sizeHint() ); + + // Check if cryptographic card login is being used + if (mCardLoginInProgress) { + // Attempt authentication if configured + TDECryptographicCardDevice* cdevice = static_cast<LockProcess*>(parent())->cryptographicCardDevice(); + if (cdevice) { + TQString autoPIN = cdevice->autoPIN(); + if (autoPIN != TQString::null) { + greet->setPassword(autoPIN); + TQTimer::singleShot(0, this, SLOT(slotOK())); + } + } + mCardLoginInProgress = false; + } } else { greet->textPrompt( arr, false, false ); @@ -971,21 +986,17 @@ void PasswordDlg::attemptCardLogin() { 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->start(); - greet->setPassword(autoPIN); - TQTimer::singleShot(0, this, SLOT(slotOK())); - } - } + // Bypass initial password prompt + greet->start(); + greet->setPassword(""); + TQTimer::singleShot(0, this, SLOT(slotOK())); } void PasswordDlg::resetCardLogin() { validUserCardInserted = false; greet->abort(); + greet->clear(); + greet->revive(); greet->start(); greet->setPasswordPrompt(TQString::null); diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp index e14e58491..3fdbc6042 100644 --- a/tdm/kfrontend/kgreeter.cpp +++ b/tdm/kfrontend/kgreeter.cpp @@ -869,6 +869,12 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { } if (login_name != "") { + if (verify->cardLoginInProgress) { + return; + } + verify->cardLoginInProgress = true; + verify->cardLoginDevice = cdevice; + DM dm; SessList sess; bool vt_active = false; @@ -903,12 +909,10 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { cardLoginUser = login_name; verify->setPasswordPrompt(i18n("PIN:")); - TQString autoPIN = cdevice->autoPIN(); - if (autoPIN != TQString::null) { - // Initiate login - verify->setPassword(autoPIN); - verify->accept(); - } + // Bypass initial password prompt + verify->start(); + verify->setPassword(""); + verify->accept(); } } } @@ -921,6 +925,9 @@ void KGreeter::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { // Restore information message display settings verify->setInfoMessageDisplay(showInfoMessages); + + verify->cardLoginInProgress = false; + verify->cardLoginDevice = NULL; } KStdGreeter::KStdGreeter() diff --git a/tdm/kfrontend/kgverify.cpp b/tdm/kfrontend/kgverify.cpp index 6e6b685db..a3464a5b7 100644 --- a/tdm/kfrontend/kgverify.cpp +++ b/tdm/kfrontend/kgverify.cpp @@ -32,6 +32,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "themer/tdmitem.h" #include "themer/tdmlabel.h" +#include <ksslcertificate.h> + +#include <tdehardwaredevices.h> +#include <tdecryptographiccarddevice.h> + #include <tdeapplication.h> #include <tdelocale.h> #include <klibloader.h> @@ -93,6 +98,8 @@ KGVerify::KGVerify(KGVerifyHandler *_handler, KdmThemer *_themer, , isClear(true) , inGreeterPlugin(false) , abortRequested(false) + , cardLoginInProgress(false) + , cardLoginDevice(NULL) { connect( &timer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()) ); connect( kapp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) ); @@ -654,6 +661,16 @@ KGVerify::handleVerify() inGreeterPlugin = true; greet->textPrompt(msg, echo, ndelay); inGreeterPlugin = !ndelay; + + if (cardLoginInProgress) { + TQString autoPIN = cardLoginDevice->autoPIN(); + if (autoPIN != TQString::null) { + // Initiate login + setPassword(autoPIN); + accept(); + } + cardLoginInProgress = false; + } } else { inGreeterPlugin = true; diff --git a/tdm/kfrontend/kgverify.h b/tdm/kfrontend/kgverify.h index 2ab3ff37b..9935459be 100644 --- a/tdm/kfrontend/kgverify.h +++ b/tdm/kfrontend/kgverify.h @@ -77,6 +77,7 @@ class TQPopupMenu; class TQTimer; class KPushButton; class KLibrary; +class TDECryptographicCardDevice; struct GreeterPluginHandle { KLibrary *library; @@ -180,6 +181,9 @@ class KGVerify : public TQObject, public KGreeterPluginHandler { virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text ); static TQVariant getConf( void *ctx, const char *key, const TQVariant &dflt ); + + bool cardLoginInProgress; + TDECryptographicCardDevice* cardLoginDevice; }; class KGStdVerify : public KGVerify { diff --git a/tdmlib/kgreet_classic.cpp b/tdmlib/kgreet_classic.cpp index 24fe32ede..bb968d4c1 100644 --- a/tdmlib/kgreet_classic.cpp +++ b/tdmlib/kgreet_classic.cpp @@ -307,7 +307,7 @@ KClassicGreeter::textMessage( const char *text, bool err ) return true; } if ((!err && ((TQString(text).lower().find("smartcard") >= 0) || (TQString(text).lower().find("smart card") >= 0))) - ||(err && (TQString(text).lower().find(" 2306:") >= 0))) { + || (err && (TQString(text).lower().find(" 2306:") >= 0)) || (err && (TQString(text).lower().find("PKINIT") >= 0))) { // FIXME // pam_pkcs11 is extremely chatty, even with no card inserted, // and there is no apparent way to disable the unwanted messages! |