2014-11-21 19:46:43 +01:00
|
|
|
From abee9c239f74f60a77c0931be23ad1d8670feda6 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
|
|
|
|
Date: Tue, 3 Dec 2013 19:31:13 +0100
|
|
|
|
Subject: [PATCH 1/1] kdesu Add some love
|
|
|
|
|
|
|
|
From/toUTF8 in practice covers more ground than 8bit.
|
|
|
|
Furthermore, make the kdesu 'command' translatable, it's used
|
|
|
|
in openSUSE with dolphin and konsole 'Start as root'
|
|
|
|
BUG: boo#852256
|
|
|
|
---
|
2016-09-13 23:11:29 +02:00
|
|
|
kdesu/kdesu.cpp | 14 +++++++-------
|
|
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
2014-11-21 19:46:43 +01:00
|
|
|
|
2016-09-13 23:11:29 +02:00
|
|
|
Index: kde-cli-tools-5.7.5/kdesu/kdesu.cpp
|
|
|
|
===================================================================
|
|
|
|
--- kde-cli-tools-5.7.5.orig/kdesu/kdesu.cpp
|
|
|
|
+++ kde-cli-tools-5.7.5/kdesu/kdesu.cpp
|
|
|
|
@@ -160,11 +160,11 @@ int main(int argc, char *argv[])
|
2014-11-21 19:46:43 +01:00
|
|
|
|
|
|
|
if (result == 127)
|
|
|
|
{
|
|
|
|
- KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
|
|
|
|
+ KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromUtf8(command)));
|
|
|
|
}
|
2016-09-13 23:11:29 +02:00
|
|
|
if (result == -2)
|
|
|
|
{
|
|
|
|
- KMessageBox::sorry(0, i18n("Cannot execute command '%1'. It contains invalid characters.", QString::fromLocal8Bit(command)));
|
|
|
|
+ KMessageBox::sorry(0, i18n("Cannot execute command '%1'. It contains invalid characters.", QString::fromUtf8(command)));
|
|
|
|
}
|
2014-11-21 19:46:43 +01:00
|
|
|
|
|
|
|
return result;
|
2016-09-13 23:11:29 +02:00
|
|
|
@@ -199,7 +199,7 @@ static int startApp(QCommandLineParser&
|
2014-11-21 19:46:43 +01:00
|
|
|
prompt = false;
|
|
|
|
|
|
|
|
// Get target uid
|
|
|
|
- QByteArray user = p.value("u").toLocal8Bit();
|
|
|
|
+ QByteArray user = p.value("u").toUtf8();
|
|
|
|
QByteArray auth_user = user;
|
|
|
|
struct passwd *pw = getpwnam(user);
|
|
|
|
if (pw == 0L)
|
2016-09-13 23:11:29 +02:00
|
|
|
@@ -259,7 +259,7 @@ static int startApp(QCommandLineParser&
|
2014-11-21 19:46:43 +01:00
|
|
|
// Get command
|
|
|
|
if (p.isSet("c"))
|
|
|
|
{
|
|
|
|
- command = p.value("c").toLocal8Bit();
|
|
|
|
+ command = p.value("c").toUtf8();
|
|
|
|
// Accepting additional arguments here is somewhat weird,
|
|
|
|
// but one can conceive use cases: have a complex command with
|
|
|
|
// redirections and additional file names which need to be quoted
|
2016-09-13 23:11:29 +02:00
|
|
|
@@ -347,7 +347,7 @@ static int startApp(QCommandLineParser&
|
2014-11-21 19:46:43 +01:00
|
|
|
// }
|
|
|
|
|
|
|
|
KUser u;
|
|
|
|
- env << (QByteArray) ("KDESU_USER=" + u.loginName().toLocal8Bit());
|
|
|
|
+ env << (QByteArray) ("KDESU_USER=" + u.loginName().toUtf8());
|
|
|
|
|
|
|
|
if (keep && !terminal && !just_started)
|
|
|
|
{
|
2016-09-13 23:11:29 +02:00
|
|
|
@@ -459,7 +459,7 @@ static int startApp(QCommandLineParser&
|
2014-11-21 19:46:43 +01:00
|
|
|
}
|
|
|
|
else if (keep && have_daemon)
|
|
|
|
{
|
|
|
|
- client.setPass(password.toLocal8Bit(), timeout);
|
|
|
|
+ client.setPass(password.toUtf8(), timeout);
|
|
|
|
client.setPriority(priority);
|
|
|
|
client.setScheduler(scheduler);
|
|
|
|
int result = client.exec(command, user, options, env);
|
2016-09-13 23:11:29 +02:00
|
|
|
@@ -478,7 +478,7 @@ static int startApp(QCommandLineParser&
|
2014-11-21 19:46:43 +01:00
|
|
|
proc.setPriority(priority);
|
|
|
|
proc.setScheduler(scheduler);
|
|
|
|
proc.setCommand(command);
|
|
|
|
- int result = proc.exec(password.toLocal8Bit());
|
|
|
|
+ int result = proc.exec(password.toUtf8());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return -1;
|