summaryrefslogtreecommitdiffstats
path: root/tdmlib
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 /tdmlib
parent46d9df235b2b98b057e2bc9719b7d3416bd5438f (diff)
downloadtdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.tar.gz
tdebase-9ea67803526cec0439175b8dc2ee5f0e7b87bc89.zip
Stabilize cryptographic card login
Fix some coding style issues
Diffstat (limited to 'tdmlib')
-rw-r--r--tdmlib/dmctl.h28
-rw-r--r--tdmlib/kgreet_classic.cpp19
-rw-r--r--tdmlib/kgreet_classic.h3
-rw-r--r--tdmlib/kgreet_pam.cpp28
-rw-r--r--tdmlib/kgreet_pam.h3
-rw-r--r--tdmlib/kgreet_winbind.cpp13
-rw-r--r--tdmlib/kgreet_winbind.h3
-rw-r--r--tdmlib/kgreeterplugin.h7
8 files changed, 77 insertions, 27 deletions
diff --git a/tdmlib/dmctl.h b/tdmlib/dmctl.h
index 90928e2e3..e0cdc966c 100644
--- a/tdmlib/dmctl.h
+++ b/tdmlib/dmctl.h
@@ -39,27 +39,33 @@ public:
DM();
~DM();
- enum { Unknown, NoDM, NewTDM, OldTDM, GDM };
+ enum {
+ Unknown,
+ NoDM,
+ NewTDM,
+ OldTDM,
+ GDM
+ };
bool canShutdown();
- void shutdown( TDEApplication::ShutdownType shutdownType,
- TDEApplication::ShutdownMode shutdownMode,
- const TQString &bootOption = TQString::null );
+ void shutdown(TDEApplication::ShutdownType shutdownType,
+ TDEApplication::ShutdownMode shutdownMode,
+ const TQString &bootOption = TQString::null);
- void setLock( bool on );
+ void setLock(bool on);
bool isSwitchable();
int numReserve();
void startReserve();
- bool localSessions( SessList &list );
- bool switchVT( int vt );
- void lockSwitchVT( int vt );
+ bool localSessions(SessList &list);
+ bool switchVT(int vt);
+ void lockSwitchVT(int vt);
int activeVT();
- bool bootOptions( TQStringList &opts, int &dflt, int &curr );
+ bool bootOptions(TQStringList &opts, int &dflt, int &curr);
- static TQString sess2Str( const SessEnt &se );
- static void sess2Str2( const SessEnt &se, TQString &user, TQString &loc );
+ static TQString sess2Str(const SessEnt &se);
+ static void sess2Str2(const SessEnt &se, TQString &user, TQString &loc);
int type();
diff --git a/tdmlib/kgreet_classic.cpp b/tdmlib/kgreet_classic.cpp
index 6aac4d96a..5b8f51d2b 100644
--- a/tdmlib/kgreet_classic.cpp
+++ b/tdmlib/kgreet_classic.cpp
@@ -66,7 +66,8 @@ KClassicGreeter::KClassicGreeter( KGreeterPluginHandler *_handler,
ctx( _ctx ),
exp( -1 ),
pExp( -1 ),
- running( false )
+ running( false ),
+ suppressInfoMsg(false)
{
KdmItem *user_entry = 0, *pw_entry = 0;
grid = 0;
@@ -246,6 +247,10 @@ KClassicGreeter::setEnabled( bool enable )
passwdEdit->setFocus();
}
+void KClassicGreeter::setInfoMessageDisplay(bool enable) {
+ suppressInfoMsg = !enable;
+}
+
void // private
KClassicGreeter::returnData()
{
@@ -276,8 +281,18 @@ bool // virtual
KClassicGreeter::textMessage( const char *text, bool err )
{
if (!err &&
- TQString( text ).find( TQRegExp( "^Changing password for [^ ]+$" ) ) >= 0)
+ TQString( text ).find( TQRegExp( "^Changing password for [^ ]+$" ) ) >= 0) {
+ return true;
+ }
+ if (!err && suppressInfoMsg) {
return true;
+ }
+ if (!err && ((TQString(text).lower().find("smartcard") >= 0) || (TQString(text).lower().find("smart card") >= 0))) {
+ // FIXME
+ // pam_pkcs11 is extremely chatty, even with no card inserted,
+ // and there is no apparent way to disable the unwanted messages!
+ return true;
+ }
return false;
}
diff --git a/tdmlib/kgreet_classic.h b/tdmlib/kgreet_classic.h
index 78bacf50d..4f023db02 100644
--- a/tdmlib/kgreet_classic.h
+++ b/tdmlib/kgreet_classic.h
@@ -53,6 +53,7 @@ class KClassicGreeter : public TQObject, public KGreeterPlugin {
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
virtual void setEnabled( bool on );
+ virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
virtual void textPrompt( const char *prompt, bool echo, bool nonBlocking );
virtual bool binaryPrompt( const char *prompt, bool nonBlocking );
@@ -85,7 +86,7 @@ class KClassicGreeter : public TQObject, public KGreeterPlugin {
Context ctx;
TQGridLayout* grid;
int exp, pExp, has;
- bool running, authTok;
+ bool running, authTok, suppressInfoMsg;
};
#endif /* KGREET_CLASSIC_H */
diff --git a/tdmlib/kgreet_pam.cpp b/tdmlib/kgreet_pam.cpp
index 97d19afde..7fcfafc8b 100644
--- a/tdmlib/kgreet_pam.cpp
+++ b/tdmlib/kgreet_pam.cpp
@@ -88,7 +88,8 @@ KPamGreeter::KPamGreeter( KGreeterPluginHandler *_handler,
ctx( _ctx ),
exp( -1 ),
pExp( -1 ),
- running( false )
+ running( false ),
+ suppressInfoMsg(false)
{
ctx = Login;
@@ -287,6 +288,10 @@ KPamGreeter::setEnabled(bool enable)
authEdit[0]->setFocus();
}
+void KPamGreeter::setInfoMessageDisplay(bool enable) {
+ suppressInfoMsg = !enable;
+}
+
void // private
KPamGreeter::returnData()
{
@@ -319,17 +324,22 @@ KPamGreeter::returnData()
bool // virtual
KPamGreeter::textMessage( const char *text, bool err )
{
- kg_debug(" ************** textMessage(%s, %d)\n", text, err);
+ kg_debug(" ************** textMessage(%s, %d)\n", text, err);
- if (!authEdit.size())
- return false;
+ if (!authEdit.size()) {
+ return false;
+ }
- if (getLayoutItem()) {
- TQLabel* label = new TQLabel(TQString::fromUtf8(text), m_parentWidget);
- getLayoutItem()->addWidget(label, state+1, 0, 0);
- }
+ if (!err && suppressInfoMsg) {
+ return true;
+ }
- return true;
+ if (getLayoutItem()) {
+ TQLabel* label = new TQLabel(TQString::fromUtf8(text), m_parentWidget);
+ getLayoutItem()->addWidget(label, state+1, 0, 0);
+ }
+
+ return true;
}
void // virtual
diff --git a/tdmlib/kgreet_pam.h b/tdmlib/kgreet_pam.h
index 7772880a1..79e92b33a 100644
--- a/tdmlib/kgreet_pam.h
+++ b/tdmlib/kgreet_pam.h
@@ -53,6 +53,7 @@ class KPamGreeter : public TQObject, public KGreeterPlugin {
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
virtual void setEnabled( bool on );
+ virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
virtual void textPrompt( const char *prompt, bool echo, bool nonBlocking );
virtual bool binaryPrompt( const char *prompt, bool nonBlocking );
@@ -89,7 +90,7 @@ class KPamGreeter : public TQObject, public KGreeterPlugin {
Context ctx;
int exp, pExp, has;
unsigned state;
- bool running, authTok;
+ bool running, authTok, suppressInfoMsg;
};
#endif /* KGREET_CLASSIC_H */
diff --git a/tdmlib/kgreet_winbind.cpp b/tdmlib/kgreet_winbind.cpp
index 53b992fa6..1efd170ba 100644
--- a/tdmlib/kgreet_winbind.cpp
+++ b/tdmlib/kgreet_winbind.cpp
@@ -74,7 +74,8 @@ KWinbindGreeter::KWinbindGreeter( KGreeterPluginHandler *_handler,
ctx( _ctx ),
exp( -1 ),
pExp( -1 ),
- running( false )
+ running( false ),
+ suppressInfoMsg(false)
{
KdmItem *user_entry = 0, *pw_entry = 0, *domain_entry = 0;
TQGridLayout *grid = 0;
@@ -323,6 +324,10 @@ KWinbindGreeter::setEnabled( bool enable )
passwdEdit->setFocus();
}
+void KWinbindGreeter::setInfoMessageDisplay(bool enable) {
+ suppressInfoMsg = !enable;
+}
+
void // private
KWinbindGreeter::returnData()
{
@@ -352,8 +357,12 @@ bool // virtual
KWinbindGreeter::textMessage( const char *text, bool err )
{
if (!err &&
- TQString( text ).find( TQRegExp( "^Changing password for [^ ]+$" ) ) >= 0)
+ TQString( text ).find( TQRegExp( "^Changing password for [^ ]+$" ) ) >= 0) {
return true;
+ }
+ if (!err && suppressInfoMsg) {
+ return true;
+ }
return false;
}
diff --git a/tdmlib/kgreet_winbind.h b/tdmlib/kgreet_winbind.h
index 8c41ca5d7..e21fce35b 100644
--- a/tdmlib/kgreet_winbind.h
+++ b/tdmlib/kgreet_winbind.h
@@ -57,6 +57,7 @@ class KWinbindGreeter : public TQObject, public KGreeterPlugin {
virtual void lockUserEntry( const bool lock );
virtual void setPassword( const TQString &pass );
virtual void setEnabled( bool on );
+ virtual void setInfoMessageDisplay( bool on );
virtual bool textMessage( const char *message, bool error );
virtual void textPrompt( const char *prompt, bool echo, bool nonBlocking );
virtual bool binaryPrompt( const char *prompt, bool nonBlocking );
@@ -96,7 +97,7 @@ class KWinbindGreeter : public TQObject, public KGreeterPlugin {
Function func;
Context ctx;
int exp, pExp, has;
- bool running, authTok;
+ bool running, authTok, suppressInfoMsg;
};
#endif /* KGREET_WINBIND_H */
diff --git a/tdmlib/kgreeterplugin.h b/tdmlib/kgreeterplugin.h
index 4604a6aac..029da236c 100644
--- a/tdmlib/kgreeterplugin.h
+++ b/tdmlib/kgreeterplugin.h
@@ -171,6 +171,13 @@ public:
virtual void setEnabled( bool on ) = 0;
/**
+ * En-/disable display of informational messages
+ * The default is to display all informational messages
+ * @param on the state to set
+ */
+ virtual void setInfoMessageDisplay( bool on ) = 0;
+
+ /**
* Called when a message from the authentication backend arrives.
* @param message the message received from the backend
* @param error if true, @p message is an error message, otherwise it's