Skip to content

Commit

Permalink
Merge pull request trusteddomainproject#220 from futatuki/issue222-Mi…
Browse files Browse the repository at this point in the history
…nimum-setting-empty-body

Don't treat empty body as partial if "Minimum" option is set.
  • Loading branch information
futatuki committed Aug 24, 2024
2 parents 1341889 + 8f83e5f commit ad3ac8c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ release, and a summary of the changes in that release.
Fix issue #28: RequiredHeaders should report and log the specific
error and reject the message, as documented. Patch from
Dilyan Palauzov.
Fix issue #222: When the "Minimum" option is set, don't treat
empty body as partial. Patch from Yasuhito FUTATSUKI
(PR #223).
Fix bug #234: Make "NoHeaderB" do something. Reported by Joseph
Coffland.
Fix bug #235: Quote "header.b" values in case they contain a slash
Expand Down
40 changes: 22 additions & 18 deletions opendkim/opendkim.c
Original file line number Diff line number Diff line change
Expand Up @@ -14061,29 +14061,33 @@ mlfi_eom(SMFICTX *ctx)
sig, &bodylen,
&canonlen, NULL);

if (conf->conf_sigmintype == SIGMIN_PERCENT)
/* In the case body is empty, we don't treat it as partial */
if (bodylen)
{
size_t signpct;
if (conf->conf_sigmintype == SIGMIN_PERCENT)
{
size_t signpct;

signpct = (100 * canonlen) / bodylen;
signpct = (100 * canonlen) / bodylen;

if (signpct < conf->conf_sigmin)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
}
else if (conf->conf_sigmintype == SIGMIN_MAXADD)
{
if (canonlen + conf->conf_sigmin < bodylen)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
}
else
{
size_t required;
if (signpct < conf->conf_sigmin)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
}
else if (conf->conf_sigmintype == SIGMIN_MAXADD)
{
if (canonlen + conf->conf_sigmin < bodylen)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
}
else
{
size_t required;

required = MIN(conf->conf_sigmin,
bodylen);
required = MIN(conf->conf_sigmin,
bodylen);

if (canonlen < required)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
if (canonlen < required)
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
}
}
}
}
Expand Down

0 comments on commit ad3ac8c

Please sign in to comment.