summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-12-19 12:27:22 -0200
committerSilvio Rhatto <rhatto@riseup.net>2016-12-19 12:27:22 -0200
commitc12b5c6c7eccb8e0922ff034bb3690774e12998c (patch)
treef344a52f04923d213186f5e747ba5dbe57878799
parentd0cddcae6b79cbe7d9979c0385e100915d1563ae (diff)
downloadkeyringer-c12b5c6c7eccb8e0922ff034bb3690774e12998c.tar.gz
keyringer-c12b5c6c7eccb8e0922ff034bb3690774e12998c.tar.bz2
Make keyringer_check_expiration not fail on subkeys which do not have an expiration date
-rwxr-xr-xlib/keyringer/functions12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 09b004d..fd0176b 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -722,19 +722,25 @@ function keyringer_check_expiration {
fi
# Check the subkeys
- expiry=""
- for expiry in `gpg --with-colons --fixed-list-mode --list-keys "$recipient" | grep ^sub | cut -d : -f 7`; do
+ local subkey=""
+ for subkey in $(gpg --with-colons --fixed-list-mode --list-keys "$recipient" | grep ^sub); do
+ local expiry=$(cut -d : -f 7 <<< "$subkey")
+ if [[ -z "$expiry" ]]; then
+ not_expired=1
+ break
+ fi
if [[ "$seconds" -lt "$expiry" ]]; then
not_expired="1"
if [[ "$ahead" -gt "$expiry" ]] && [ "$BASENAME" == "check" ]; then
echo "Warning: subkey from $recipient will expire soon, on `date --date="@$expiry"`"
fi
+ break
fi
done
# All subkeys are expired
- if [ ! -z "$expiry" ] && [ "$not_expired" != "1" ]; then
+ if [ ! -z "$subkey" ] && [ "$not_expired" != "1" ]; then
echo "Fatal: key $recipient has no keys suitable for encryption: all subkeys expired."
exit 1
fi