Compare commits

...

14 Commits

Author SHA1 Message Date
l10n daemon script 077794cabd GIT_SILENT made messages (after extraction) 2021-03-03 09:59:14 +01:00
Heiko Becker 71aa46378f GIT_SILENT Upgrade release service version to 20.12.3. 2021-02-25 00:06:58 +01:00
Oxalica -- 2d397bb2d2 Fix out of bounds read when parsing fstab.
Some fstab files only have 3 fields and mount options are completely omitted.
2021-02-23 21:36:25 +00:00
Andrius Štikonas 00de130889 Add initial support for dosfstools 4.2.
Empty labels are not allowed anymore.
One can reset them with -r flag but that is not supported in older
dosfstools. So for now we just manually set label to NO_LABEL.

BUG: 432941
2021-02-19 17:53:40 +00:00
Heiko Becker 3b87ba9e02 GIT_SILENT Upgrade release service version to 20.12.2. 2021-01-29 20:50:00 +01:00
Andrius Štikonas dc38cb1196 Fix out of bounds read when parsing fstab.
BUG: 429191
2021-01-07 01:39:07 +00:00
Christoph Feck 0c09f40ef7 GIT_SILENT Upgrade release service version to 20.12.1. 2021-01-02 14:31:11 +01:00
l10n daemon script 54f63188ca GIT_SILENT made messages (after extraction) 2020-12-07 08:27:52 +01:00
Christoph Feck cb02376cf6 GIT_SILENT Upgrade release service version to 20.12.0. 2020-12-02 22:55:55 +01:00
Andrius Štikonas 252d55e467 Add a limit on the amount of data that can be passed back via DBus. 2020-11-29 01:09:06 +00:00
Andrius Štikonas 2fb6be4e8d Add a limit on blocksize to prevent out-of-memory situation. 2020-11-29 00:59:16 +00:00
Andrius Štikonas 5ac18b9d8f Do not reuse QProcess object in externalcommandhelper for different invocations. 2020-11-26 22:06:14 +00:00
Andrius Štikonas a0efc8854f Fix division by zero. 2020-11-26 22:00:19 +00:00
Christoph Feck b8692e2f16 GIT_SILENT Upgrade release service version to 20.11.90. 2020-11-25 03:00:28 +01:00
6 changed files with 41 additions and 13 deletions

View File

@ -9,8 +9,8 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
# KDE Application Version, managed by release script # KDE Application Version, managed by release script
set (RELEASE_SERVICE_VERSION_MAJOR "20") set (RELEASE_SERVICE_VERSION_MAJOR "20")
set (RELEASE_SERVICE_VERSION_MINOR "11") set (RELEASE_SERVICE_VERSION_MINOR "12")
set (RELEASE_SERVICE_VERSION_MICRO "80") set (RELEASE_SERVICE_VERSION_MICRO "3")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}") set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(kpmcore VERSION ${RELEASE_SERVICE_VERSION}) project(kpmcore VERSION ${RELEASE_SERVICE_VERSION})

View File

@ -82,10 +82,17 @@ FstabEntryList readFstabEntries( const QString& fstabPath )
// (4) dump frequency (optional, defaults to 0), no comment is allowed if omitted, // (4) dump frequency (optional, defaults to 0), no comment is allowed if omitted,
// (5) pass number (optional, defaults to 0), no comment is allowed if omitted, // (5) pass number (optional, defaults to 0), no comment is allowed if omitted,
// (#) comment (optional). // (#) comment (optional).
// Handle deprecated subtypes, e.g. sshfs#example. They are not relevant for partitioning, ignore them.
if (splitLine.size() < 3) {
continue;
}
auto fsSpec = splitLine.at(0); auto fsSpec = splitLine.at(0);
auto mountPoint = unescapeSpaces(splitLine.at(1)); auto mountPoint = unescapeSpaces(splitLine.at(1));
auto fsType = splitLine.at(2); auto fsType = splitLine.at(2);
auto options = splitLine.at(3); // Options may be omitted in some rare cases like NixOS generated fstab.
auto options = splitLine.length() >= 4 ? splitLine.at(3) : QString::fromLatin1("defaults");
switch (splitLine.length()) { switch (splitLine.length()) {
case 4: case 4:

View File

@ -140,7 +140,9 @@ bool fat12::writeLabel(Report& report, const QString& deviceNode, const QString&
{ {
report.line() << xi18nc("@info:progress", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel.toUpper()); report.line() << xi18nc("@info:progress", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel.toUpper());
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, newLabel.toUpper() }); // This is needed to support new dosfstool 4.2. Later we can drop dosfstools 4.1 and add -r flag.
const QString label = newLabel.isEmpty() ? QStringLiteral("NO_LABEL") : newLabel;
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, label.toUpper() });
return cmd.run(-1) && cmd.exitCode() == 0; return cmd.run(-1) && cmd.exitCode() == 0;
} }

View File

@ -158,6 +158,21 @@ QVariantMap ExternalCommandHelper::CopyBlocks(const QString& sourceDevice, const
if (!isCallerAuthorized()) { if (!isCallerAuthorized()) {
return QVariantMap(); return QVariantMap();
} }
// Avoid division by zero further down
if (!blockSize) {
return QVariantMap();
}
// Prevent some out of memory situations
constexpr qint64 MiB = 1 << 30;
if (blockSize > 100 * MiB) {
return QVariantMap();
}
if (targetDevice.isEmpty() && sourceLength > MiB) {
return QVariantMap();
}
QVariantMap reply; QVariantMap reply;
reply[QStringLiteral("success")] = true; reply[QStringLiteral("success")] = true;
@ -279,15 +294,16 @@ QVariantMap ExternalCommandHelper::RunCommand(const QString& command, const QStr
// connect(&cmd, &QProcess::readyReadStandardOutput, this, &ExternalCommandHelper::onReadOutput); // connect(&cmd, &QProcess::readyReadStandardOutput, this, &ExternalCommandHelper::onReadOutput);
m_cmd.setEnvironment( { QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1") } ); QProcess cmd;
m_cmd.setProcessChannelMode(static_cast<QProcess::ProcessChannelMode>(processChannelMode)); cmd.setEnvironment( { QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1") } );
m_cmd.start(command, arguments); cmd.setProcessChannelMode(static_cast<QProcess::ProcessChannelMode>(processChannelMode));
m_cmd.write(input); cmd.start(command, arguments);
m_cmd.closeWriteChannel(); cmd.write(input);
m_cmd.waitForFinished(-1); cmd.closeWriteChannel();
QByteArray output = m_cmd.readAllStandardOutput(); cmd.waitForFinished(-1);
QByteArray output = cmd.readAllStandardOutput();
reply[QStringLiteral("output")] = output; reply[QStringLiteral("output")] = output;
reply[QStringLiteral("exitCode")] = m_cmd.exitCode(); reply[QStringLiteral("exitCode")] = cmd.exitCode();
return reply; return reply;
} }

View File

@ -46,7 +46,6 @@ private:
bool isCallerAuthorized(); bool isCallerAuthorized();
void onReadOutput(); void onReadOutput();
QProcess m_cmd;
QDBusServiceWatcher *m_serviceWatcher = nullptr; QDBusServiceWatcher *m_serviceWatcher = nullptr;
}; };

View File

@ -13,6 +13,7 @@ SPDX-License-Identifier: CC0-1.0
<description xml:lang="ast">Aniciu del degorriu de comandos esternos</description> <description xml:lang="ast">Aniciu del degorriu de comandos esternos</description>
<description xml:lang="ca">Inicia el dimoni d'ordres externes</description> <description xml:lang="ca">Inicia el dimoni d'ordres externes</description>
<description xml:lang="ca@valencia">Inicia el dimoni d'ordres externes</description> <description xml:lang="ca@valencia">Inicia el dimoni d'ordres externes</description>
<description xml:lang="de">Externen Befehlsdienst starten</description>
<description xml:lang="el">Εκκίνηση διεργασίας με εξωτερική εντολή</description> <description xml:lang="el">Εκκίνηση διεργασίας με εξωτερική εντολή</description>
<description xml:lang="en_GB">Start external command daemon</description> <description xml:lang="en_GB">Start external command daemon</description>
<description xml:lang="es">Iniciar el demonio de órdenes externas</description> <description xml:lang="es">Iniciar el demonio de órdenes externas</description>
@ -20,6 +21,7 @@ SPDX-License-Identifier: CC0-1.0
<description xml:lang="it">Avvia demone per comando esterno</description> <description xml:lang="it">Avvia demone per comando esterno</description>
<description xml:lang="lt">Paleisti išorinių komandų tarnybą</description> <description xml:lang="lt">Paleisti išorinių komandų tarnybą</description>
<description xml:lang="nl">Start externe opdrachtdaemon</description> <description xml:lang="nl">Start externe opdrachtdaemon</description>
<description xml:lang="pl">Rozpocznij usługę zewnętrznego polecenia</description>
<description xml:lang="pt">Iniciar o servidor de comandos externos</description> <description xml:lang="pt">Iniciar o servidor de comandos externos</description>
<description xml:lang="pt_BR">Iniciar comando externo do daemon</description> <description xml:lang="pt_BR">Iniciar comando externo do daemon</description>
<description xml:lang="sl">Zaženi demon za zunanje ukaze</description> <description xml:lang="sl">Zaženi demon za zunanje ukaze</description>
@ -29,6 +31,7 @@ SPDX-License-Identifier: CC0-1.0
<message xml:lang="ast">Ríquense los privilexos alministrativos pa xestionar discos</message> <message xml:lang="ast">Ríquense los privilexos alministrativos pa xestionar discos</message>
<message xml:lang="ca">Es requereixen privilegis d'administrador per a gestionar els discs</message> <message xml:lang="ca">Es requereixen privilegis d'administrador per a gestionar els discs</message>
<message xml:lang="ca@valencia">Es requereixen privilegis d'administrador per a gestionar els discs</message> <message xml:lang="ca@valencia">Es requereixen privilegis d'administrador per a gestionar els discs</message>
<message xml:lang="de">Systemverwalterrechte sind zur Verwaltung von Festplatten erforderlich</message>
<message xml:lang="el">Απαιτούνται δικαιώματα διαχειριστή για τη διαχείριση των δίσκων</message> <message xml:lang="el">Απαιτούνται δικαιώματα διαχειριστή για τη διαχείριση των δίσκων</message>
<message xml:lang="en_GB">Administrative privileges are required to manage disks</message> <message xml:lang="en_GB">Administrative privileges are required to manage disks</message>
<message xml:lang="es">Se necesitan permisos de administrador para gestionar discos</message> <message xml:lang="es">Se necesitan permisos de administrador para gestionar discos</message>
@ -36,6 +39,7 @@ SPDX-License-Identifier: CC0-1.0
<message xml:lang="it">Per gestire il disco sono richiesti privilegi amministrativi</message> <message xml:lang="it">Per gestire il disco sono richiesti privilegi amministrativi</message>
<message xml:lang="lt">Diskų tvarkymui reikalingos administratoriaus teisės</message> <message xml:lang="lt">Diskų tvarkymui reikalingos administratoriaus teisės</message>
<message xml:lang="nl">Er zijn administratieve rechten vereist om schijven te beheren</message> <message xml:lang="nl">Er zijn administratieve rechten vereist om schijven te beheren</message>
<message xml:lang="pl">Do zarządzania dyskami wymagane są uprawnienia administratora</message>
<message xml:lang="pt">São necessários privilégios de administração para gerir os discos</message> <message xml:lang="pt">São necessários privilégios de administração para gerir os discos</message>
<message xml:lang="pt_BR">São necessários privilégios administrativos para gerenciar discos</message> <message xml:lang="pt_BR">São necessários privilégios administrativos para gerenciar discos</message>
<message xml:lang="sl">Za upravljanje diskov so potrebne pravice upravljavca računalnika</message> <message xml:lang="sl">Za upravljanje diskov so potrebne pravice upravljavca računalnika</message>