diff options
author | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 20:39:55 -0400 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 20:44:26 -0400 |
commit | 06fc008910dc3f8df8c1a6185f49f22854f8f74b (patch) | |
tree | 2233390372d05743398f66d0ef9a083b70589aaf /src | |
parent | 64a6b0cded9f9b21243ed9395a9e2ca734ac05c5 (diff) |
Fix argument checking for functions with options.
Tweak to prompt for add-certifier.
Diffstat (limited to 'src')
-rwxr-xr-x | src/monkeysphere | 9 | ||||
-rwxr-xr-x | src/monkeysphere-server | 15 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index cb6c06c..2227b91 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -90,6 +90,9 @@ gen_subkey(){ done keyID="$1" + if [ -z "$keyID" ] ; then + failure "You must specify the key ID of your primary key." + fi gpgOut=$(gpg --quiet --fixed-list-mode --list-keys --with-colons \ "$keyID" 2> /dev/null) @@ -245,11 +248,7 @@ case $COMMAND in ;; 'gen-subkey'|'g') - keyID="$1" - if [ -z "$keyID" ] ; then - failure "You must specify the key ID of your primary key." - fi - gen_subkey "$keyID" + gen_subkey "$@" ;; 'help'|'h'|'?') diff --git a/src/monkeysphere-server b/src/monkeysphere-server index 9d0d9b3..6534fa1 100755 --- a/src/monkeysphere-server +++ b/src/monkeysphere-server @@ -423,6 +423,9 @@ add_certifier() { done keyID="$1" + if [ -z "$keyID" ] ; then + failure "You must specify the key ID of a key to add." + fi export keyID # export host ownertrust to authentication keyring @@ -438,7 +441,8 @@ add_certifier() { echo "key found:" gpg_authentication "--fingerprint $fingerprint" - read -p "Are you sure you want to add this key as a certifier of users on this system? (y/N) " OK; OK=${OK:-N} + echo "Are you sure you want to add this key as a certifier of" + read -p "users on this system? (y/N) " OK; OK=${OK:-N} if [ "${OK/y/Y}" != 'Y' ] ; then failure "aborting." fi @@ -472,6 +476,9 @@ remove_certifier() { local fingerprint keyID="$1" + if [ -z "$keyID" ] ; then + failure "You must specify the key ID of a key to remove." + fi # delete the requested key (with prompting) gpg_host --delete-key "$keyID" @@ -550,16 +557,10 @@ case $COMMAND in ;; 'add-identity-certifier'|'add-certifier'|'a') - if [ -z "$1" ] ; then - failure "You must specify a key ID." - fi add_certifier "$1" ;; 'remove-identity-certifier'|'remove-certifier'|'r') - if [ -z "$1" ] ; then - failure "You must specify a key ID." - fi remove_certifier "$1" ;; |