mailpipe: don't raise UnverifiedSignatureMessage for valid signatures.
authorW. Trevor King <wking@tremily.us>
Thu, 20 Sep 2012 17:24:01 +0000 (13:24 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Sep 2012 17:27:24 +0000 (13:27 -0400)
Before this patch, signatures like:

  ... signature
    summary:
      CRL missing: False
      CRL too old: False
      bad policy: False
      green: True
      key expired: False
      key missing: False
      key revoked: False
      red: False
      signature expired: False
      system error: False
      valid: True
    ...

would raise the exception.  Now they won't.

pygrader/mailpipe.py

index 281839b03c8dfe9f9266c74be953a555d9a07d14..d48c9e980098fcd843d0442fa12ba09bdbdd4c8b 100644 (file)
@@ -959,7 +959,11 @@ def _get_verified_message(message, pgp_key):
             fingerprints=fingerprints, decrypted=decrypted)
     signature = matches[0]
     if not verified:
-        if signature.get_summary() != 0:
+        problems = [k for k,v in signature.summary.items() if v]
+        for good in ['green', 'valid']:
+            if good in problems:
+                problems.remove(good)
+        if problems:
             raise UnverifiedSignatureMessage(
                 message=message, signature=signature, decrypted=decrypted)
         # otherwise, we may have an untrusted key.  We'll count that