Merge commit 'mlcastle/master'
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 11 Jul 2009 20:26:26 +0000 (16:26 -0400)
committerJameson Graef Rollins <jrollins@finestructure.net>
Sat, 11 Jul 2009 20:26:26 +0000 (16:26 -0400)
1  2 
src/share/common
src/share/mh/add_revoker
src/share/mh/publish_key

diff --combined src/share/common
index 76b539f4ab89dc9ddd8d585a751f64ed4f514430,c88857e44adabca90d57bb02358bcce92d16f67d..8e2232d659350558e472bd5f37c365d050317b8d
@@@ -291,7 -291,8 +291,8 @@@ Please specify how long the key should 
        <n>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 c83cb24e3cff294a1ca8e3594b27332c63f7bbd3,e58995b3cff28acbb35ef0341d1308d046db3e7c..89e6fcf03210bc6d83da36b883b01a2d7b947f1e
@@@ -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 ab1b2dc055d3dfbafc01b5dd6d4ec2ef4e2f795e,f6e1c0f9b322cfaf3f623767189691d053c6d4a8..48e4cbb16169222895fb0902aa171a8647c17879
@@@ -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