diff options
| author | Eric Biggers <ebiggers@google.com> | 2020-06-13 10:27:57 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-13 10:27:57 -0700 |
| commit | d4c6fc50bcf6493c21b363ccf69c73561f32dfe8 (patch) | |
| tree | acaae325e95953d077e551a10f66169c573653ec /cli-tests | |
| parent | 9649ed0fd0ad4dcfc33454e0a86193fd255e62df (diff) | |
| parent | 5c1f617c647eb0e9af5ce57758fa58f7e3f4db83 (diff) | |
Merge pull request #237 from ebiggers/t_v1_policy_fix
Adjust status message for v1 policies unlocked by another user and fix cli-tests/t_v1_policy
Diffstat (limited to 'cli-tests')
| -rw-r--r-- | cli-tests/common.sh | 12 | ||||
| -rw-r--r-- | cli-tests/t_v1_policy.out | 4 | ||||
| -rwxr-xr-x | cli-tests/t_v1_policy.sh | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/cli-tests/common.sh b/cli-tests/common.sh index fcebfd6..79b42ae 100644 --- a/cli-tests/common.sh +++ b/cli-tests/common.sh @@ -128,6 +128,18 @@ _user_do_and_expect_failure() _expect_failure "_user_do '$1'" } +# Clear the test user's user keyring and unlink it from root's user keyring, if +# it is linked into it. +_cleanup_user_keyrings() +{ + local ringid + + ringid=$(_user_do "keyctl show @u" | awk '/keyring: _uid/{print $1}') + + _user_do "keyctl clear $ringid" + keyctl unlink "$ringid" @u &> /dev/null || true +} + # Gives the test a new session keyring which contains the test user's keyring # but not root's keyring. Also clears the test user's keyring. This must be # called at the beginning of the test script as it may re-execute the script. diff --git a/cli-tests/t_v1_policy.out b/cli-tests/t_v1_policy.out index b47bcca..9adb00a 100644 --- a/cli-tests/t_v1_policy.out +++ b/cli-tests/t_v1_policy.out @@ -42,7 +42,7 @@ desc2 No custom protector "prot" Policy: desc1 Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 -Unlocked: Yes +Unlocked: Partially (incompletely locked, or unlocked by another user) Protected with 1 protector: PROTECTOR LINKED DESCRIPTION @@ -115,7 +115,7 @@ Then re-run: Policy: desc1 Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 -Unlocked: Partially (incompletely locked) +Unlocked: Partially (incompletely locked, or unlocked by another user) Protected with 1 protector: PROTECTOR LINKED DESCRIPTION diff --git a/cli-tests/t_v1_policy.sh b/cli-tests/t_v1_policy.sh index e9f3acf..e883dcd 100755 --- a/cli-tests/t_v1_policy.sh +++ b/cli-tests/t_v1_policy.sh @@ -6,6 +6,7 @@ cd "$(dirname "$0")" . common.sh _setup_session_keyring +trap _cleanup_user_keyrings EXIT dir="$MNT/dir" mkdir "$dir" |