diff options
| author | Eric Biggers <ebiggers@google.com> | 2022-01-18 21:03:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 21:03:51 -0800 |
| commit | 7813af71eba05166e0c2f7056e094ca8756fbe8e (patch) | |
| tree | 35560cae2edcc7ad7206412c2df9d98b2eef6a65 /cli-tests/common.sh | |
| parent | 6ec8ee00398c435aba7cbb68f8246c1772e12908 (diff) | |
| parent | 6ebd5a54eae2dfb16b66da649e75848fe6030b7f (diff) | |
Merge pull request #338 from google/remove-protector-from-policy
cmd/fscrypt: don't load protector in remove-protector-from-policy
Diffstat (limited to 'cli-tests/common.sh')
| -rw-r--r-- | cli-tests/common.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli-tests/common.sh b/cli-tests/common.sh index 0ace2b9..1d7b17b 100644 --- a/cli-tests/common.sh +++ b/cli-tests/common.sh @@ -72,6 +72,40 @@ _get_enabled_fs_count() echo "$count" } +# Gets the descriptor of the given protector. +_get_protector_descriptor() +{ + local mnt=$1 + local source=$2 + + case $source in + custom) + local name=$3 + local description="custom protector \\\"$name\\\"" + ;; + login) + local user=$3 + local description="login protector for $user" + ;; + *) + _fail "Unknown protector source $source" + esac + + local descriptor + descriptor=$(fscrypt status "$mnt" | + awk -F ' *' '{ if ($3 == "'"$description"'") print $1 }') + if [ -z "$descriptor" ]; then + _fail "Can't find $description on $mnt" + fi + echo "$descriptor" +} + +# Gets the descriptor of the login protector for $TEST_USER. +_get_login_descriptor() +{ + _get_protector_descriptor "$MNT_ROOT" login "$TEST_USER" +} + # Prints the number of filesystems that have fscrypt metadata. _get_setup_fs_count() { |