Commit b24a3a76 authored by Slava Aseev's avatar Slava Aseev Committed by Harald Sitter
Browse files

groupmanager: Do not return prematurely after a non-zero testparm exit code

testparm can write "usershare path"/"passdb backend" to stdout even
if non-zero exit code is returned.

Thanks to Ilya Demyanov for bug report and for identifying the cause
of the bug.
parent 3646da40
Pipeline #212404 passed with stage
in 35 seconds
......@@ -25,7 +25,7 @@ GroupManager::GroupManager(QObject *parent)
QStringLiteral("--verbose"),
QStringLiteral("--parameter-name"),
QStringLiteral("usershare path")});
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, proc](int exitCode) {
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, proc] {
proc->deleteLater();
const QString path = QString::fromUtf8(proc->readAllStandardOutput().simplified());
......@@ -33,7 +33,7 @@ GroupManager::GroupManager(QObject *parent)
Q_EMIT isReadyChanged();
QFileInfo info(path);
if (exitCode != 0 || path.isEmpty() || !info.exists()) {
if (path.isEmpty() || !info.exists()) {
return; // usershares may be disabled or path is invalid :|
}
......
......@@ -145,11 +145,11 @@ void UserManager::load()
QStringLiteral("--parameter-name"),
QStringLiteral("passdb backend")
});
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, proc](int exitCode) {
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, proc] {
proc->deleteLater();
const QByteArray output = proc->readAllStandardOutput().simplified();
if (exitCode == 0 && output == QByteArrayLiteral("tdbsam")) {
if (output == QByteArrayLiteral("tdbsam")) {
m_canManageSamba = true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment