Skip to content

Commit

Permalink
issue trusteddomainproject#222: Don't treat empty body as partial if …
Browse files Browse the repository at this point in the history
…"Minimum" option is set.

* opendkim/opendkim.c (mlfi_eom)
  • Loading branch information
futatuki committed Aug 24, 2024
1 parent 551ab38 commit e66b94d
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions opendkim/opendkim.c
Original file line number Diff line number Diff line change
Expand Up @@ -14026,29 +14026,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 e66b94d

Please sign in to comment.