diff options
-rw-r--r-- | kdesktop/lock/lockdlg.cpp | 24 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cpp | 37 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 11 | ||||
-rw-r--r-- | kdesktop/lockeng.cpp | 12 | ||||
-rw-r--r-- | kdesktop/lockeng.h | 4 | ||||
-rw-r--r-- | tdm/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tdm/kfrontend/kgreeter.cpp | 20 | ||||
-rw-r--r-- | tdm/kfrontend/kgverify.cpp | 14 | ||||
-rw-r--r-- | tdm/kfrontend/kgverify.h | 4 | ||||
-rw-r--r-- | tdm/kfrontend/sakdlg.cpp | 9 |
10 files changed, 108 insertions, 29 deletions
diff --git a/kdesktop/lock/lockdlg.cpp b/kdesktop/lock/lockdlg.cpp index e8d3c19b7..961442506 100644 --- a/kdesktop/lock/lockdlg.cpp +++ b/kdesktop/lock/lockdlg.cpp @@ -44,7 +44,10 @@ #include <tqlistview.h> #include <tqheader.h> #include <tqcheckbox.h> +#ifdef __TDE_HAVE_TDEHWLIB #include <tqfile.h> +#include <tdecryptographiccarddevice.h> +#endif #include <ctype.h> #include <unistd.h> @@ -99,6 +102,7 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin, TQDat mPlugin( plugin ), mCapsLocked(-1), mUnlockingFailed(false), + validUserCardInserted(false), showInfoMessages(true), mCardLoginInProgress(false) { @@ -477,6 +481,7 @@ void PasswordDlg::reapVerify() switch (WEXITSTATUS(status)) { case AuthOk: { +#ifdef __TDE_HAVE_TDEHWLIB KUser userinfo; TQString fileName = userinfo.homeDir() + "/.tde_card_login_state"; TQFile flagFile(fileName); @@ -491,6 +496,7 @@ void PasswordDlg::reapVerify() // Card was not used to log in flagFile.remove(); } +#endif // Signal success greet->succeeded(); @@ -553,6 +559,7 @@ void PasswordDlg::handleVerify() setFixedSize( sizeHint().width(), sizeHint().height() + 1 ); setFixedSize( sizeHint() ); +#ifdef __TDE_HAVE_TDEHWLIB // Check if cryptographic card login is being used if (mCardLoginInProgress) { // Attempt authentication if configured @@ -566,6 +573,7 @@ void PasswordDlg::handleVerify() } mCardLoginInProgress = false; } +#endif } else { greet->textPrompt( arr, false, false ); @@ -972,7 +980,12 @@ void PasswordDlg::capsLocked() } void PasswordDlg::attemptCardLogin() { -#ifdef HAVE_KRB5 +#ifdef __TDE_HAVE_TDEHWLIB +#ifndef HAVE_KRB5 + // Don't enable card-based logins if Kerberos integration was disabled + return; +#endif + // Make sure card logins are enabled before attempting one KSimpleConfig *systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" )); systemconfig->setGroup(NULL); @@ -982,10 +995,6 @@ void PasswordDlg::attemptCardLogin() { { return; } -#else - // Don't enable card-based logins if Kerberos integration was disabled - return; -#endif if (mCardLoginInProgress) { return; @@ -1007,9 +1016,11 @@ void PasswordDlg::attemptCardLogin() { greet->start(); greet->setPassword(""); TQTimer::singleShot(0, this, SLOT(slotOK())); +#endif } void PasswordDlg::resetCardLogin() { +#ifdef __TDE_HAVE_TDEHWLIB validUserCardInserted = false; greet->abort(); greet->clear(); @@ -1022,9 +1033,10 @@ void PasswordDlg::resetCardLogin() { setFixedSize(sizeHint()); // Restore information message display settings - greet->setInfoMessageDisplay(showInfoMessages); + greet->setInfoMessageDisplay(showInfoMessages); mCardLoginInProgress = false; +#endif } #include "lockdlg.moc" diff --git a/kdesktop/lock/lockprocess.cpp b/kdesktop/lock/lockprocess.cpp index fdde3fc9e..bb68186cb 100644 --- a/kdesktop/lock/lockprocess.cpp +++ b/kdesktop/lock/lockprocess.cpp @@ -17,6 +17,14 @@ //some image will be corrupted). #include <config.h> +#include <tdeglobal.h> + +#ifdef __TDE_HAVE_TDEHWLIB +#include <ksslcertificate.h> +#include <kuser.h> +#include <tdehardwaredevices.h> +#include <tdecryptographiccarddevice.h> +#endif #include "lockprocess.h" #include "lockdlg.h" @@ -34,7 +42,6 @@ #include <tdeapplication.h> #include <kservicegroup.h> #include <kdebug.h> -#include <kuser.h> #include <tdemessagebox.h> #include <tdeglobalsettings.h> #include <tdelocale.h> @@ -291,6 +298,7 @@ LockProcess::LockProcess() } } +#ifdef __TDE_HAVE_TDEHWLIB // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -303,6 +311,7 @@ LockProcess::LockProcess() cdevice->enableCardMonitoring(true); // cdevice->enablePINEntryCallbacks(true); } +#endif #ifdef KEEP_MOUSE_UNGRABBED setEnabled(false); @@ -2823,6 +2832,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) { } void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB TQString login_name = TQString::null; X509CertificatePtrList certList = cdevice->cardX509Certificates(); if (certList.count() > 0) { @@ -2856,9 +2866,11 @@ void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) } } } +#endif } void LockProcess::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg) { passDlg->resetCardLogin(); @@ -2867,9 +2879,12 @@ void LockProcess::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) m_loginCardDevice = NULL; TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); } +#endif } -void LockProcess::signalPassDlgToAttemptCardLogin() { +void LockProcess::signalPassDlgToAttemptCardLogin() +{ +#ifdef __TDE_HAVE_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg && m_loginCardDevice) { passDlg->attemptCardLogin(); @@ -2880,9 +2895,12 @@ void LockProcess::signalPassDlgToAttemptCardLogin() { TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); } } +#endif } -void LockProcess::signalPassDlgToAttemptCardAbort() { +void LockProcess::signalPassDlgToAttemptCardAbort() +{ +#ifdef __TDE_HAVE_TDEHWLIB PasswordDlg* passDlg = dynamic_cast<PasswordDlg*>(currentDialog); if (passDlg) { passDlg->resetCardLogin(); @@ -2893,9 +2911,12 @@ void LockProcess::signalPassDlgToAttemptCardAbort() { TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); } } +#endif } -void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) { +void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) +{ +#ifdef __TDE_HAVE_TDEHWLIB TQCString password; TQString pin_entry; @@ -2911,10 +2932,16 @@ void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographi else { cdevice->setProvidedPin(TQString::null); } +#endif } -TDECryptographicCardDevice* LockProcess::cryptographicCardDevice() { +TDECryptographicCardDevice* LockProcess::cryptographicCardDevice() +{ +#ifdef __TDE_HAVE_TDEHWLIB return m_loginCardDevice; +#else + return NULL; +#endif } void LockProcess::fullyOnline() { diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 4dc2d8bab..ff017b0a1 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -10,13 +10,7 @@ #ifndef __LOCKENG_H__ #define __LOCKENG_H__ -#include <ksslcertificate.h> - -#include <tdehardwaredevices.h> -#include <tdecryptographiccarddevice.h> - #include <kgreeterplugin.h> - #include <kprocess.h> #include <kpixmap.h> #include <krootpixmap.h> @@ -35,6 +29,11 @@ class KLibrary; class KWinModule; class KSMModalDialog; class LockProcess; +#ifdef __TDE_HAVE_TDEHWLIB +class TDECryptographicCardDevice; +#else +#define TDECryptographicCardDevice void +#endif struct GreeterPluginHandle { KLibrary *library; diff --git a/kdesktop/lockeng.cpp b/kdesktop/lockeng.cpp index f02e51440..75c2e5f98 100644 --- a/kdesktop/lockeng.cpp +++ b/kdesktop/lockeng.cpp @@ -11,18 +11,20 @@ #include <stdlib.h> #include <sys/stat.h> +#include <tdeglobal.h> +#ifdef __TDE_HAVE_TDEHWLIB #include <ksslcertificate.h> - +#include <kuser.h> #include <tdehardwaredevices.h> #include <tdecryptographiccarddevice.h> +#endif #include <kstandarddirs.h> #include <tdeapplication.h> #include <kservicegroup.h> #include <ksimpleconfig.h> #include <kdebug.h> -#include <kuser.h> #include <tdelocale.h> #include <tqfile.h> #include <tqtimer.h> @@ -198,6 +200,7 @@ SaverEngine::SaverEngine() delete config; config = NULL; +#ifdef __TDE_HAVE_TDEHWLIB // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -221,6 +224,7 @@ SaverEngine::SaverEngine() } flagFile.close(); } +#endif dBusConnect(); } @@ -261,6 +265,7 @@ void SaverEngine::cardStartupTimeout() { } void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB TQString login_name = TQString::null; X509CertificatePtrList certList = cdevice->cardX509Certificates(); if (certList.count() > 0) { @@ -282,9 +287,11 @@ void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) mValidCryptoCardInserted = true; } } +#endif } void SaverEngine::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB if (mValidCryptoCardInserted) { mValidCryptoCardInserted = false; @@ -294,6 +301,7 @@ void SaverEngine::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) // Force lock lockScreen(); } +#endif } //--------------------------------------------------------------------------- diff --git a/kdesktop/lockeng.h b/kdesktop/lockeng.h index 11f751db8..4d7823ab6 100644 --- a/kdesktop/lockeng.h +++ b/kdesktop/lockeng.h @@ -18,7 +18,11 @@ #include <tqdbusconnection.h> +#ifdef __TDE_HAVE_TDEHWLIB class TDECryptographicCardDevice; +#else +#define TDECryptographicCardDevice void +#endif class DCOPClientTransaction; class TQT_DBusMessage; class TQT_DBusProxy; diff --git a/tdm/CMakeLists.txt b/tdm/CMakeLists.txt index 4d37df766..3a6b6a41b 100644 --- a/tdm/CMakeLists.txt +++ b/tdm/CMakeLists.txt @@ -21,7 +21,7 @@ include( ConfigureChecks.cmake ) add_subdirectory( backend ) add_subdirectory( kfrontend ) -add_subdirectory( cryptocardwatcher ) +tde_conditional_add_subdirectory( WITH_TDEHWLIB cryptocardwatcher ) # systemd if( BUILD_TDM_SYSTEMD_UNIT_FILE AND NOT "${SYSTEMDSYSTEMUNITDIR}" STREQUAL "" ) diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp index cd61aa857..27905e61d 100644 --- a/tdm/kfrontend/kgreeter.cpp +++ b/tdm/kfrontend/kgreeter.cpp @@ -35,10 +35,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <dmctl.h> +#ifdef __TDE_HAVE_TDEHWLIB #include <ksslcertificate.h> - #include <tdehardwaredevices.h> #include <tdecryptographiccarddevice.h> +#endif #include <tdeapplication.h> #include <tdelocale.h> @@ -246,6 +247,7 @@ KGreeter::~KGreeter() void KGreeter::cryptographicCardWatcherSetup() { cardLoginUser = TQString::null; +#ifdef __TDE_HAVE_TDEHWLIB // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -256,6 +258,7 @@ void KGreeter::cryptographicCardWatcherSetup() { connect(cdevice, TQT_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); } +#endif } void KGreeter::done(int r) { @@ -858,7 +861,11 @@ KGreeter::verifySetUser( const TQString &user ) } void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { -#ifdef HAVE_KRB5 +#ifdef __TDE_HAVE_TDEHWLIB +#ifndef HAVE_KRB5 + // Don't enable card-based logins if Kerberos integration was disabled + return; +#endif // Make sure card logins are enabled before attempting one KSimpleConfig *systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" )); systemconfig->setGroup(NULL); @@ -868,10 +875,6 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { { return; } -#else - // Don't enable card-based logins if Kerberos integration was disabled - return; -#endif TQString login_name = TQString::null; X509CertificatePtrList certList = cdevice->cardX509Certificates(); @@ -938,9 +941,11 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { verify->accept(); } } +#endif } void KGreeter::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB cardLoginUser = TQString::null; userView->setEnabled(false); verify->lockUserEntry(false); @@ -952,6 +957,7 @@ void KGreeter::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { verify->cardLoginInProgress = false; verify->cardLoginDevice = NULL; +#endif } KStdGreeter::KStdGreeter() @@ -1332,9 +1338,11 @@ KThemedGreeter::updateStatus( bool fail, bool caps, int timedleft ) } } +#ifdef __TDE_HAVE_TDEHWLIB if (cardLoginUser != TQString::null) { verify->setPasswordPrompt(i18n("PIN:")); } +#endif } void diff --git a/tdm/kfrontend/kgverify.cpp b/tdm/kfrontend/kgverify.cpp index 93bcce27a..d3b0a71b8 100644 --- a/tdm/kfrontend/kgverify.cpp +++ b/tdm/kfrontend/kgverify.cpp @@ -32,10 +32,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "themer/tdmitem.h" #include "themer/tdmlabel.h" -#include <ksslcertificate.h> +#ifdef __TDE_HAVE_TDEHWLIB +#include <ksslcertificate.h> #include <tdehardwaredevices.h> #include <tdecryptographiccarddevice.h> +#endif #include <tdeapplication.h> #include <tdelocale.h> @@ -98,8 +100,10 @@ KGVerify::KGVerify(KGVerifyHandler *_handler, KdmThemer *_themer, , isClear(true) , inGreeterPlugin(false) , abortRequested(false) +#ifdef __TDE_HAVE_TDEHWLIB , cardLoginInProgress(false) , cardLoginDevice(NULL) +#endif { connect( &timer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()) ); connect( kapp, TQT_SIGNAL(activity()), TQT_SLOT(slotActivity()) ); @@ -324,7 +328,11 @@ KGVerify::start() _autoLoginDelay = 0, timeable = false; return; } - else if (!cardLoginInProgress) { + else +#ifdef __TDE_HAVE_TDEHWLIB + if (!cardLoginInProgress) +#endif + { applyPreset(); } } @@ -664,6 +672,7 @@ KGVerify::handleVerify() greet->textPrompt(msg, echo, ndelay); inGreeterPlugin = !ndelay; +#ifdef __TDE_HAVE_TDEHWLIB if (cardLoginInProgress) { TQString autoPIN = cardLoginDevice->autoPIN(); if (autoPIN != TQString::null) { @@ -673,6 +682,7 @@ KGVerify::handleVerify() } cardLoginInProgress = false; } +#endif } else { inGreeterPlugin = true; diff --git a/tdm/kfrontend/kgverify.h b/tdm/kfrontend/kgverify.h index 9935459be..b76cf55f1 100644 --- a/tdm/kfrontend/kgverify.h +++ b/tdm/kfrontend/kgverify.h @@ -77,7 +77,9 @@ class TQPopupMenu; class TQTimer; class KPushButton; class KLibrary; +#ifdef __TDE_HAVE_TDEHWLIB class TDECryptographicCardDevice; +#endif struct GreeterPluginHandle { KLibrary *library; @@ -182,8 +184,10 @@ class KGVerify : public TQObject, public KGreeterPluginHandler { static TQVariant getConf( void *ctx, const char *key, const TQVariant &dflt ); +#ifdef __TDE_HAVE_TDEHWLIB bool cardLoginInProgress; TDECryptographicCardDevice* cardLoginDevice; +#endif }; class KGStdVerify : public KGVerify { diff --git a/tdm/kfrontend/sakdlg.cpp b/tdm/kfrontend/sakdlg.cpp index 3758a4719..52bffc47e 100644 --- a/tdm/kfrontend/sakdlg.cpp +++ b/tdm/kfrontend/sakdlg.cpp @@ -10,10 +10,11 @@ #include <dmctl.h> +#ifdef __TDE_HAVE_TDEHWLIB #include <ksslcertificate.h> - #include <tdehardwaredevices.h> #include <tdecryptographiccarddevice.h> +#endif #include <tdeapplication.h> #include <tdelocale.h> @@ -135,6 +136,7 @@ SAKDlg::SAKDlg(TQWidget *parent) connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited())); mSAKProcess->start(); +#ifdef __TDE_HAVE_TDEHWLIB // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -145,6 +147,7 @@ SAKDlg::SAKDlg(TQWidget *parent) connect(cdevice, TQT_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); } +#endif mControlPipeHandlerThread = new TQEventLoopThread(); mControlPipeHandler = new ControlPipeHandlerObject(); @@ -172,6 +175,7 @@ void SAKDlg::processInputPipeCommand(TQString command) { } void SAKDlg::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB TQString login_name = TQString::null; X509CertificatePtrList certList = cdevice->cardX509Certificates(); if (certList.count() > 0) { @@ -213,10 +217,13 @@ void SAKDlg::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) { closeDialogForced(); } } +#endif } void SAKDlg::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { +#ifdef __TDE_HAVE_TDEHWLIB // +#endif } SAKDlg::~SAKDlg() |