summaryrefslogtreecommitdiffstats
path: root/tdm/kfrontend
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-18 15:54:06 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-18 15:54:06 -0500
commit9ea67803526cec0439175b8dc2ee5f0e7b87bc89 (patch)
treeab6d82eb81e1794f99d4665a3b4f99db36a704bb /tdm/kfrontend
parent46d9df235b2b98b057e2bc9719b7d3416bd5438f (diff)
downloadtdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.tar.gz
tdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.zip
Stabilize cryptographic card login
Fix some coding style issues
Diffstat (limited to 'tdm/kfrontend')
-rw-r--r--tdm/kfrontend/kgapp.cpp21
-rw-r--r--tdm/kfrontend/kgreeter.cpp14
-rw-r--r--tdm/kfrontend/kgreeter.h3
-rw-r--r--tdm/kfrontend/kgverify.cpp9
-rw-r--r--tdm/kfrontend/kgverify.h1
5 files changed, 47 insertions, 1 deletions
diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp
index 65e6cf0d..86a67cba 100644
--- a/tdm/kfrontend/kgapp.cpp
+++ b/tdm/kfrontend/kgapp.cpp
@@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#include "sakdlg.h"
+#include <kuser.h>
#include <kprocess.h>
#include <tdecmdlineargs.h>
#include <kcrash.h>
@@ -342,6 +343,7 @@ kg_main( const char *argv0 )
XSetIOErrorHandler( xIOErr );
TQString login_user;
+ TQString login_card_user;
TQString login_session_wm;
Display *dpy = tqt_xdisplay();
@@ -499,6 +501,7 @@ kg_main( const char *argv0 )
Debug( "left event loop\n" );
login_user = static_cast<KGreeter*>(dialog)->curUser;
+ login_card_user = static_cast<KGreeter*>(dialog)->cardLoginUser;
login_session_wm = static_cast<KGreeter*>(dialog)->curWMSession;
if (rslt != ex_greet) {
@@ -522,6 +525,24 @@ kg_main( const char *argv0 )
KGVerify::done();
+ KUser userinfo(login_user);
+ if (userinfo.isValid()) {
+ TQString fileName = userinfo.homeDir() + "/.tde_card_login_state";
+ TQFile flagFile(fileName);
+ if ((login_card_user != TQString::null) && (login_user == login_card_user)) {
+ // Card was likely used to log in
+ if (flagFile.open(IO_WriteOnly)) {
+ flagFile.writeBlock("1\n", 2);
+ fchown(flagFile.handle(), userinfo.uid(), userinfo.gid());
+ flagFile.close();
+ }
+ }
+ else {
+ // Card was not used to log in
+ flagFile.remove();
+ }
+ }
+
if (kbdl) {
kbdl->closeStdin();
kbdl->detach();
diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp
index 945110de..15b32589 100644
--- a/tdm/kfrontend/kgreeter.cpp
+++ b/tdm/kfrontend/kgreeter.cpp
@@ -192,6 +192,7 @@ KGreeter::KGreeter( bool framed )
, prevValid( true )
, needLoad( false )
, themed( framed )
+ , showInfoMessages( true )
, closingDown( false )
{
stsFile = new KSimpleConfig( _stsFile );
@@ -242,6 +243,8 @@ KGreeter::~KGreeter()
}
void KGreeter::cryptographicCardWatcherSetup() {
+ cardLoginUser = TQString::null;
+
// Initialize SmartCard readers
TDEGenericDevice *hwdevice;
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
@@ -892,15 +895,24 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) {
verifySetUser(login_name);
verify->lockUserEntry(true);
+ // FIXME
+ // pam_pkcs11 is extremely chatty with no apparent way to disable the unwanted messages
+ verify->setInfoMessageDisplay(false);
+
// Initiate login
+ cardLoginUser = login_name;
verify->accept();
}
}
}
void KGreeter::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) {
+ cardLoginUser = TQString::null;
verify->lockUserEntry(false);
verify->requestAbort();
+
+ // Restore information message display settings
+ verify->setInfoMessageDisplay(showInfoMessages);
}
KStdGreeter::KStdGreeter()
@@ -1048,6 +1060,7 @@ KStdGreeter::KStdGreeter()
pluginSetup();
+ verify->setInfoMessageDisplay(showInfoMessages);
verify->start();
TQTimer::singleShot(0, this, SLOT(cryptographicCardWatcherSetup()));
@@ -1197,6 +1210,7 @@ KThemedGreeter::KThemedGreeter()
pluginSetup();
+ verify->setInfoMessageDisplay(showInfoMessages);
verify->start();
TQTimer::singleShot(0, this, SLOT(cryptographicCardWatcherSetup()));
diff --git a/tdm/kfrontend/kgreeter.h b/tdm/kfrontend/kgreeter.h
index 793a034d..f715b3a8 100644
--- a/tdm/kfrontend/kgreeter.h
+++ b/tdm/kfrontend/kgreeter.h
@@ -110,7 +110,7 @@ class KGreeter : public KGDialog, public KGVerifyHandler {
void processInputPipeCommand(TQString command);
public:
- TQString curUser, curWMSession, dName;
+ TQString curUser, cardLoginUser, curWMSession, dName;
protected slots:
void cryptographicCardWatcherSetup();
@@ -137,6 +137,7 @@ class KGreeter : public KGDialog, public KGVerifyHandler {
bool prevValid;
bool needLoad;
bool themed;
+ bool showInfoMessages;
static int curPlugin;
static PluginList pluginList;
diff --git a/tdm/kfrontend/kgverify.cpp b/tdm/kfrontend/kgverify.cpp
index a25fac8b..cc20d54e 100644
--- a/tdm/kfrontend/kgverify.cpp
+++ b/tdm/kfrontend/kgverify.cpp
@@ -287,6 +287,14 @@ KGVerify::setPassword( const TQString &pass )
}
void
+KGVerify::setInfoMessageDisplay(bool on)
+{
+ // assert( fixedEntity.isEmpty() );
+ Debug( "%s->setInfoMessageDisplay(%\"s)\n", pName.data(), on );
+ greet->setInfoMessageDisplay(on);
+}
+
+void
KGVerify::start()
{
authTok = (func == KGreeterPlugin::ChAuthTok);
@@ -383,6 +391,7 @@ KGVerify::doReject( bool initial )
void // not a slot - called manually by greeter
KGVerify::reject()
{
+ inGreeterPlugin = false;
doReject( true );
}
diff --git a/tdm/kfrontend/kgverify.h b/tdm/kfrontend/kgverify.h
index 3cd22b6c..278cc0dd 100644
--- a/tdm/kfrontend/kgverify.h
+++ b/tdm/kfrontend/kgverify.h
@@ -102,6 +102,7 @@ class KGVerify : public TQObject, public KGreeterPluginHandler {
void setUser( const TQString &user );
void lockUserEntry( const bool lock );
void setPassword( const TQString &pass );
+ void setInfoMessageDisplay( bool on );
/* virtual */ void selectPlugin( int id );
bool entitiesLocal() const;
bool entitiesFielded() const;