Skip to content

Commit

Permalink
Merge pull request trusteddomainproject#211 from branciar/lua_fixes
Browse files Browse the repository at this point in the history
Fix issue trusteddomainproject#213: Enforces activation of SMFIF_ADDRCPT,
SMFIF_DELRCPT, SMFIF_CHGHDRS and SMFIF_QUARANTINE capabilities
if FinalPolicyScript is defined in opendkim.conf, so that the
LUA final policy script functions odkim.add_rcpt, odkim.del_rcpt,
odkim.del_header and odkim.quarantine actually work regardless of
other configuration parameters.
  • Loading branch information
futatuki committed Apr 26, 2024
2 parents 2e3ec75 + 436070b commit 6c3817b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions opendkim/opendkim.c
Original file line number Diff line number Diff line change
Expand Up @@ -11019,15 +11019,26 @@ mlfi_negotiate(SMFICTX *ctx,
# ifdef _FFR_VBR
conf->conf_vbr_purge ||
# endif /* _FFR_VBR */
# ifdef USE_LUA
conf->conf_finalscript != NULL ||
# endif /* USE_LUA */
conf->conf_remsigs)
reqactions |= SMFIF_CHGHDRS;

# ifdef SMFIF_QUARANTINE
# ifdef USE_LUA
if (conf->conf_capture || conf->conf_finalscript != NULL)
# else /* USE_LUA */
if (conf->conf_capture)
# endif /* USE_LUA */
reqactions |= SMFIF_QUARANTINE;
# endif /* SMFIF_QUARANTINE */

# ifdef USE_LUA
if (conf->conf_redirect != NULL || conf->conf_finalscript != NULL)
# else /* USE_LUA */
if (conf->conf_redirect != NULL)
# endif /* USE_LUA */
{
reqactions |= SMFIF_ADDRCPT;
reqactions |= SMFIF_DELRCPT;
Expand Down Expand Up @@ -16966,7 +16977,11 @@ main(int argc, char **argv)

smfilter.xxfi_flags = SMFIF_ADDHDRS;

#ifdef USE_LUA
if (curconf->conf_redirect != NULL || curconf->conf_finalscript != NULL)
#else /* USE_LUA */
if (curconf->conf_redirect != NULL)
#endif /* USE_LUA */
{
smfilter.xxfi_flags |= SMFIF_ADDRCPT;
smfilter.xxfi_flags |= SMFIF_DELRCPT;
Expand All @@ -16984,10 +16999,17 @@ main(int argc, char **argv)
#ifdef _FFR_VBR
curconf->conf_vbr_purge ||
#endif /* _FFR_VBR */
#ifdef USE_LUA
curconf->conf_finalscript != NULL ||
#endif /* USE_LUA */
curconf->conf_remsigs)
smfilter.xxfi_flags |= SMFIF_CHGHDRS;
#ifdef SMFIF_QUARANTINE
#ifdef USE_LUA
if (curconf->conf_capture || curconf->conf_finalscript != NULL)
#else /* USE_LUA */
if (curconf->conf_capture)
#endif /* USE_LUA */
smfilter.xxfi_flags |= SMFIF_QUARANTINE;
#endif /* SMFIF_QUARANTINE */

Expand Down

0 comments on commit 6c3817b

Please sign in to comment.