Fix gaining root privileges when command line options are supplied.

This commit is contained in:
Andrius Štikonas 2015-02-04 23:19:49 +00:00
parent 4c64caa6fb
commit 02ffa73bb5
1 changed files with 4 additions and 4 deletions

View File

@ -77,7 +77,7 @@ bool checkPermissions()
// endless loops of calling the same non-working (kde|gk)su(do) binary again and again.
if (!suCommand().isEmpty() && !QCoreApplication::arguments().contains(QLatin1String("--dontsu")))
{
QStringList argList;
QString argList;
const QString suCmd = suCommand();
@ -85,11 +85,11 @@ bool checkPermissions()
// kdesudo accepts either (with or without "-c"), but the gk* helpers only work
// without. kdesu maintainers won't fix their app, so we need to work around that here.
if (suCmd.indexOf(QStringLiteral("kdesu")) != -1)
argList << QStringLiteral("-c");
argList = QStringLiteral("-c ");
argList << QCoreApplication::arguments() << QStringLiteral(" --dontsu");
argList += QCoreApplication::arguments().join(QStringLiteral(" ")) + QStringLiteral(" --dontsu");
if (QProcess::execute(suCmd, argList) == 0)
if (QProcess::execute(suCmd, QStringList(argList)) == 0)
return false;
}