add tests to add_revoker and add_certifier that more than one key was not found when...
[monkeysphere.git] / src / share / mh / add_revoker
index 18ad2b7a8f8a76b117fa2ff208063f8be65cdd32..50e8c67456d42a3fee0c68e09a8a4aa654bbdfe7 100644 (file)
@@ -74,7 +74,17 @@ 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:
+  echo $fingerprint
+Please use a more specific key ID.
+EOF
+       failure
+    fi
 
     log info "key found:"
     su_monkeysphere_user "GNUPGHOME=$tmpDir gpg --fingerprint 0x${fingerprint}!"