Unverified Commit a8147523 authored by Mice7R's avatar Mice7R
Browse files

Remove SUDO_VALIDATE and only use sudo -v

This addresses the changes requested by Rycieos at #702.
To summarize:
The flag -v exists since first version of sudo and we can't find a
reason why to use true.

This commit changes the default behaviour of sudo detection to use
sudo -v instead of executing true.
parent d159831d
......@@ -551,17 +551,7 @@ Features
run ``sudo`` once each prompt. This is likely to make your sysadmin hate
you.
See also: :attr:`LP_COLOR_MARK_SUDO`, :attr:`LP_USE_SUDO_VALIDATE`.
.. attribute:: LP_USE_SUDO_VALIDATE
:type: bool
:value: 0
Use sudo validate command ``sudo -v`` to check for valid credentials.
:attr:`LP_ENABLE_SUDO` must be enabled for this to have any effect.
See also: :attr:`LP_ENABLE_SUDO`.
See also: :attr:`LP_COLOR_MARK_SUDO`.
.. attribute:: LP_ENABLE_SVN
:type: bool
......
......@@ -251,7 +251,6 @@ __lp_source_config() {
LP_ENABLE_FQDN=${LP_ENABLE_FQDN:-0}
LP_DISABLED_VCS_PATHS=( ${LP_DISABLED_VCS_PATHS[@]+"${LP_DISABLED_VCS_PATHS[@]}"} )
LP_ENABLE_SUDO=${LP_ENABLE_SUDO:-0}
LP_USE_SUDO_VALIDATE=${LP_USE_SUDO_VALIDATE:-0}
LP_ENABLE_COLOR=${LP_ENABLE_COLOR:-1}
LP_ENABLE_ERROR=${LP_ENABLE_ERROR:-1}
LP_ENABLE_DIRSTACK=${LP_ENABLE_DIRSTACK:-0}
......@@ -1335,11 +1334,7 @@ _lp_username_color() {
# sudo -v # return non-zero when no credentials are cached
_lp_sudo_active() {
(( LP_ENABLE_SUDO )) || return 2
if (( LP_USE_SUDO_VALIDATE )); then
\sudo -nv 2>/dev/null || return 1
else
\sudo -n true 2>/dev/null || return 1
fi
\sudo -nv 2>/dev/null || return 1
}
_lp_sudo_active_color() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment