From 55369617d8c00de548fabfbad02ba444f701be43 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Mon, 9 Feb 2009 00:47:17 -0500 Subject: [PATCH] break su_monkeysphere_user into common function, since it will likely be needed by both m-host and m-auth for communicating with keyservers. --- src/monkeysphere-authentication | 15 +-------------- src/monkeysphere-host | 13 ------------- src/share/common | 13 +++++++++++++ 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index 4485bd4..6d2e72c 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -70,19 +70,6 @@ subcommands: EOF } -# function to run command as monkeysphere user -su_monkeysphere_user() { - # 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 gpg core keyring gpg_core() { GNUPGHOME="$GNUPGHOME_CORE" @@ -184,7 +171,7 @@ case $COMMAND in list_certifiers "$@" ;; - 'expert'|'e') + 'expert') SUBCOMMAND="$1" shift case "$SUBCOMMAND" in diff --git a/src/monkeysphere-host b/src/monkeysphere-host index 3c2e3ee..506dcf9 100755 --- a/src/monkeysphere-host +++ b/src/monkeysphere-host @@ -68,19 +68,6 @@ subcommands: EOF } -# function to run command as monkeysphere user -su_monkeysphere_user() { - # 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 gpg keyring gpg_host() { GNUPGHOME="$GNUPGHOME_HOST" gpg "$@" diff --git a/src/share/common b/src/share/common index 00a1008..2a20c1c 100644 --- a/src/share/common +++ b/src/share/common @@ -90,6 +90,19 @@ log() { done } +# run command as monkeysphere user +su_monkeysphere_user() { + # 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 +} + # cut out all comments(#) and blank lines from standard input meat() { grep -v -e "^[[:space:]]*#" -e '^$' "$1" -- 2.25.1