|
|
|
@ -115,11 +115,21 @@ def check(msg, GNUPG_DIRECTORY, accept_public_key=True, beta=False): |
|
|
|
|
yield MailTest("Standalone non-armored signature file discovered. Avoid using binary signature over SMTP (see RFC2015 #2. PGP data formats).", 2) |
|
|
|
|
yield (part.get_payload(decode=True), lpart.get_payload(decode=True)) |
|
|
|
|
|
|
|
|
|
elif part.get_filename() is not None and (part.get_filename()[len(part.get_filename())-4:] == ".gpg" or part.get_filename()[len(part.get_filename())-4:] == ".asc") or ( |
|
|
|
|
payload is not None and not part.is_multipart() and part.get_payload(decode=True).find(b"-----BEGIN PGP MESSAGE-----") >= 0): |
|
|
|
|
elif payload is not None and not part.is_multipart() and part.get_payload(decode=True).find(b"-----BEGIN PGP MESSAGE-----") >= 0: |
|
|
|
|
yield MailTest("Standalone PGP message discovered.") |
|
|
|
|
yield part.get_payload(decode=True) |
|
|
|
|
|
|
|
|
|
elif part.get_filename() is not None and (part.get_filename()[len(part.get_filename())-4:] == ".gpg" or part.get_filename()[len(part.get_filename())-4:] == ".asc"): |
|
|
|
|
yield MailTest("Standalone PGP message discovered with mismatched content-type: %s. This can lead to unexpected behaviour." % part.get_content_type(), 2) |
|
|
|
|
data = part.get_payload(decode=True) |
|
|
|
|
|
|
|
|
|
mime = _guess_mime(data) |
|
|
|
|
if mime == "application/octet-stream": |
|
|
|
|
yield MailTest("Non-armored file discovered. Avoid using binary PGP message over SMTP (see RFC2015 #2. PGP data formats).", 2) |
|
|
|
|
yield MailTest("Falling back to default automation as nothing helped. Be warned it'll most likely failed.", 2) |
|
|
|
|
|
|
|
|
|
yield data |
|
|
|
|
|
|
|
|
|
lpart = part |
|
|
|
|
|
|
|
|
|
def skip(msg, gpgmail): |
|
|
|
|