diff options
author | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 14:30:21 -0400 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 14:30:21 -0400 |
commit | 5fadec09dcd44c4dcad657a0f3d96878b592b77b (patch) | |
tree | 1f551bc1350c39c185a2c0912c6b7e2161578244 /src | |
parent | c8b42c1d77005ab3f41d20cc2524f4307086ec4f (diff) |
Update man pages, and tweak default error return code.
Diffstat (limited to 'src')
-rw-r--r-- | src/common | 8 | ||||
-rwxr-xr-x | src/monkeysphere | 12 | ||||
-rwxr-xr-x | src/monkeysphere-server | 16 |
3 files changed, 14 insertions, 22 deletions
@@ -20,14 +20,10 @@ export ETC ######################################################################## ### UTILITY FUNCTIONS -error() { - log "$1" - ERR=${2:-'1'} -} - +# failure function. exits with code 255, unless specified otherwise. failure() { echo "$1" >&2 - exit ${2:-'1'} + exit ${2:-'255'} } # write output to stderr diff --git a/src/monkeysphere b/src/monkeysphere index 59b7e4a..a25fd6a 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -22,7 +22,7 @@ DATE=$(date -u '+%FT%T') unset GREP_OPTIONS # default return code -ERR=0 +RETURN=0 ######################################################################## # FUNCTIONS @@ -30,7 +30,7 @@ ERR=0 usage() { cat <<EOF -usage: $PGRM <subcommand> [args] +usage: $PGRM <subcommand> [options] [args] MonkeySphere client tool. subcommands: @@ -208,7 +208,7 @@ case $COMMAND in # those hosts if [ "$1" ] ; then update_known_hosts "$@" - ERR="$?" + RETURN="$?" # otherwise, if no hosts are specified, process every host # in the user's known_hosts file @@ -218,7 +218,7 @@ case $COMMAND in fi process_known_hosts - ERR="$?" + RETURN="$?" fi ;; @@ -232,7 +232,7 @@ case $COMMAND in # process authorized_user_ids file process_authorized_user_ids "$AUTHORIZED_USER_IDS" - ERR="$?" + RETURN="$?" ;; 'gen-subkey'|'g') @@ -253,4 +253,4 @@ Type '$PGRM help' for usage." ;; esac -exit "$ERR" +exit "$RETURN" diff --git a/src/monkeysphere-server b/src/monkeysphere-server index b7e82d8..9205b1d 100755 --- a/src/monkeysphere-server +++ b/src/monkeysphere-server @@ -25,7 +25,7 @@ DATE=$(date -u '+%FT%T') unset GREP_OPTIONS # default return code -ERR=0 +RETURN=0 ######################################################################## # FUNCTIONS @@ -33,7 +33,7 @@ ERR=0 usage() { cat <<EOF -usage: $PGRM <subcommand> [args] +usage: $PGRM <subcommand> [options] [args] MonkeySphere server admin tool. subcommands: @@ -123,7 +123,7 @@ update_users() { for uname in $unames ; do # check all specified users exist if ! getent passwd "$uname" >/dev/null ; then - error "----- unknown user '$uname' -----" + log "----- unknown user '$uname' -----" continue fi @@ -176,7 +176,7 @@ update_users() { # user su_monkeysphere_user \ ". ${SHARE}/common; process_authorized_user_ids $TMP_AUTHORIZED_USER_IDS" - ERR="$?" + RETURN="$?" fi # add user-controlled authorized_keys file path if specified @@ -332,16 +332,12 @@ add_certifier() { gpg_host --export-ownertrust | gpg_authentication "--import-ownertrust" # get the key from the key server - gpg_authentication "--keyserver $KEYSERVER --recv-key '$keyID'" + gpg_authentication "--keyserver $KEYSERVER --recv-key '$keyID'" || failure # get the full fingerprint of a key ID fingerprint=$(gpg_authentication "--list-key --with-colons --with-fingerprint $keyID" | \ grep '^fpr:' | grep "$keyID" | cut -d: -f10) - if [ -z "$fingerprint" ] ; then - failure "Could not find key \"${keyID}\"." - fi - echo "key found:" gpg_authentication "--fingerprint $fingerprint" @@ -538,4 +534,4 @@ Type '$PGRM help' for usage." ;; esac -exit "$ERR" +exit "$RETURN" |