diff options
author | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-08-24 23:57:09 -0700 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-08-24 23:57:09 -0700 |
commit | 050302344aba552900a199d76fab57fd49c05795 (patch) | |
tree | 2d9165f527c1eca667cd74ca16f74d270d239d6f /src/common | |
parent | 140fd9b87865c53ead7b16c28a8bc040c2650026 (diff) |
tweaked the key expiration checking function, and replied to SJJ's bug
comment.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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 <<EOF + keyExpire="$1" + + if [ -z "$keyExpire" ]; then + cat >&2 <<EOF Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days @@ -95,13 +98,17 @@ Please specify how long the key should be valid. <n>m = key expires in n months <n>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" } |