Lines Matching +full:protect +full:- +full:exec

2 # SPDX-License-Identifier: GPL-2.0
7 # samples/check-exec/inc.c
11 set -u -e -o pipefail
14 exec 2>/dev/null
16 DIR="$(dirname $(readlink -f "$0"))"
29 if [[ ${ret} -ne ${expect} ]]; then
33 if [[ ${ret} -eq 0 && "${out}" != "${EXPECTED_OUTPUT}" ]]; then
49 if [[ ${ret} -ne ${expect} ]]; then
53 if [[ ${ret} -eq 0 && "${out}" != "${EXPECTED_OUTPUT}" ]]; then
67 out="$("$@" ./inc -i < "${script}")" || ret=$?
69 if [[ ${ret} -ne ${expect} ]]; then
73 if [[ ${ret} -eq 0 && "${out}" != "${EXPECTED_OUTPUT}" ]]; then
86 out="$(cat script-exec.inc | "$@" ./inc -i)" || ret=$?
88 if [[ ${ret} -ne ${expect} ]]; then
101 out="$("$@" ./inc -c "$(< script-exec.inc)")" || ret=$?
103 if [[ ${ret} -ne ${expect} ]]; then
107 if [[ ${ret} -eq 0 && "${out}" != "${EXPECTED_OUTPUT}" ]]; then
128 ktap_test exec_direct 0 script-exec.inc
129 ktap_test exec_indirect 0 script-exec.inc
132 ktap_test exec_stdin_reg 0 script-exec.inc
134 ktap_print_msg "By default, non-executable scripts are allowed to be interpreted, but not directly …
136 ktap_test exec_direct 126 script-noexec.inc
137 ktap_test exec_indirect 0 script-noexec.inc
139 ktap_print_msg "By default, non-executable stdin is allowed to be interpreted."
140 ktap_test exec_stdin_reg 0 script-noexec.inc
145 # With only file restriction: protect non-malicious users from inadvertent errors (e.g. python ~/Do…
147 ktap_print_msg "With -f, executable scripts are allowed to be interpreted and executed."
148 ktap_test exec_direct 0 script-exec.inc ./set-exec -f --
149 ktap_test exec_indirect 0 script-exec.inc ./set-exec -f --
151 ktap_print_msg "With -f, executable stdin is allowed to be interpreted."
152 ktap_test exec_stdin_reg 0 script-exec.inc ./set-exec -f --
154 ktap_print_msg "With -f, non-executable scripts are not allowed to be executed nor interpreted."
155 # Direct execution of non-executable script is alwayse denied by the kernel.
156 ktap_test exec_direct 1 script-noexec.inc ./set-exec -f --
157 ktap_test exec_indirect 1 script-noexec.inc ./set-exec -f --
159 ktap_print_msg "With -f, non-executable stdin is allowed to be interpreted."
160 ktap_test exec_stdin_reg 0 script-noexec.inc ./set-exec -f --
162 ktap_print_msg "With -f, interactive commands are allowed to be interpreted."
163 ktap_test exec_interactive 0 ./set-exec -f --
167 ktap_print_msg "With -i, executable scripts are allowed to be interpreted and executed."
168 ktap_test exec_direct 0 script-exec.inc ./set-exec -i --
169 ktap_test exec_indirect 0 script-exec.inc ./set-exec -i --
171 ktap_print_msg "With -i, executable stdin is allowed to be interpreted."
172 ktap_test exec_stdin_reg 0 script-exec.inc ./set-exec -i --
174 ktap_print_msg "With -i, non-executable scripts are allowed to be interpreted, but not directly exe…
175 # Direct execution of non-executable script is alwayse denied by the kernel.
176 ktap_test exec_direct 1 script-noexec.inc ./set-exec -i --
177 ktap_test exec_indirect 0 script-noexec.inc ./set-exec -i --
179 ktap_print_msg "With -i, non-executable stdin is not allowed to be interpreted."
180 ktap_test exec_stdin_reg 1 script-noexec.inc ./set-exec -i --
182 ktap_print_msg "With -i, interactive commands are not allowed to be interpreted."
183 ktap_test exec_interactive 1 ./set-exec -i --
187 ktap_print_msg "With -fi, executable scripts are allowed to be interpreted and executed."
188 ktap_test exec_direct 0 script-exec.inc ./set-exec -fi --
189 ktap_test exec_indirect 0 script-exec.inc ./set-exec -fi --
191 ktap_print_msg "With -fi, executable stdin is allowed to be interpreted."
192 ktap_test exec_stdin_reg 0 script-exec.inc ./set-exec -fi --
194 ktap_print_msg "With -fi, non-executable scripts are not allowed to be interpreted nor executed."
195 # Direct execution of non-executable script is alwayse denied by the kernel.
196 ktap_test exec_direct 1 script-noexec.inc ./set-exec -fi --
197 ktap_test exec_indirect 1 script-noexec.inc ./set-exec -fi --
199 ktap_print_msg "With -fi, non-executable stdin is not allowed to be interpreted."
200 ktap_test exec_stdin_reg 1 script-noexec.inc ./set-exec -fi --
202 ktap_print_msg "With -fi, interactive commands are not allowed to be interpreted."
203 ktap_test exec_interactive 1 ./set-exec -fi --