Commit 41cbf47
committed
mlfi_eoh: emit dkim=permerror for malformed DKIM-Signature headers (#194)
When dkim_header() returns DKIM_STAT_SYNTAX (malformed DKIM-Signature),
mlfi_eoh() was setting ms and returning early, bypassing mlfi_eom()
entirely. With AlwaysAddARHeader or SoftwareHeader enabled this meant
the message was accepted silently with no Authentication-Results header,
making mail with a bad signature indistinguishable from mail that was
never processed by OpenDKIM.
RFC 8601 section 2.7.1 defines dkim=permerror for exactly this case.
Fix: when dkim_header() returns DKIM_STAT_SYNTAX, set mctx_headeronly,
mctx_addheader, and mctx_status=DKIMF_STATUS_BADFORMAT instead of
setting ms. mlfi_eoh() returns SMFIS_CONTINUE, the body is skipped via
the existing mctx_headeronly path in mlfi_body(), and mlfi_eom()'s
mctx_headeronly branch emits dkim=permerror and accepts.
Also guard the DKIM_STAT_NOSIG branch in the dkim_eoh() result switch
so it does not overwrite a BADFORMAT status already set from the header
loop (a handle with a bad DKIM-Signature yields NOSIG from
dkim_eoh_verify() once the bad sig's set_bad flag is set).
Add t-test208 to confirm the library behaviour the fix relies on:
dkim_header() returns DKIM_STAT_SYNTAX for a malformed DKIM-Signature,
the handle remains usable, and dkim_eoh() returns DKIM_STAT_NOSIG.1 parent 9def476 commit 41cbf47
3 files changed
Lines changed: 111 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13477 | 13477 | | |
13478 | 13478 | | |
13479 | 13479 | | |
13480 | | - | |
13481 | | - | |
| 13480 | + | |
| 13481 | + | |
| 13482 | + | |
| 13483 | + | |
| 13484 | + | |
| 13485 | + | |
| 13486 | + | |
| 13487 | + | |
| 13488 | + | |
| 13489 | + | |
| 13490 | + | |
| 13491 | + | |
| 13492 | + | |
| 13493 | + | |
| 13494 | + | |
| 13495 | + | |
| 13496 | + | |
| 13497 | + | |
13482 | 13498 | | |
13483 | 13499 | | |
13484 | 13500 | | |
| |||
13571 | 13587 | | |
13572 | 13588 | | |
13573 | 13589 | | |
13574 | | - | |
13575 | | - | |
13576 | | - | |
| 13590 | + | |
| 13591 | + | |
| 13592 | + | |
| 13593 | + | |
| 13594 | + | |
| 13595 | + | |
| 13596 | + | |
13577 | 13597 | | |
13578 | 13598 | | |
13579 | 13599 | | |
| |||
0 commit comments