Skip to content

Commit e66b94d

Browse files
committed
issue trusteddomainproject#222: Don't treat empty body as partial if "Minimum" option is set.
* opendkim/opendkim.c (mlfi_eom)
1 parent 551ab38 commit e66b94d

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

opendkim/opendkim.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14026,29 +14026,33 @@ mlfi_eom(SMFICTX *ctx)
1402614026
sig, &bodylen,
1402714027
&canonlen, NULL);
1402814028

14029-
if (conf->conf_sigmintype == SIGMIN_PERCENT)
14029+
/* In the case body is empty, we don't treat it as partial */
14030+
if (bodylen)
1403014031
{
14031-
size_t signpct;
14032+
if (conf->conf_sigmintype == SIGMIN_PERCENT)
14033+
{
14034+
size_t signpct;
1403214035

14033-
signpct = (100 * canonlen) / bodylen;
14036+
signpct = (100 * canonlen) / bodylen;
1403414037

14035-
if (signpct < conf->conf_sigmin)
14036-
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14037-
}
14038-
else if (conf->conf_sigmintype == SIGMIN_MAXADD)
14039-
{
14040-
if (canonlen + conf->conf_sigmin < bodylen)
14041-
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14042-
}
14043-
else
14044-
{
14045-
size_t required;
14038+
if (signpct < conf->conf_sigmin)
14039+
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14040+
}
14041+
else if (conf->conf_sigmintype == SIGMIN_MAXADD)
14042+
{
14043+
if (canonlen + conf->conf_sigmin < bodylen)
14044+
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14045+
}
14046+
else
14047+
{
14048+
size_t required;
1404614049

14047-
required = MIN(conf->conf_sigmin,
14048-
bodylen);
14050+
required = MIN(conf->conf_sigmin,
14051+
bodylen);
1404914052

14050-
if (canonlen < required)
14051-
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14053+
if (canonlen < required)
14054+
dfc->mctx_status = DKIMF_STATUS_PARTIAL;
14055+
}
1405214056
}
1405314057
}
1405414058
}

0 commit comments

Comments
 (0)