From cb95c92327cf02ab7deeb847c36d0610cc000a52 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Sat, 31 Oct 2015 11:16:51 +0100 Subject: [PATCH] Adding upstream version 0.9.0+20151029. --- sudo.cpp | 16 +++++++- translations/lxqt-sudo.ts | 60 +++++++++++++++++++++++------ translations/lxqt-sudo_de.ts | 74 ++++++++++++++++++++++++++++-------- translations/lxqt-sudo_sk.ts | 67 +++++++++++++++++++++++++------- 4 files changed, 174 insertions(+), 43 deletions(-) diff --git a/sudo.cpp b/sudo.cpp index 19de45e..374dea4 100644 --- a/sudo.cpp +++ b/sudo.cpp @@ -79,6 +79,13 @@ namespace QTextStream(stdout) << QObject::tr("%1 version %2\n").arg(app_master).arg(app_version); } + + inline void env_workarounds() + { + //cleanup environment + //pcmanfm-qt will not start if the DBUS_SESSION_BUS_ADDRESS is preserved + unsetenv("DBUS_SESSION_BUS_ADDRESS"); + } } Sudo::Sudo() @@ -163,7 +170,7 @@ int Sudo::main() void Sudo::child() { int params_cnt = 2 //1. su/sudo & last nullptr - + (BACK_SU == mBackend ? 1 : 0) //-c for su + + 1 //-c for su | -E for sudo + mArgs.size(); std::unique_ptr params{new char const *[params_cnt]}; const char ** param_arg = params.get() + 1; @@ -172,9 +179,12 @@ void Sudo::child() if (BACK_SU == mBackend) { program = su_prog.toStdString(); - *(param_arg++) = "-c"; + *(param_arg++) = "-c"; //run command } else + { program = sudo_prog.toStdString(); + *(param_arg++) = "-E"; //preserve environment + } params[0] = program.c_str(); @@ -186,6 +196,8 @@ void Sudo::child() *param_arg = nullptr; + env_workarounds(); + setsid(); //session leader execvp(params[0], const_cast(params.get())); diff --git a/translations/lxqt-sudo.ts b/translations/lxqt-sudo.ts index 466ddce..820df8b 100644 --- a/translations/lxqt-sudo.ts +++ b/translations/lxqt-sudo.ts @@ -1,23 +1,20 @@ - + PasswordDialog - LXQt sudo - Command: - Password: @@ -36,31 +33,70 @@ Please enter your password. QObject - - Usage: %1 command [arguments...] + + Usage: %1 option [command [arguments...]] -GUI frontend for %2 +GUI frontend for %2/%3 Arguments: - command Command to run. - arguments Optional arguments for command. + option: + -h|--help Print this help. + -v|--version Print version information. + -s|--su Use %3(1) as backend. + -d|--sudo Use %2(8) as backend. + command Command to run. + arguments Optional arguments for command. - + %1 version %2 + + + Sudo - + %1: no command to run provided! - + + %1: no backend chosen! + + + + + %1: warning - got multiple arguments for %2 backend, squashing into one: %3 + + + + + Failed to fork: %1 + + + + + %1: Failed to exec '%2': %3 + + + + + + Failed to set non-block: %1 + + + + + Failed to fdopen: %1 + + + + Child '%1' process failed! %2 diff --git a/translations/lxqt-sudo_de.ts b/translations/lxqt-sudo_de.ts index 580ce15..6a7ebb9 100644 --- a/translations/lxqt-sudo_de.ts +++ b/translations/lxqt-sudo_de.ts @@ -5,19 +5,16 @@ PasswordDialog - LXQt sudo LXQt sudo - Command: Befehl: - Password: Kennwort: @@ -37,43 +34,88 @@ Bitte Kennwort eingeben. QObject - - Usage: %1 command [arguments...] + + Usage: %1 option [command [arguments...]] -GUI frontend for %2 +GUI frontend for %2/%3 Arguments: - command Command to run. - arguments Optional arguments for command. + option: + -h|--help Print this help. + -v|--version Print version information. + -s|--su Use %3(1) as backend. + -d|--sudo Use %2(8) as backend. + command Command to run. + arguments Optional arguments for command. - Verwendung: %1 command [arguments...] + Verwendung: %1 Option [Befehl [Argumente...]] -graphische Benutzeroberfläche für %2 +Graphische Benutzeroberfläche für %2/%3 Argumente: - command auszuführender Befehl - arguments Argumente zum auszuführenden Befehl + Option: + -h|--help Gibt diese Hilfe aus. + -v|--version Ausgabe der Versionsinformation. + -s|--su Verwendet %3(1) als Backend. + -d|--sudo Verwendet %2(8) als Backend. + Befehl Auszuführender Befehl. + Argumente Argumente zum auszuführenden Befehl. - + %1 version %2 %1 Version %2 + + + Sudo - + %1: no command to run provided! %1: kein auszuführender Befehl angegeben! - + + %1: no backend chosen! + %1: kein Backend gewählt! + + + + %1: warning - got multiple arguments for %2 backend, squashing into one: %3 + %1: Warnung - mehrere Argumente für Backend %2 erhalten. %3 wird verwendet + + + + Failed to fork: %1 + Abspalten des Prozesses fehlgeschlagen: %1 + + + + %1: Failed to exec '%2': %3 + + %1: Ausführen von '%2' fehlgeschlagen: +%3 + + + + Failed to set non-block: %1 + Das Setzen von der Option O_NONBLOCK schlug fehl: %1 + + + + Failed to fdopen: %1 + Das Öffnen schlug fehl: %1 + + + Child '%1' process failed! %2 - nachgeordneter Prozess '%1' ist fehlgeschlagen! + Nachgeordneter Prozess '%1' ist fehlgeschlagen! %2 diff --git a/translations/lxqt-sudo_sk.ts b/translations/lxqt-sudo_sk.ts index 6d29ef4..3e1cb20 100644 --- a/translations/lxqt-sudo_sk.ts +++ b/translations/lxqt-sudo_sk.ts @@ -5,19 +5,16 @@ PasswordDialog - LXQt sudo LXQt sudo - Command: Príkaz: - Password: Heslo: @@ -37,40 +34,84 @@ Prosím, zadajte svoje heslo. QObject - - Usage: %1 command [arguments...] + + Usage: %1 option [command [arguments...]] -GUI frontend for %2 +GUI frontend for %2/%3 Arguments: - command Command to run. - arguments Optional arguments for command. + option: + -h|--help Print this help. + -v|--version Print version information. + -s|--su Use %3(1) as backend. + -d|--sudo Use %2(8) as backend. + command Command to run. + arguments Optional arguments for command. - Použitie: %1 command [arguments...] + Použitie: %1 option [command [arguments...]] -GUI frontend pre %2 +GUI frontend pre %2/%3 Parametre: + option: + -h|--help Zobraziť pomoc. + -v|--version Zobraziť verziu. + -s|--su Použiť %3(1) ako backend. + -d|--sudo Použíť %2(8) ako backend. command Príkaz na spustenie. arguments Parametre príkazu. - + %1 version %2 %1 verzia %2 + + + Sudo - + %1: no command to run provided! %1: žiaden príkaz na spustenie! - + + %1: no backend chosen! + %1: nevybratý backend! + + + + %1: warning - got multiple arguments for %2 backend, squashing into one: %3 + %1: upozornenie - zadaných viacero parametrov pre %2 backend, zlúčené do jedného: %3 + + + + Failed to fork: %1 + Zlyhal fork: %1 + + + + %1: Failed to exec '%2': %3 + + %1: Zlyhal exec '%2': %3 + + + + Failed to set non-block: %1 + Zlyhalo nastavenie non-block: %1 + + + + Failed to fdopen: %1 + Zlyhal fdopen: %1 + + + Child '%1' process failed! %2 Dcérsky '%1' process zlyhal!