add check to su_monkeysphere_user to not use su if the user is the
authorJameson Graef Rollins <jrollins@phys.columbia.edu>
Sat, 25 Oct 2008 17:33:09 +0000 (13:33 -0400)
committerJameson Graef Rollins <jrollins@phys.columbia.edu>
Sat, 25 Oct 2008 17:33:09 +0000 (13:33 -0400)
monkeysphere user.

src/monkeysphere-server

index d3ba5e44f788f5b768e355e01bff73639c294616..0c562799a3355a09207c7023e0d1044a7eea5451 100755 (executable)
@@ -66,8 +66,17 @@ subcommands:
 EOF
 }
 
+# function to run command as monkeysphere user
 su_monkeysphere_user() {
-    su "$MONKEYSPHERE_USER" -c "$@"
+    # if the current user is the monkeysphere user, then just eval
+    # command
+    if [ $(id -un) = "$MONKEYSPHERE_USER" ] ; then
+       eval "$@"
+
+    # otherwise su command as monkeysphere user
+    else
+       su "$MONKEYSPHERE_USER" -c "$@"
+    fi
 }
 
 # function to interact with the host gnupg keyring