mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
soliduiserver: warn when the storage device is invalid or insecure
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
5273946d9d
commit
c239ff2ce8
1 changed files with 4 additions and 1 deletions
|
@ -164,10 +164,12 @@ int SolidUiServer::mountUdi(const QString &udi)
|
||||||
Solid::StorageVolume *storagevolume = device.as<Solid::StorageVolume>();
|
Solid::StorageVolume *storagevolume = device.as<Solid::StorageVolume>();
|
||||||
Solid::Block *block = device.as<Solid::Block>();
|
Solid::Block *block = device.as<Solid::Block>();
|
||||||
if (!storagevolume || !block) {
|
if (!storagevolume || !block) {
|
||||||
|
kWarning() << "invalid storage device" << udi;
|
||||||
return int(Solid::ErrorType::InvalidOption);
|
return int(Solid::ErrorType::InvalidOption);
|
||||||
} else if (storagevolume->fsType() == "zfs_member") {
|
} else if (storagevolume->fsType() == "zfs_member") {
|
||||||
// create pool on USB stick, put some bad stuff on it, set mount point to / and watch it
|
// create pool on USB stick, put some bad stuff on it, set mount point to / and watch it
|
||||||
// unfold when mounted
|
// unfold when mounted
|
||||||
|
kWarning() << "storage device is insecure" << udi;
|
||||||
return int(Solid::ErrorType::Insecure);
|
return int(Solid::ErrorType::Insecure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +216,7 @@ int SolidUiServer::mountUdi(const QString &udi)
|
||||||
const QString mountpoint = mountbase + QLatin1Char('/') + deviceuuid;
|
const QString mountpoint = mountbase + QLatin1Char('/') + deviceuuid;
|
||||||
QDir mountdir(mountbase);
|
QDir mountdir(mountbase);
|
||||||
if (!mountdir.exists(mountpoint) && !mountdir.mkdir(mountpoint)) {
|
if (!mountdir.exists(mountpoint) && !mountdir.mkdir(mountpoint)) {
|
||||||
|
kWarning() << "could not create" << mountpoint;
|
||||||
if (didcryptopen) {
|
if (didcryptopen) {
|
||||||
QVariantMap cryptclosearguments;
|
QVariantMap cryptclosearguments;
|
||||||
cryptclosearguments.insert("name", deviceuuid);
|
cryptclosearguments.insert("name", deviceuuid);
|
||||||
|
@ -221,7 +224,6 @@ int SolidUiServer::mountUdi(const QString &udi)
|
||||||
"org.kde.soliduiserver.mountunmounthelper", "cryptclose", cryptclosearguments
|
"org.kde.soliduiserver.mountunmounthelper", "cryptclose", cryptclosearguments
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
kWarning() << "could not create" << mountpoint;
|
|
||||||
return int(Solid::ErrorType::OperationFailed);
|
return int(Solid::ErrorType::OperationFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +244,7 @@ int SolidUiServer::unmountUdi(const QString &udi)
|
||||||
Solid::StorageAccess *storageaccess = device.as<Solid::StorageAccess>();
|
Solid::StorageAccess *storageaccess = device.as<Solid::StorageAccess>();
|
||||||
Solid::StorageVolume *storagevolume = device.as<Solid::StorageVolume>();
|
Solid::StorageVolume *storagevolume = device.as<Solid::StorageVolume>();
|
||||||
if (!storagevolume || !storageaccess) {
|
if (!storagevolume || !storageaccess) {
|
||||||
|
kWarning() << "invalid storage device" << udi;
|
||||||
return int(Solid::ErrorType::InvalidOption);
|
return int(Solid::ErrorType::InvalidOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue