From 37b6d0d80ff63156326d46ba1e0a19f3b7c02e5b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 2 Oct 2015 19:58:14 -0500 Subject: Fix cryptographic card login process --- tdm/kfrontend/kgreeter.cpp | 19 +++++++++++++------ tdm/kfrontend/kgverify.cpp | 17 +++++++++++++++++ tdm/kfrontend/kgverify.h | 4 ++++ 3 files changed, 34 insertions(+), 6 deletions(-) (limited to 'tdm') 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 + +#include +#include + #include #include #include @@ -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 { -- cgit v1.2.3