From 359e0dae2bded75eebf7fe3b3cf919e1dd44c333 Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 11 Mar 2020 16:26:41 -0500 Subject: 45424: completion: Add **/sbin to PATH when completing commands like sudo * Update _command_names to add **/sbin to PATH when not otherwise overridden and _comp_priv_prefix is set. This ensures that, on systems where unprivileged users don't have **/sbin in their PATHs, we can still complete those commands when they try to run them with e.g. sudo * Update functions for privilege-gaining commands to use the aforementioned mechanism * Fix some other minor issues in _pfexec and _doas Changes from the posted diff: * Fix a minor redundancy in _doas * Add _c_p_p=( '' ) hack to _su --- Completion/Solaris/Command/_pfexec | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Completion/Solaris') diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec index 2519c3cdc..e90f33222 100644 --- a/Completion/Solaris/Command/_pfexec +++ b/Completion/Solaris/Command/_pfexec @@ -22,11 +22,15 @@ _privset() { } _pfexec() { + local cmd cpp local -a _comp_priv_prefix - _arguments \ - '-P[privileges to acquire]:privspec:_privset' \ - '(-):command name: _command_names -e' \ - '*::arguments:{ _comp_priv_prefix=( pfexec ${(kv)opt_args[-P]} ) ; _normal }' + local -A opt_args + cmd="$words[1]" + cpp='_comp_priv_prefix=( $cmd ${(kv)opt_args[(I)-P]} )' + _arguments \ + '-P+[privileges to acquire]:privspec:_privset' \ + "(-): :{ $cpp; _command_names -e }" \ + "*:: :{ $cpp; _normal }" } _pfexec "$@" -- cgit 1.4.1