|
|
|
@ -637,6 +637,14 @@ function _assert_keyring_doesnt_contain_emails {
|
|
|
|
|
_assert_keyring_emails "$homedir" "$keyring_name" "$emails" 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _assert_keyring_contains_emails_at_least_once {
|
|
|
|
|
local homedir=$1
|
|
|
|
|
local keyring_name=$2
|
|
|
|
|
local emails=$3
|
|
|
|
|
_assert_keyring_emails "$homedir" "$keyring_name" "$emails" 1 1 # expect the email at least once in the keyring
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _assert_keyring_emails {
|
|
|
|
|
local homedir="$1"
|
|
|
|
@ -646,6 +654,7 @@ function _assert_keyring_emails {
|
|
|
|
|
# 0 to not expect the email in the keyring;
|
|
|
|
|
# 1 to expect the email in the keyring
|
|
|
|
|
local expected="$4"
|
|
|
|
|
local allow_duplicates=$5 # set this to 0 to not allow duplicate emails in the keyring when processing assertion (optional)
|
|
|
|
|
|
|
|
|
|
local gpg_uids
|
|
|
|
|
gpg_uids=$(_get_users_in_gpg_keyring "$homedir")
|
|
|
|
@ -663,7 +672,9 @@ function _assert_keyring_emails {
|
|
|
|
|
if [[ $emails_found -eq 0 ]]; then
|
|
|
|
|
_abort "no key found in gpg $keyring_name for: $email"
|
|
|
|
|
elif [[ $emails_found -gt 1 ]]; then
|
|
|
|
|
_abort "$emails_found keys found in gpg $keyring_name for: $email"
|
|
|
|
|
if [[ $allow_duplicates -ne 1 ]]; then
|
|
|
|
|
_abort "$emails_found keys found in gpg $keyring_name for: $email"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
if [[ $emails_found -gt 0 ]]; then
|
|
|
|
|