From 436070b3359f656e40c0e015ef893eb2852ffbcd Mon Sep 17 00:00:00 2001 From: Benoit Branciard Date: Tue, 2 Apr 2024 19:31:22 +0200 Subject: [PATCH] Enforce SMFIF_ADDRCPT, SMFIF_DELRCPT, SMFIF_CHGHDRS and SMFIF_QUARANTINE if FinalPolicyScript is set so that odkim.add_rcpt, odkim.del_rcpt, odkim.del_header and odkim.quarantine work predictably regardless of other configuration parameters --- opendkim/opendkim.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/opendkim/opendkim.c b/opendkim/opendkim.c index 803f37b0..c3e35020 100644 --- a/opendkim/opendkim.c +++ b/opendkim/opendkim.c @@ -11005,15 +11005,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; @@ -16900,7 +16911,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; @@ -16918,10 +16933,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 */