Branch: master

4238dc9c 2015-09-13 17:02:45 Timothy Pearson
Fix FTBFS when ancient versions of cryptsetup are used
M tdecore/tdehw/tdestoragedevice.cpp
diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp
index 618a29c..781c088 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -29,18 +29,22 @@
 #include <tqpixmap.h>
 #include <tqfile.h>
 
-#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 <libcryptsetup.h>
+	#ifndef CRYPT_SLOT_INACTIVE
+		#define CRYPTSETUP_OLD_API
+	#endif
 #endif
 
 // uDisks2 integration
@@ -98,6 +102,9 @@
 
 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 @@
 		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 @@
 		}
 	}
 #endif
+#endif
 }
 
 void TDEStorageDevice::cryptSetOperationsUnlockPassword(TQByteArray password) {