Added permissions globbing tests
This commit is contained in:
		@@ -9,6 +9,13 @@ touch ./protected/do-not-remove ./protected/should-be-removed ./protected/truth
 | 
			
		||||
chmod 777 ./protected/perm777 ./protected/perm000
 | 
			
		||||
echo "Free code, free world." >./protected/motto
 | 
			
		||||
 | 
			
		||||
mkdir protected/haystack
 | 
			
		||||
for i in {1..10}; do
 | 
			
		||||
  touch "./protected/haystack/hay$i"
 | 
			
		||||
done
 | 
			
		||||
touch ./protected/haystack/needle
 | 
			
		||||
echo "Liberty in every line." >./protected/haystack/needle
 | 
			
		||||
 | 
			
		||||
rm -rf ./openers
 | 
			
		||||
mkdir openers
 | 
			
		||||
make -C ./opener || (
 | 
			
		||||
@@ -151,9 +158,22 @@ openers/symlinked_opener2 ./protected/motto >/dev/null 2>/dev/null &&
 | 
			
		||||
  echo "[ICFS-TEST]: openers/symlinked_opener2 can read protected/motto despite access being denied!" ||
 | 
			
		||||
  echo "[ICFS-TEST]: OK" # EACCESS
 | 
			
		||||
 | 
			
		||||
# test permission globbing
 | 
			
		||||
 | 
			
		||||
icfs_dialogue --set-fake-response yes_perm
 | 
			
		||||
icfs_dialogue --set-fake-response-filename "/"
 | 
			
		||||
grep 'Liberty' ./protected/haystack/needle >/dev/null &&
 | 
			
		||||
  echo "[ICFS-TEST]: OK" ||
 | 
			
		||||
  echo "[ICFS-TEST]: grep cannot read protected/motto despite access being permitted!" # OK
 | 
			
		||||
 | 
			
		||||
icfs_dialogue --set-fake-response no # this should be ignored
 | 
			
		||||
grep "Liberty" ./protected/haystack/* >/dev/null &&
 | 
			
		||||
  echo "[ICFS-TEST]: OK" ||
 | 
			
		||||
  echo "[ICFS-TEST]: grep cannot read protected/motto despite access being permitted!" # OK
 | 
			
		||||
 | 
			
		||||
# test database access
 | 
			
		||||
if [[ -r "./.pt.db" || -w "./.pt.db" ]]; then
 | 
			
		||||
  echo "[ICFS-TEST]: permanent permissions is accessible!"
 | 
			
		||||
  echo "[ICFS-TEST]: permanent permissions database is accessible!"
 | 
			
		||||
else
 | 
			
		||||
  echo "[ICFS-TEST]: OK"
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user