summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-14 22:05:38 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-14 22:05:38 +0000
commite81d6b084c909f249cf398b3112a99fad0e91ac8 (patch)
tree3a0189e5d885285f6ed1cb7b22759ea96e3c0ce3
parent082f536b5bfcf71bec5e04b940328de7894f4513 (diff)
downloadtdebase-e81d6b084c909f249cf398b3112a99fad0e91ac8.tar.gz
tdebase-e81d6b084c909f249cf398b3112a99fad0e91ac8.zip
Add a new intrusion detection feature to kdesktop_lock
When enabled the date and time of the last screen lock is shown before login git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1258934 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kdesktop/kdesktop.kcfg7
-rw-r--r--kdesktop/lock/lockdlg.cc53
-rw-r--r--kdesktop/lock/lockdlg.h4
-rw-r--r--kdesktop/lock/lockprocess.cc5
-rw-r--r--kdesktop/lock/lockprocess.h1
5 files changed, 62 insertions, 8 deletions
diff --git a/kdesktop/kdesktop.kcfg b/kdesktop/kdesktop.kcfg
index cd1c8e491..bf74c5f3b 100644
--- a/kdesktop/kdesktop.kcfg
+++ b/kdesktop/kdesktop.kcfg
@@ -318,6 +318,13 @@
<!-- /home/paco/cvsroot/kdebase/kdesktop/lock/lockprocess.cc:336 -->
<!-- mSaver = config.readEntry("UseTDESAK"); -->
</entry>
+ <entry key="ShowLockDateTime" type="Bool">
+ <default>true</default>
+ <label></label>
+ <whatsthis>Set to true to enable display of the date and time of desktop lock as an additional intrusion detection measure</whatsthis>
+ <!-- /home/paco/cvsroot/kdebase/kdesktop/lock/lockprocess.cc:336 -->
+ <!-- mSaver = config.readEntry("ShowLockDateTime"); -->
+ </entry>
<entry key="DelaySaverStart" type="Bool">
<default>true</default>
<label></label>
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc
index a13a80297..1cec74e2c 100644
--- a/kdesktop/lock/lockdlg.cc
+++ b/kdesktop/lock/lockdlg.cc
@@ -79,6 +79,25 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin)
mCapsLocked(-1),
mUnlockingFailed(false)
{
+ init(plugin);
+}
+
+//
+// Simple dialog for entering a password.
+// This version includes support for displaying the date and time the lock process was started
+//
+PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime)
+ : TQDialog(parent, "password dialog", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM))),
+ mPlugin( plugin ),
+ mCapsLocked(-1),
+ mUnlockingFailed(false)
+{
+ m_lockStartDT = lockStartDateTime;
+ init(plugin);
+}
+
+void PasswordDlg::init(GreeterPluginHandle *plugin)
+{
dialogHideTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000;
if (trinity_desktop_lock_use_system_modal_dialogs) {
@@ -115,6 +134,11 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin)
i18n("<nobr><b>The session was locked by %1</b><br>").arg( user.fullName() ), frame );
}
+ TQLabel *lockDTLabel;
+ if ((trinity_desktop_lock_use_system_modal_dialogs) && (!m_lockStartDT.isNull())) {
+ lockDTLabel = new TQLabel(i18n("This session has been locked since %1").arg(m_lockStartDT.toString()), frame);
+ }
+
mStatusLabel = new TQLabel( "<b> </b>", frame );
mStatusLabel->tqsetAlignment( TQLabel::AlignCenter );
@@ -148,13 +172,25 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin)
if (trinity_desktop_lock_use_system_modal_dialogs) {
KSMModalDialogHeader* theader = new KSMModalDialogHeader( frame );
- frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
- frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop );
- frameLayout->addWidget( greetLabel, 1, 1 );
- frameLayout->addItem( greet->getLayoutItem(), 2, 1 );
- frameLayout->addLayout( layStatus, 3, 1 );
- frameLayout->addMultiCellWidget( sep, 4, 4, 0, 1 );
- frameLayout->addMultiCellLayout( layButtons, 5, 5, 0, 1 );
+ if (!m_lockStartDT.isNull()) {
+ frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
+ frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop );
+ frameLayout->addWidget( greetLabel, 1, 1 );
+ frameLayout->addWidget( lockDTLabel, 2, 1 );
+ frameLayout->addItem( greet->getLayoutItem(), 3, 1 );
+ frameLayout->addLayout( layStatus, 4, 1 );
+ frameLayout->addMultiCellWidget( sep, 5, 5, 0, 1 );
+ frameLayout->addMultiCellLayout( layButtons, 6, 6, 0, 1 );
+ }
+ else {
+ frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
+ frameLayout->addMultiCellWidget( theader, 0, 0, 0, 2, Qt::AlignTop );
+ frameLayout->addWidget( greetLabel, 1, 1 );
+ frameLayout->addItem( greet->getLayoutItem(), 2, 1 );
+ frameLayout->addLayout( layStatus, 3, 1 );
+ frameLayout->addMultiCellWidget( sep, 4, 4, 0, 1 );
+ frameLayout->addMultiCellLayout( layButtons, 5, 5, 0, 1 );
+ }
}
else {
frameLayout = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
@@ -242,16 +278,19 @@ void PasswordDlg::updateLabel()
{
mStatusLabel->setPaletteForegroundColor(Qt::black);
mStatusLabel->setText(i18n("<b>Unlocking failed</b>"));
+// mStatusLabel->show();
}
else
if (mCapsLocked)
{
mStatusLabel->setPaletteForegroundColor(Qt::red);
mStatusLabel->setText(i18n("<b>Warning: Caps Lock on</b>"));
+// mStatusLabel->show();
}
else
{
mStatusLabel->setText("<b> </b>");
+// mStatusLabel->hide();
}
}
diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h
index f65e93c23..2ede5a4fa 100644
--- a/kdesktop/lock/lockdlg.h
+++ b/kdesktop/lock/lockdlg.h
@@ -13,6 +13,7 @@
#include <tqdialog.h>
#include <tqstringlist.h>
+#include <tqdatetime.h>
#include "lockprocess.h"
@@ -35,7 +36,9 @@ class PasswordDlg : public TQDialog, public KGreeterPluginHandler
public:
PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin);
+ PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDateTime lockStartDateTime);
~PasswordDlg();
+ void init(GreeterPluginHandle *plugin);
virtual void show();
// from KGreetPluginHandler
@@ -91,6 +94,7 @@ private:
TQStringList::iterator currLayout;
int sPid, sFd;
TQListView *lv;
+ TQDateTime m_lockStartDT;
};
#endif
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 827ea6b21..f4c22b863 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -157,6 +157,7 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
child_saver(child),
mParent(0),
mUseBlankOnly(useBlankOnly),
+ mShowLockDateTime(false),
mSuspended(false),
mVisibility(false),
mRestoreXF86Lock(false),
@@ -184,6 +185,8 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
setupSignals();
setupPipe();
+ mShowLockDateTime = KDesktopSettings::showLockDateTime();
+
kapp->installX11EventFilter(this);
mForceContinualLockDisplayTimer = new TQTimer( this );
@@ -1529,7 +1532,7 @@ bool LockProcess::checkPass()
}
showVkbd();
- PasswordDlg passDlg( this, &greetPlugin);
+ PasswordDlg passDlg( this, &greetPlugin, (mShowLockDateTime)?TQDateTime::currentDateTime():TQDateTime());
int ret = execDialog( &passDlg );
hideVkbd();
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index a986d42c4..63291f857 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -138,6 +138,7 @@ private:
TQValueList<int> child_sockets;
int mParent;
bool mUseBlankOnly;
+ bool mShowLockDateTime;
bool mSuspended;
TQTimer mSuspendTimer;
bool mVisibility;