summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/mediamanager
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-08-25 11:21:21 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-10-17 10:48:29 +0800
commitb54fcda719b94c629c11e9b3462f2c9a2c5a9666 (patch)
treeb3541609fd0e5aca04427b1c4ff759a9390c77b9 /tdeioslave/media/mediamanager
parentd34f23f403e82f352e4c5d4e20966bcba2bec8c6 (diff)
downloadtdebase-b54fcda719b94c629c11e9b3462f2c9a2c5a9666.tar.gz
tdebase-b54fcda719b94c629c11e9b3462f2c9a2c5a9666.zip
tdeioslave media: fixed handling of mountable state for encrypted devices.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave/media/mediamanager')
-rw-r--r--tdeioslave/media/mediamanager/halbackend.cpp8
-rw-r--r--tdeioslave/media/mediamanager/medialist.cpp10
-rw-r--r--tdeioslave/media/mediamanager/tdehardwarebackend.cpp23
3 files changed, 29 insertions, 12 deletions
diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp
index e05b5c3e8..6badc33c3 100644
--- a/tdeioslave/media/mediamanager/halbackend.cpp
+++ b/tdeioslave/media/mediamanager/halbackend.cpp
@@ -506,13 +506,13 @@ void HALBackend::setVolumeProperties(Medium* medium)
medium->setEncrypted(true);
char* clearUdi = libhal_volume_crypto_get_clear_volume_udi(m_halContext, halVolume);
- TQString clearUdiString;
+ TQString clearUdiString;
if (clearUdi != NULL) {
kdDebug(1219) << "HALBackend::setVolumeProperties : crypto clear volume avail - " << clearUdi << endl;
halClearVolume = libhal_volume_from_udi(m_halContext, clearUdi);
// ignore if halClearVolume is NULL -> just not unlocked in this case
- clearUdiString = clearUdi;
- libhal_free_string(clearUdi);
+ clearUdiString = clearUdi;
+ libhal_free_string(clearUdi);
}
if (halClearVolume)
@@ -660,8 +660,6 @@ void HALBackend::setVolumeProperties(Medium* medium)
case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
{
medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX);
- medium->setMountable(false);
-
if (libhal_device_get_property_QString(m_halContext, driveUdi.latin1(), "info.product") == "iPod" &&
KProtocolInfo::isKnownProtocol( TQString("ipod") ) )
{
diff --git a/tdeioslave/media/mediamanager/medialist.cpp b/tdeioslave/media/mediamanager/medialist.cpp
index dc0a108d6..b2dd84c60 100644
--- a/tdeioslave/media/mediamanager/medialist.cpp
+++ b/tdeioslave/media/mediamanager/medialist.cpp
@@ -135,7 +135,6 @@ bool MediaList::changeMediumState(const Medium &medium, bool allowNotification)
m->setMountable(medium.isMountable());
if (medium.isMountable())
{
- m->setMountable(true);
m->setDeviceNode(medium.deviceNode());
m->setClearDeviceUdi(medium.clearDeviceUdi());
m->setMountPoint(medium.mountPoint());
@@ -226,6 +225,11 @@ bool MediaList::changeMediumState(const TQString &id,
Medium *medium = m_idMap[id];
+ if (medium->deviceNode().isEmpty() || !medium->isMountable())
+ {
+ return false;
+ }
+
medium->setMountable(true);
medium->setDeviceNode(deviceNode);
medium->setMountPoint(mountPoint);
@@ -267,13 +271,13 @@ bool MediaList::changeMediumState(const TQString &id, bool mounted,
Medium *medium = m_idMap[id];
- medium->setMountable(true);
- medium->setMounted(mounted);
if (medium->deviceNode().isEmpty() || !medium->isMountable())
{
return false;
}
+ medium->setMounted(mounted);
+
if (!mimeType.isEmpty())
{
medium->setMimeType( mimeType );
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
index dc780d455..74180ca9a 100644
--- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
+++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
@@ -452,7 +452,7 @@ void TDEBackend::setVolumeProperties(Medium* medium)
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
- TDEStorageDevice * sdevice = hwdevices->findDiskByUID(medium->id());
+ TDEStorageDevice *sdevice = hwdevices->findDiskByUID(medium->id());
if (!sdevice) {
return;
}
@@ -465,7 +465,15 @@ void TDEBackend::setVolumeProperties(Medium* medium)
medium->setEncrypted(false);
}
- medium->setMountable(true);
+ if (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted) ||
+ sdevice->fileSystemUsage().upper() == "RAID") {
+ // Encrypted disks or device underlying other devices are not mountable
+ medium->setMountable(false);
+ }
+ else {
+ medium->setMountable(true);
+ }
+
medium->setDeviceNode(sdevice->deviceNode());
medium->setMountPoint(sdevice->mountPath());
medium->setFsType(sdevice->fileSystemName());
@@ -785,7 +793,6 @@ void TDEBackend::setVolumeProperties(Medium* medium)
}
if (sdevice->isDiskOfType(TDEDiskDeviceType::MediaDevice)) {
medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX);
- medium->setMountable(false);
if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol(TQString("ipod"))) {
medium->setBaseURL("ipod:/");
medium->setMountable(true);
@@ -829,7 +836,15 @@ bool TDEBackend::setFloppyProperties(Medium* medium)
medium->setEncrypted(false);
}
- medium->setMountable(true);
+ if (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted) ||
+ sdevice->fileSystemUsage().upper() == "RAID") {
+ // Encrypted disks or device underlying other devices are not mountable
+ medium->setMountable(false);
+ }
+ else {
+ medium->setMountable(true);
+ }
+
medium->setDeviceNode(sdevice->deviceNode());
medium->setMountPoint(sdevice->mountPath());
medium->setFsType(sdevice->fileSystemName());