From: Jameson Graef Rollins Date: Sat, 11 Jul 2009 20:26:26 +0000 (-0400) Subject: Merge commit 'mlcastle/master' X-Git-Tag: monkeysphere_0.25~25^2~3 X-Git-Url: https://codewiz.org/gitweb?p=monkeysphere.git;a=commitdiff_plain;h=f3a03d72bc9c01491fc1cfccdbcef353db058548;hp=-c Merge commit 'mlcastle/master' --- f3a03d72bc9c01491fc1cfccdbcef353db058548 diff --combined src/share/common index 76b539f,c88857e..8e2232d --- a/src/share/common +++ b/src/share/common @@@ -291,7 -291,8 +291,8 @@@ Please specify how long the key should y = key expires in n years EOF while [ -z "$keyExpire" ] ; do - read -p "Key is valid for? (0) " keyExpire + printf "Key is valid for? (0) " >&2 + read keyExpire if ! test_gpg_expire ${keyExpire:=0} ; then echo "invalid value" >&2 unset keyExpire @@@ -483,12 -484,6 +484,12 @@@ get_homedir() eval "echo ~${uname}" } +# return the primary group of a user +get_primary_group() { + local uname=${1:-`whoami`} + groups "$uname" | sed 's/^..* : //' | awk '{ print $1 }' +} + ### CONVERSION UTILITIES # output the ssh key for a given key ID diff --combined src/share/mh/add_revoker index c83cb24,e58995b..89e6fcf --- a/src/share/mh/add_revoker +++ b/src/share/mh/add_revoker @@@ -64,7 -64,7 +64,7 @@@ els # fix permissions and ownership on temporary directory which will # be used by monkeysphere user for storing the downloaded key chmod 0700 "$tmpDir" - chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_USER" "$tmpDir" + chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$tmpDir" # download the key from the keyserver as the monkeysphere user log verbose "searching keyserver $KEYSERVER for keyID $keyID..." @@@ -90,8 -90,8 +90,8 @@@ EO su_monkeysphere_user "GNUPGHOME=$tmpDir gpg --fingerprint 0x${fingerprint}!" if [ "$PROMPT" = "true" ] ; then - read -p "Are you sure you want to add the above key as a revoker - of the host key? (Y/n) " OK; OK=${OK:-Y} + printf "Are you sure you want to add the above key as a revoker\nof the host key? (Y/n) " >&2 + read OK; OK=${OK:-Y} if [ "${OK/y/Y}" != 'Y' ] ; then failure "revoker not added." fi diff --combined src/share/mh/publish_key index ab1b2dc,f6e1c0f..48e4cbb --- a/src/share/mh/publish_key +++ b/src/share/mh/publish_key @@@ -18,7 -18,8 +18,8 @@@ publish_key() local GNUPGHOME if [ "$PROMPT" = "true" ] ; then - read -p "Really publish host key to $KEYSERVER? (Y/n) " OK; OK=${OK:=Y} + printf "Really publish host key to $KEYSERVER? (Y/n) " >&2 + read OK; OK=${OK:=Y} if [ "${OK/y/Y}" != 'Y' ] ; then failure "key not published." fi @@@ -29,7 -30,7 +30,7 @@@ f # create a temporary gnupg directory from which to publish the key export GNUPGHOME=$(msmktempdir) chmod 0700 "$GNUPGHOME" -chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_USER" "$GNUPGHOME" +chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$GNUPGHOME" # trap to remove tmp dir if break trap "rm -rf $GNUPGHOME" EXIT