From 050302344aba552900a199d76fab57fd49c05795 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sun, 24 Aug 2008 23:57:09 -0700 Subject: tweaked the key expiration checking function, and replied to SJJ's bug comment. --- src/common | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/common') diff --git a/src/common b/src/common index 44bdb67..d90730f 100644 --- a/src/common +++ b/src/common @@ -85,9 +85,12 @@ gpg_escape() { # prompt for GPG-formatted expiration, and emit result on stdout get_gpg_expiration() { - local keyExpire= + local keyExpire - cat >&2 <&2 < = key expires in n days @@ -95,13 +98,17 @@ Please specify how long the key should be valid. m = key expires in n months y = key expires in n years EOF - while [ -z "$keyExpire" ] ; do - read -p "Key is valid for? (0) " keyExpire - if ! test_gpg_expire ${keyExpire:=0} ; then - echo "invalid value" >&2 - unset keyExpire - fi - done + while [ -z "$keyExpire" ] ; do + read -p "Key is valid for? (0) " keyExpire + if ! test_gpg_expire ${keyExpire:=0} ; then + echo "invalid value" >&2 + unset keyExpire + fi + done + elif ! test_gpg_expire "$keyExpire" ; then + failure "invalid key expiration value '$keyExpire'." + fi + echo "$keyExpire" } -- cgit v1.2.3