aboutsummaryrefslogtreecommitdiff
path: root/cli-tests/t_v1_policy.sh
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 15:21:07 -0700
committerGitHub <noreply@github.com>2020-05-09 15:21:07 -0700
commit1cdefc21b8b07aad7aafeefd05d3124cf93b9216 (patch)
treeb5f304a4ecc101a5410bb2274d129dbc7dad6441 /cli-tests/t_v1_policy.sh
parent338347ac4766f899fdc471d57f293798ff0e6c29 (diff)
parentde51add609bc74b7247ec4776bd694abbea24a45 (diff)
Merge pull request #217 from ebiggers/detect-incomplete-v1-locking
Try to detect incomplete locking of v1-encrypted directory
Diffstat (limited to 'cli-tests/t_v1_policy.sh')
-rwxr-xr-xcli-tests/t_v1_policy.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli-tests/t_v1_policy.sh b/cli-tests/t_v1_policy.sh
index 1ebfae5..e9f3acf 100755
--- a/cli-tests/t_v1_policy.sh
+++ b/cli-tests/t_v1_policy.sh
@@ -54,3 +54,18 @@ _print_header "Lock v1-encrypted directory"
fscrypt lock "$dir" --user="$TEST_USER"
_user_do "fscrypt status '$dir'"
_expect_failure "cat '$dir/file'"
+
+# 'fscrypt lock' and 'fscrypt status' implement a heuristic that should detect
+# the "files busy" case with v1.
+_print_header "Testing incompletely locking v1-encrypted directory"
+_user_do "echo hunter2 | fscrypt unlock '$dir'"
+exec 3<"$dir/file"
+_expect_failure "fscrypt lock '$dir' --user='$TEST_USER'"
+_user_do "fscrypt status '$dir'"
+# ... except in this case, because we can't detect it without a directory path.
+_user_do "fscrypt status '$MNT'"
+exec 3<&-
+_print_header "Finishing locking v1-encrypted directory"
+fscrypt lock "$dir" --user="$TEST_USER"
+_user_do "fscrypt status '$dir'"
+_expect_failure "cat '$dir/file'"