From 4238dc9cea6c543abf993d3a28af564f1c8dea0c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 13 Sep 2015 17:02:45 -0500 Subject: [PATCH] Fix FTBFS when ancient versions of cryptsetup are used --- tdecore/tdehw/tdestoragedevice.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp index 618a29c1b..781c08885 100644 --- a/tdecore/tdehw/tdestoragedevice.cpp +++ b/tdecore/tdehw/tdestoragedevice.cpp @@ -29,18 +29,22 @@ #include #include -#include "tdelocale.h" -#include "tdeglobal.h" -#include "kiconloader.h" -#include "tdetempfile.h" +#include "kdebug.h" +#include "tdelocale.h" +#include "tdeglobal.h" +#include "kiconloader.h" +#include "tdetempfile.h" #include "kstandarddirs.h" -#include "tdehardwaredevices.h" +#include "tdehardwaredevices.h" #include "config.h" #if defined(WITH_CRYPTSETUP) #include + #ifndef CRYPT_SLOT_INACTIVE + #define CRYPTSETUP_OLD_API + #endif #endif // uDisks2 integration @@ -98,6 +102,9 @@ TDEDiskDeviceType::TDEDiskDeviceType TDEStorageDevice::diskType() { void TDEStorageDevice::internalGetLUKSKeySlotStatus() { #if defined(WITH_CRYPTSETUP) +#ifdef CRYPTSETUP_OLD_API + kdWarning() << "TDEStorageDevice: The version of libcryptsetup that TDE was compiled against was too old! Most LUKS features will not function" << endl; +#else unsigned int i; crypt_keyslot_info keyslot_status; TDELUKSKeySlotStatus::TDELUKSKeySlotStatus tde_keyslot_status; @@ -118,10 +125,14 @@ void TDEStorageDevice::internalGetLUKSKeySlotStatus() { m_cryptKeyslotStatus.append(tde_keyslot_status); } #endif +#endif } void TDEStorageDevice::internalInitializeLUKSIfNeeded() { #if defined(WITH_CRYPTSETUP) +#ifdef CRYPTSETUP_OLD_API + kdWarning() << "TDEStorageDevice: The version of libcryptsetup that TDE was compiled against was too old! Most LUKS features will not function" << endl; +#else int ret; if (m_diskType & TDEDiskDeviceType::LUKS) { @@ -158,6 +169,7 @@ void TDEStorageDevice::internalInitializeLUKSIfNeeded() { } } #endif +#endif } void TDEStorageDevice::cryptSetOperationsUnlockPassword(TQByteArray password) {