sfeed_update tests: do not allow including directory names anymore - sfeed_tests - sfeed tests and RSS and Atom files
HTML git clone git://git.codemadness.org/sfeed_tests
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit d86f3ded644c0e42eb311e1ddd0bfb3f63b60d7a
DIR parent a28abfeef506a74f325d2d66cccabb3278912f05
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 26 Dec 2023 15:16:16 +0100
sfeed_update tests: do not allow including directory names anymore
Tested on NetBSD 5.1, evaluating directories is allowed and could allow
garbage, so disallow it.
Devices / fifo, etc are still allowed.
Add a test for checking files with no permissions.
Diffstat:
M input/sfeed_update/test.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
DIR diff --git a/input/sfeed_update/test.sh b/input/sfeed_update/test.sh
@@ -181,12 +181,14 @@ test_config_invocation() {
fgrep -q "$msg" < "$log_stderr"
expect "0" "$?" "stderr must contain text $msg"
+ # invalid: must not be a directory.
"$SFEED_UPDATE" `pwd` >/dev/null 2> "$log_stderr" # directory
expect "1" "$?" "exit statuscode"
- msg='does not contain a "feeds" function'
+ msg='" cannot be read.'
fgrep -q "$msg" < "$log_stderr"
expect "0" "$?" "stderr must contain text $msg"
+ # invalid: must not be a directory.
"$SFEED_UPDATE" /root >/dev/null 2> "$log_stderr" # directory, probably no access
expect "1" "$?" "exit statuscode"
msg='Configuration file "/root" cannot be read.'
@@ -199,6 +201,19 @@ test_config_invocation() {
fgrep -q "$msg" < "$log_stderr"
expect "0" "$?" "stderr must contain text $msg"
+ rctmp="$(mktemp /tmp/rctmp_XXXXXXXX)"
+ cp "$rc" "$rctmp"
+ chmod 000 "$rctmp" # no access
+
+ "$SFEED_UPDATE" "$rctmp" >/dev/null 2> "$log_stderr" # no access
+ expect "1" "$?" "exit statuscode"
+ msg="Configuration file \"${rctmp}\" cannot be read."
+ fgrep -q "$msg" < "$log_stderr"
+ expect "0" "$?" "stderr must contain text $msg"
+
+ chmod 644 "$rctmp"
+ rm -f "$rctmp"
+
cleanup
echo "test_config_invocation: test OK" >&2