Merge commit 'dkg/master'
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 21 Feb 2009 21:48:43 +0000 (16:48 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Sat, 21 Feb 2009 21:48:43 +0000 (16:48 -0500)
src/monkeysphere
src/share/ma/add_certifier
src/share/mh/add_hostname
src/share/mh/add_revoker
src/share/mh/revoke_hostname
tests/basic

index 0d8f4ff8011adb8882ee6f6a4b6b47212b02723d..371983f2fb82ac962fedb04475789d0e1389aa11 100755 (executable)
@@ -87,9 +87,7 @@ check_gpg_sec_key_id() {
            ;;
        *)
            echo "Multiple primary secret keys found:"
-           for key in $(echo "$gpgSecOut" | cut -d: -f5) ; do
-               echo "  $key"
-           done
+           echo "$gpgSecOut" | cut -d: -f5
            echo "Please specify which primary key to use."
            failure
            ;;
@@ -124,7 +122,7 @@ check_gpg_authentication_subkey() {
        fi
        # if authentication key is valid, prompt to continue
        if [ "$validity" = 'u' ] ; then
-           echo "A valid authentication key already exists for primary key '$keyID'."
+           echo "A valid authentication key already exists for primary key '$keyID'." 1>&2
            if [ "$PROMPT" = "true" ] ; then
                read -p "Are you sure you would like to generate another one? (y/N) " OK; OK=${OK:N}
                if [ "${OK/y/Y}" != 'Y' ] ; then
index a48db6481909a070d7e73c9defc9bbe25538c63b..6f85ecfb904321906409af414b6c7503ce611e1c 100644 (file)
@@ -120,7 +120,17 @@ else
     # get the full fingerprint of new certifier key
     log debug "getting fingerprint of certifier key..."
     fingerprint=$(gpg_sphere "--list-key --with-colons --with-fingerprint 0x${keyID}!" \
-       | grep '^fpr:' | grep "$keyID" | cut -d: -f10)
+       | grep '^fpr:' | cut -d: -f10)
+
+    # test that there is only a single fingerprint
+    if (( $(echo "$fingerprint" | wc -l) != 1 )) ; then
+       cat <<EOF
+More than one fingerprint found:
+$fingerprint
+Please use a more specific key ID.
+EOF
+       failure
+    fi
 
     log info "key found:"
     gpg_sphere "--fingerprint 0x${fingerprint}!"
index ec741ee5a114f8eb99cfc3e99f15d6a202c91a18..b08d688a91f1230f983439259c2aaab9aabf4128 100644 (file)
@@ -32,11 +32,9 @@ find_host_userid > /dev/null && \
     failure "Host userID '$userID' already exists."
 
 if [ "$PROMPT" = "true" ] ; then
-    cat <<EOF
-The following user ID will be added to the host key:
+    read -p "The following user ID will be added to the host key:
   $userID
-EOF
-    read -p "Are you sure you would like to add this user ID? (Y/n) " OK; OK=${OK:=Y}
+Are you sure you would like to add this user ID? (Y/n) " OK; OK=${OK:=Y}
     if [ "${OK/y/Y}" != 'Y' ] ; then
        failure "User ID not added."
     fi
index 18ad2b7a8f8a76b117fa2ff208063f8be65cdd32..03ae56fe5374f435f19735feaacf483ed3113e05 100644 (file)
@@ -74,14 +74,24 @@ else
     # get the full fingerprint of new revoker key
     log debug "getting fingerprint of revoker key..."
     fingerprint=$(su_monkeysphere_user "GNUPGHOME=$tmpDir gpg --list-key --with-colons --with-fingerprint 0x${keyID}!" \
-       | grep '^fpr:' | grep "$keyID" | cut -d: -f10)
+       | grep '^fpr:' | cut -d: -f10)
+
+    # test that there is only a single fingerprint
+    if (( $(echo "$fingerprint" | wc -l) != 1 )) ; then
+       cat <<EOF
+More than one fingerprint found:
+$fingerprint
+Please use a more specific key ID.
+EOF
+       failure
+    fi
 
     log info "key found:"
     su_monkeysphere_user "GNUPGHOME=$tmpDir gpg --fingerprint 0x${fingerprint}!"
 
     if [ "$PROMPT" = "true" ] ; then
-       echo "Are you sure you want to add the above key as a revoker"
-       read -p "of the host key? (Y/n) " OK; OK=${OK:-Y}
+       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}
        if [ "${OK/y/Y}" != 'Y' ] ; then
            failure "revoker not added."
        fi
index 12158287d47d490d045fb1530cb5fa46cf73e72d..2142af7dbeb424757b94d58516b33b6e12a927cc 100644 (file)
@@ -43,11 +43,9 @@ uidIndex=$(find_host_userid) || \
     failure "No non-revoked user ID found matching '$userID'."
 
 if [ "$PROMPT" = "true" ] ; then
-    cat <<EOF
-The following host key user ID will be revoked:
+    read -p "The following host key user ID will be revoked:
   $userID
-EOF
-    read -p "Are you sure you would like to revoke this user ID? (Y/n) " OK; OK=${OK:=Y}
+Are you sure you would like to revoke this user ID? (Y/n) " OK; OK=${OK:=Y}
     if [ "${OK/y/Y}" != 'Y' ] ; then
        failure "User ID not revoked."
     fi
index c7c4b07fe8b79cdd95220a7f81238221dba45935..9c5b280a7134b22a32c4e0336db84ced3ddf5f5c 100755 (executable)
@@ -65,20 +65,16 @@ ssh_test() {
        sleep 1
     done
 
-    set +e
-
     # make a client connection to the socket
     echo "##### starting ssh client..."
     ssh-agent bash -c \
-       "monkeysphere subkey-to-ssh-agent && ssh -F $TEMPDIR/testuser/.ssh/config testhost true"
-    RETURN="$?"
+       "monkeysphere subkey-to-ssh-agent && ssh -F $TEMPDIR/testuser/.ssh/config testhost true" \
+       || RETURN="$?"
 
     # kill the sshd process if it's still running
     kill "$SSHD_PID"
     SSHD_PID=
 
-    set -e
-
     echo "##### return $RETURN"
     if [ "$RETURN" = "$CODE" ] ; then
        echo "##### ssh connection test returned as desired"