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-17 20:39:11 +02:00
|
|
|
kdesu/kdesu.cpp | 16 ++++++++--------
|
|
|
|
1 file changed, 8 insertions(+), 8 deletions(-)
|
2014-11-21 19:46:43 +01:00
|
|
|
|
2021-01-24 22:11:02 +01:00
|
|
|
Index: kde-cli-tools-5.15.80git.20210118T171249~517a2f9/kdesu/kdesu.cpp
|
2018-05-21 11:07:08 +02:00
|
|
|
===================================================================
|
2021-01-24 22:11:02 +01:00
|
|
|
--- kde-cli-tools-5.15.80git.20210118T171249~517a2f9.orig/kdesu/kdesu.cpp 2021-01-19 09:50:49.604400930 +0100
|
|
|
|
+++ kde-cli-tools-5.15.80git.20210118T171249~517a2f9/kdesu/kdesu.cpp 2021-01-19 09:53:33.170263817 +0100
|
|
|
|
@@ -164,10 +164,10 @@
|
|
|
|
int result = startApp(parser);
|
2014-11-21 19:46:43 +01:00
|
|
|
|
2021-01-24 22:11:02 +01:00
|
|
|
if (result == 127) {
|
2018-05-21 11:07:08 +02:00
|
|
|
- KMessageBox::sorry(nullptr, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
|
|
|
|
+ KMessageBox::sorry(nullptr, i18n("Cannot execute command '%1'.", QString::fromUtf8(command)));
|
2014-11-21 19:46:43 +01:00
|
|
|
}
|
2021-01-24 22:11:02 +01:00
|
|
|
if (result == -2) {
|
2018-05-21 11:07:08 +02:00
|
|
|
- KMessageBox::sorry(nullptr, i18n("Cannot execute command '%1'. It contains invalid characters.", QString::fromLocal8Bit(command)));
|
|
|
|
+ KMessageBox::sorry(nullptr, i18n("Cannot execute command '%1'. It contains invalid characters.", QString::fromUtf8(command)));
|
2016-09-13 23:11:29 +02:00
|
|
|
}
|
2014-11-21 19:46:43 +01:00
|
|
|
|
|
|
|
return result;
|
2021-01-24 22:11:02 +01:00
|
|
|
@@ -201,7 +201,7 @@
|
|
|
|
}
|
2014-11-21 19:46:43 +01:00
|
|
|
|
|
|
|
// Get target uid
|
2019-01-19 10:06:58 +01:00
|
|
|
- const QByteArray user = p.value(QStringLiteral("u")).toLocal8Bit();
|
|
|
|
+ const QByteArray user = p.value(QStringLiteral("u")).toUtf8();
|
2014-11-21 19:46:43 +01:00
|
|
|
QByteArray auth_user = user;
|
2019-01-19 10:06:58 +01:00
|
|
|
struct passwd *pw = getpwnam(user.constData());
|
2021-01-24 22:11:02 +01:00
|
|
|
if (pw == nullptr) {
|
|
|
|
@@ -255,7 +255,7 @@
|
|
|
|
|
2014-11-21 19:46:43 +01:00
|
|
|
// Get command
|
2021-01-24 22:11:02 +01:00
|
|
|
if (p.isSet(QStringLiteral("c"))) {
|
2018-09-15 14:29:39 +02:00
|
|
|
- command = p.value(QStringLiteral("c")).toLocal8Bit();
|
|
|
|
+ command = p.value(QStringLiteral("c")).toUtf8();
|
2014-11-21 19:46:43 +01:00
|
|
|
// 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
|
2021-01-24 22:11:02 +01:00
|
|
|
@@ -337,7 +337,7 @@
|
|
|
|
// }
|
2014-11-21 19:46:43 +01:00
|
|
|
|
|
|
|
KUser u;
|
2021-01-24 22:11:02 +01:00
|
|
|
- env << (QByteArray)("KDESU_USER=" + u.loginName().toLocal8Bit());
|
|
|
|
+ env << (QByteArray)("KDESU_USER=" + u.loginName().toUtf8());
|
2014-11-21 19:46:43 +01:00
|
|
|
|
2021-01-24 22:11:02 +01:00
|
|
|
if (keep && !terminal && !just_started) {
|
|
|
|
client.setPriority(priority);
|
|
|
|
@@ -445,7 +445,7 @@
|
|
|
|
result = WEXITSTATUS(result);
|
|
|
|
return result;
|
|
|
|
} else if (keep && have_daemon) {
|
2019-01-19 10:06:58 +01:00
|
|
|
- client.setPass(password.toLocal8Bit().constData(), timeout);
|
|
|
|
+ client.setPass(password.toUtf8().constData(), timeout);
|
2014-11-21 19:46:43 +01:00
|
|
|
client.setPriority(priority);
|
|
|
|
client.setScheduler(scheduler);
|
|
|
|
int result = client.exec(command, user, options, env);
|
2021-01-24 22:11:02 +01:00
|
|
|
@@ -462,7 +462,7 @@
|
2014-11-21 19:46:43 +01:00
|
|
|
proc.setPriority(priority);
|
|
|
|
proc.setScheduler(scheduler);
|
|
|
|
proc.setCommand(command);
|
2019-01-19 10:06:58 +01:00
|
|
|
- int result = proc.exec(password.toLocal8Bit().constData());
|
|
|
|
+ int result = proc.exec(password.toUtf8().constData());
|
2014-11-21 19:46:43 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return -1;
|