Skip to content

Commit

Permalink
ido: add --secure-path option
Browse files Browse the repository at this point in the history
  • Loading branch information
gportay committed Feb 13, 2024
1 parent b8b068f commit 4f627af
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ido
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Options:
-V, --version display version information and exit
-- stop processing command line arguments
ido specific options:
--secure-path=list path used for every command run from ido
iamroot specific options:
--multiarch use multiarch library path in chroot
--deflib=path default library path to use in chroot
Expand Down Expand Up @@ -198,6 +201,15 @@ do
then
shift
break
elif [[ "$1" =~ ^--secure-path$ ]]
then
shift
IDO_SECURE_PATH="$1"
export IDO_SECURE_PATH
elif [[ "$1" =~ ^--secure-path=.*$ ]]
then
IDO_SECURE_PATH="${1#*=}"
export IDO_SECURE_PATH
elif [[ "$1" =~ ^--multiarch$ ]]
then
IAMROOT_MULTIARCH="1"
Expand Down Expand Up @@ -438,7 +450,7 @@ IDO_UID="$UID" \
IDO_GID="${GROUPS[0]}" \
IDO_COMMAND="${command[*]}" \
LOGNAME="${passwd[0]}" \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
PATH="${IDO_SECURE_PATH:-/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin}" \
USER="${passwd[0]}" \
HOME="${HOME:-${passwd[5]}}" \
SHELL="${shell:-${passwd[6]}}" \
Expand Down
5 changes: 5 additions & 0 deletions ido.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ The options are as follows:
The **--** is used to delimit the end of the *ido* options. Subsequent
options are passed to the _command_.

*ido specific options*

*--secure-path*=_list_::
Path used for every command run from *ido*.

*iamroot specific options*

*--multiarch*::
Expand Down
9 changes: 9 additions & 0 deletions tests/tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,15 @@ else
fi
echo

run "ido: test option --secure-path /usr/local/bin:/usr/bin:/usr/bin sets path used for every command run from ido"
if bash -x ido --secure-path /usr/local/bin:/usr/bin:/usr/bin env | grep "^PATH=/usr/local/bin:/usr/bin:/usr/bin$"
then
ok
else
ko
fi
echo

run "ido: test option --multiarch uses multiarch library path in chroot"
if ido --multiarch env | grep "^IAMROOT_MULTIARCH=1$"
then
Expand Down

0 comments on commit 4f627af

Please sign in to comment.