From 8b79083f967ee6de83a04c02a40d6c20d9a980d4 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 29 Apr 2021 10:45:28 +0900 Subject: Fixed FTBFS when building tdelibs/tdebase without tdehw. Signed-off-by: Michele Calgaro --- kdesktop/lock/lockdlg.cpp | 24 ++++++++++++++++++------ kdesktop/lock/lockprocess.cpp | 37 ++++++++++++++++++++++++++++++++----- kdesktop/lock/lockprocess.h | 11 +++++------ kdesktop/lockeng.cpp | 12 ++++++++++-- kdesktop/lockeng.h | 4 ++++ 5 files changed, 69 insertions(+), 19 deletions(-) (limited to 'kdesktop') 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 #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#include +#endif #include #include @@ -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 +#include + +#ifdef __TDE_HAVE_TDEHWLIB +#include +#include +#include +#include +#endif #include "lockprocess.h" #include "lockdlg.h" @@ -34,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -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(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(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(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 - -#include -#include - #include - #include #include #include @@ -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 #include +#include +#ifdef __TDE_HAVE_TDEHWLIB #include - +#include #include #include +#endif #include #include #include #include #include -#include #include #include #include @@ -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 +#ifdef __TDE_HAVE_TDEHWLIB class TDECryptographicCardDevice; +#else +#define TDECryptographicCardDevice void +#endif class DCOPClientTransaction; class TQT_DBusMessage; class TQT_DBusProxy; -- cgit v1.2.1