diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-06-19 18:12:17 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-06-19 18:12:17 -0400 |
commit | ad83c56cbab054c36ec854bf9cc2e0be530fce72 (patch) | |
tree | ddb375223b6eeba38b1dcd415fe4ebb7c4e49110 /src | |
parent | 1fa2912aac2636bc6a4d8eda089c0e285f88d141 (diff) | |
parent | 7019354a75ca19ffd2e10f2e2b3dc89b480156bd (diff) |
Merge commit 'jrollins/master'
Diffstat (limited to 'src')
-rw-r--r-- | src/common | 13 | ||||
-rwxr-xr-x | src/monkeysphere-server | 10 |
2 files changed, 18 insertions, 5 deletions
@@ -18,10 +18,17 @@ ETC="/etc/monkeysphere" export ETC CACHE="/var/cache/monkeysphere" export CACHE +ERR=0 +export ERR ######################################################################## ### UTILITY FUNCTIONS +error() { + log "$1" + ERR=${2:-'1'} +} + failure() { echo "$1" >&2 exit ${2:-'1'} @@ -29,12 +36,12 @@ failure() { # write output to stderr log() { - echo -n "ms: " 1>&2 - echo "$@" 1>&2 + echo -n "ms: " >&2 + echo "$@" >&2 } loge() { - echo "$@" 1>&2 + echo "$@" >&2 } # cut out all comments(#) and blank lines from standard input diff --git a/src/monkeysphere-server b/src/monkeysphere-server index 154c146..a9a9aed 100755 --- a/src/monkeysphere-server +++ b/src/monkeysphere-server @@ -162,6 +162,12 @@ case $COMMAND in for uname in $unames ; do MODE="authorized_keys" + # check all specified users exist + if ! getent passwd | cut -d: -f1 | grep -q "^${uname}$" ; then + error "----- unknown user '$uname' -----" + continue + fi + # set authorized_user_ids variable, # translate ssh-style path variables authorizedUserIDs=$(translate_ssh_variables "$uname" "$AUTHORIZED_USER_IDS") @@ -201,8 +207,6 @@ case $COMMAND in log "authorized_keys file updated." done - - log "----- done. -----" ;; 'gen-key'|'g') @@ -237,3 +241,5 @@ case $COMMAND in Type '$PGRM help' for usage." ;; esac + +exit "$ERR" |