add tests to add_revoker and add_certifier that more than one key was not found when...
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 21 Feb 2009 21:16:58 +0000 (16:16 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Sat, 21 Feb 2009 21:16:58 +0000 (16:16 -0500)
src/share/ma/add_certifier
src/share/mh/add_revoker

index a48db6481909a070d7e73c9defc9bbe25538c63b..eba689323bfe43d2d2a98511631595f69b651232 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:
+  echo $fingerprint
+Please use a more specific key ID.
+EOF
+       failure
+    fi
 
     log info "key found:"
     gpg_sphere "--fingerprint 0x${fingerprint}!"
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}!"