make sure the authorized_user_ids file exists for users processed by
authorJameson Graef Rollins <jrollins@phys.columbia.edu>
Fri, 13 Jun 2008 20:56:50 +0000 (16:56 -0400)
committerJameson Graef Rollins <jrollins@phys.columbia.edu>
Fri, 13 Jun 2008 21:44:50 +0000 (17:44 -0400)
monkeysphere-server.

debian/monkeysphere.dirs
src/monkeysphere
src/monkeysphere-server

index fa2bf5f58de06b2b096b0d93bce91ed33ed40da2..4604eee9bed268b8a4dbb8173f8a4ea8926028d1 100644 (file)
@@ -1,3 +1,4 @@
 usr/share/monkeysphere
 var/cache/monkeysphere
 etc/monkeysphere
+etc/monkeysphere/authorized_user_ids
index 782ba5ed0e329ff4e346df18de8190ac7dcd7039..997ca582a0dc0d936f117b217e067074fe83e82a 100755 (executable)
@@ -31,7 +31,7 @@ GREP_OPTIONS=
 usage() {
 cat <<EOF
 usage: $PGRM <subcommand> [args]
-Monkeysphere client tool.
+MonkeySphere client tool.
 
 subcommands:
   update-known_hosts (k) [HOST]...  update known_hosts file
@@ -176,7 +176,7 @@ case $COMMAND in
     'update-authorized_keys'|'update-authorized-keys'|'a')
        MODE='authorized_keys'
 
-        # make sure authorized_user_ids file exists
+        # fail if the authorized_user_ids file is empty
        if [ ! -s "$AUTHORIZED_USER_IDS" ] ; then
            failure "$AUTHORIZED_USER_IDS is empty."
        fi
index ffb34522bd60ab264b0d05ef8a8bc778defee4f5..922aad34df3b4ad56f920b70d675012a84ed4e55 100755 (executable)
@@ -28,7 +28,7 @@ GREP_OPTIONS=
 usage() {
 cat <<EOF
 usage: $PGRM <subcommand> [args]
-Monkeysphere server admin tool.
+MonkeySphere server admin tool.
 
 subcommands:
   update-users (s) [USER]...            update users authorized_keys files
@@ -121,7 +121,7 @@ export GNUPGHOME
 mkdir -p -m 0700 "$GNUPGHOME"
 
 case $COMMAND in
-    'update-users'|'s')
+    'update-users'|'update-user'|'s')
        if [ "$1" ] ; then
            unames="$@"
        else
@@ -133,13 +133,17 @@ case $COMMAND in
 
            log "----- user: $uname -----"
 
+           # set variables for the user
            AUTHORIZED_USER_IDS="$MS_HOME"/authorized_user_ids/"$uname"
            msAuthorizedKeys="$CACHE"/"$uname"/authorized_keys
            cacheDir="$CACHE"/"$uname"/user_keys
 
-            # make sure authorized_user_ids file exists
+            # make sure user's authorized_user_ids file exists
+           touch "$AUTHORIZED_USER_IDS"
+
+           # skip if the user's authorized_user_ids file is empty
            if [ ! -s "$AUTHORIZED_USER_IDS" ] ; then
-               log "authorized_user_ids file for '$uname' is empty or does not exist."
+               log "authorized_user_ids file for '$uname' is empty."
                continue
            fi
 
@@ -164,10 +168,12 @@ case $COMMAND in
        publish_server_key
        ;;
 
-    'trust-keys'|'t')
+    'trust-keys'|'trust-key'|'t')
        if [ -z "$1" ] ; then
            failure "you must specify at least one key to trust."
        fi
+
+       # process key IDs
        for keyID ; do
            trust_key "$keyID"
        done
@@ -182,8 +188,15 @@ case $COMMAND in
        if [ -z "$1" ] ; then
            failure "you must specify at least one userid."
        fi
+
+       # set variables for the user
        AUTHORIZED_USER_IDS="$MS_HOME"/authorized_user_ids/"$uname"
        cacheDir="$CACHE"/"$uname"/user_keys
+
+        # make sure user's authorized_user_ids file exists
+       touch "$AUTHORIZED_USER_IDS"
+
+       # process the user IDs
        for userID ; do
            update_userid "$userID" "$cacheDir"
        done