summaryrefslogtreecommitdiffstats
path: root/kdesktop
diff options
context:
space:
mode:
Diffstat (limited to 'kdesktop')
-rw-r--r--kdesktop/lock/lockdlg.cc42
-rw-r--r--kdesktop/lock/lockdlg.h2
-rw-r--r--kdesktop/lockeng.cc25
-rw-r--r--kdesktop/lockeng.h1
4 files changed, 64 insertions, 6 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc
index 827495c33..59ad23f28 100644
--- a/kdesktop/lock/lockdlg.cc
+++ b/kdesktop/lock/lockdlg.cc
@@ -43,6 +43,7 @@
#include <tqlistview.h>
#include <tqheader.h>
#include <tqcheckbox.h>
+#include <tqfile.h>
#include <ctype.h>
#include <unistd.h>
@@ -79,7 +80,9 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin)
: TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mPlugin( plugin ),
mCapsLocked(-1),
- mUnlockingFailed(false)
+ mUnlockingFailed(false),
+ validUserCardInserted(false),
+ showInfoMessages(true)
{
init(plugin);
}
@@ -92,7 +95,8 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDat
: TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
mPlugin( plugin ),
mCapsLocked(-1),
- mUnlockingFailed(false)
+ mUnlockingFailed(false),
+ showInfoMessages(true)
{
m_lockStartDT = lockStartDateTime;
init(plugin);
@@ -243,6 +247,7 @@ void PasswordDlg::init(GreeterPluginHandle *plugin)
mTimeoutTimerId = startTimer(PASSDLG_HIDE_TIMEOUT);
connect(tqApp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) );
+ greet->setInfoMessageDisplay(showInfoMessages);
greet->start();
DCOPRef kxkb("kxkb", "kxkb");
@@ -463,9 +468,27 @@ void PasswordDlg::reapVerify()
if (WIFEXITED(status)) {
switch (WEXITSTATUS(status)) {
case AuthOk:
- greet->succeeded();
- accept();
- return;
+ {
+ KUser userinfo;
+ TQString fileName = userinfo.homeDir() + "/.tde_card_login_state";
+ TQFile flagFile(fileName);
+ if (validUserCardInserted) {
+ // Card was likely used to log in
+ if (flagFile.open(IO_WriteOnly)) {
+ flagFile.writeBlock("1\n", 2);
+ flagFile.close();
+ }
+ }
+ else {
+ // Card was not used to log in
+ flagFile.remove();
+ }
+
+ // Signal success
+ greet->succeeded();
+ accept();
+ return;
+ }
case AuthBad:
greet->failed();
mUnlockingFailed = true;
@@ -926,13 +949,22 @@ void PasswordDlg::capsLocked()
}
void PasswordDlg::attemptCardLogin() {
+ // FIXME
+ // pam_pkcs11 is extremely chatty with no apparent way to disable the unwanted messages
+ greet->setInfoMessageDisplay(false);
+
+ validUserCardInserted = true;
greet->start();
greet->next();
}
void PasswordDlg::resetCardLogin() {
+ validUserCardInserted = false;
greet->abort();
greet->start();
+
+ // Restore information message display settings
+ greet->setInfoMessageDisplay(showInfoMessages);
}
#include "lockdlg.moc"
diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h
index 1bcb75671..fb28d53d4 100644
--- a/kdesktop/lock/lockdlg.h
+++ b/kdesktop/lock/lockdlg.h
@@ -94,6 +94,8 @@ class PasswordDlg : public TQDialog, public KGreeterPluginHandler
int mTimeoutTimerId;
int mCapsLocked;
bool mUnlockingFailed;
+ bool validUserCardInserted;
+ bool showInfoMessages;
TQStringList layoutsList;
TQStringList::iterator currLayout;
int sPid, sFd;
diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc
index ceffd73f0..5173916c9 100644
--- a/kdesktop/lockeng.cc
+++ b/kdesktop/lockeng.cc
@@ -176,6 +176,19 @@ SaverEngine::SaverEngine()
cdevice->enableCardMonitoring(true);
}
+ // Check card login status
+ KUser userinfo;
+ TQString fileName = userinfo.homeDir() + "/.tde_card_login_state";
+ TQFile flagFile(fileName);
+ if (flagFile.open(IO_ReadOnly)) {
+ TQTextStream stream(&flagFile);
+ if (stream.readLine().startsWith("1")) {
+ // Card was likely used to log in
+ TQTimer::singleShot(5000, this, SLOT(cardStartupTimeout()));
+ }
+ flagFile.close();
+ }
+
dBusConnect();
}
@@ -204,6 +217,16 @@ SaverEngine::~SaverEngine()
delete m_helperThread;
}
+void SaverEngine::cardStartupTimeout() {
+ if (!mValidCryptoCardInserted) {
+ // Restore saver timeout
+ configure();
+
+ // Force lock
+ lockScreen();
+ }
+}
+
void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) {
TQString login_name = TQString::null;
X509CertificatePtrList certList = cdevice->cardX509Certificates();
@@ -224,7 +247,7 @@ void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice)
KUser user;
if (login_name == user.loginName()) {
mValidCryptoCardInserted = true;
- // Disable saver
+ // Disable saver startup
enable(false);
}
}
diff --git a/kdesktop/lockeng.h b/kdesktop/lockeng.h
index 5eebaa472..11f751db8 100644
--- a/kdesktop/lockeng.h
+++ b/kdesktop/lockeng.h
@@ -143,6 +143,7 @@ private slots:
*/
void enableExports();
void recoverFromHackingAttempt();
+ void cardStartupTimeout();
bool dBusReconnect();