pkexec wrapper: fix gdebi / synaptic

but at cost of checking for passwordless sudo /etc/suders /etc/sudoers.d
exceptions.

http://forums.whonix.org/t/cannot-use-pkexec/8129/53
This commit is contained in:
Patrick Schleizer 2020-02-29 04:59:56 -05:00
parent 32269d32b6
commit 649ec5dfa1
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -104,14 +104,15 @@ exit_code=0
## lxqt-sudo does not check /etc/sudoers / /etc/sudoers.d exceptions. ## lxqt-sudo does not check /etc/sudoers / /etc/sudoers.d exceptions.
## Therefore use 'sudo -l' to see if there is any already existing sudoers exception. ## Therefore use 'sudo -l' to see if there is any already existing sudoers exception.
if sudo -l --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" ; then ## Did not work. 'sudo -l' will always exit with exit code '0'.
log_to_journal "sudoers exception: yes" # if sudo -l --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" ; then
sudo --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" || { exit_code=$? ; true; }; # log_to_journal "sudoers exception: yes"
log_to_journal "sudo --user | exit_code: '$exit_code'" # sudo --non-interactive $maybe_switch_to_user --set-home PKEXEC_UID="$PKEXEC_UID" "$@" || { exit_code=$? ; true; };
exit "$exit_code" # log_to_journal "sudo --user | exit_code: '$exit_code'"
fi # exit "$exit_code"
# fi
log_to_journal "sudoers exception: no" #
# log_to_journal "sudoers exception: no"
if [ "$switch_user" = "true" ]; then if [ "$switch_user" = "true" ]; then
## 'sudo --user user' clears environment variables such as PATH. ## 'sudo --user user' clears environment variables such as PATH.