Compare commits

...

12 Commits

Author SHA1 Message Date
  Oxalica -- 2d397bb2d2 Fix out of bounds read when parsing fstab. 1 week ago
  Andrius Štikonas 00de130889 Add initial support for dosfstools 4.2. 1 week ago
  Heiko Becker 3b87ba9e02 GIT_SILENT Upgrade release service version to 20.12.2. 1 month ago
  Andrius Štikonas dc38cb1196 Fix out of bounds read when parsing fstab. 1 month ago
  Christoph Feck 0c09f40ef7 GIT_SILENT Upgrade release service version to 20.12.1. 1 month ago
  l10n daemon script 54f63188ca GIT_SILENT made messages (after extraction) 2 months ago
  Christoph Feck cb02376cf6 GIT_SILENT Upgrade release service version to 20.12.0. 3 months ago
  Andrius Štikonas 252d55e467 Add a limit on the amount of data that can be passed back via DBus. 3 months ago
  Andrius Štikonas 2fb6be4e8d Add a limit on blocksize to prevent out-of-memory situation. 3 months ago
  Andrius Štikonas 5ac18b9d8f Do not reuse QProcess object in externalcommandhelper for different invocations. 3 months ago
  Andrius Štikonas a0efc8854f Fix division by zero. 3 months ago
  Christoph Feck b8692e2f16 GIT_SILENT Upgrade release service version to 20.11.90. 3 months ago
6 changed files with 39 additions and 13 deletions
Split View
  1. +2
    -2
      CMakeLists.txt
  2. +8
    -1
      src/core/fstab.cpp
  3. +3
    -1
      src/fs/fat12.cpp
  4. +24
    -8
      src/util/externalcommandhelper.cpp
  5. +0
    -1
      src/util/externalcommandhelper.h
  6. +2
    -0
      src/util/org.kde.kpmcore.externalcommand.policy

+ 2
- 2
CMakeLists.txt View File

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


+ 8
- 1
src/core/fstab.cpp View File

@ -82,10 +82,17 @@ FstabEntryList readFstabEntries( const QString& fstabPath )
// (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,
// (#) 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 mountPoint = unescapeSpaces(splitLine.at(1));
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()) {
case 4:


+ 3
- 1
src/fs/fat12.cpp 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());
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;
}


+ 24
- 8
src/util/externalcommandhelper.cpp View File

@ -158,6 +158,21 @@ QVariantMap ExternalCommandHelper::CopyBlocks(const QString& sourceDevice, const
if (!isCallerAuthorized()) {
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;
reply[QStringLiteral("success")] = true;
@ -279,15 +294,16 @@ QVariantMap ExternalCommandHelper::RunCommand(const QString& command, const QStr
// connect(&cmd, &QProcess::readyReadStandardOutput, this, &ExternalCommandHelper::onReadOutput);
m_cmd.setEnvironment( { QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1") } );
m_cmd.setProcessChannelMode(static_cast<QProcess::ProcessChannelMode>(processChannelMode));
m_cmd.start(command, arguments);
m_cmd.write(input);
m_cmd.closeWriteChannel();
m_cmd.waitForFinished(-1);
QByteArray output = m_cmd.readAllStandardOutput();
QProcess cmd;
cmd.setEnvironment( { QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1") } );
cmd.setProcessChannelMode(static_cast<QProcess::ProcessChannelMode>(processChannelMode));
cmd.start(command, arguments);
cmd.write(input);
cmd.closeWriteChannel();
cmd.waitForFinished(-1);
QByteArray output = cmd.readAllStandardOutput();
reply[QStringLiteral("output")] = output;
reply[QStringLiteral("exitCode")] = m_cmd.exitCode();
reply[QStringLiteral("exitCode")] = cmd.exitCode();
return reply;
}


+ 0
- 1
src/util/externalcommandhelper.h View File

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


+ 2
- 0
src/util/org.kde.kpmcore.externalcommand.policy View File

@ -20,6 +20,7 @@ SPDX-License-Identifier: CC0-1.0
<description xml:lang="it">Avvia demone per comando esterno</description>
<description xml:lang="lt">Paleisti išorinių komandų tarnybą</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_BR">Iniciar comando externo do daemon</description>
<description xml:lang="sl">Zaženi demon za zunanje ukaze</description>
@ -36,6 +37,7 @@ SPDX-License-Identifier: CC0-1.0
<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="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_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>


Loading…
Cancel
Save