comparison src/dnsbl.cpp @ 402:9096d2676c13

suppress duplicate calls to acceptable_content for messages with multiple recipients using the same filtering context
author Carl Byington <carl@five-ten-sg.com>
date Mon, 13 Mar 2017 19:09:59 -0700
parents dffedbdc8566
children e018ed19a1cc
comparison
equal deleted inserted replaced
401:775174f15b61 402:9096d2676c13
1659 return SMFIS_CONTINUE; 1659 return SMFIS_CONTINUE;
1660 } 1660 }
1661 1661
1662 sfsistat mlfi_eom(SMFICTX *ctx) 1662 sfsistat mlfi_eom(SMFICTX *ctx)
1663 { 1663 {
1664 sfsistat rc; 1664 sfsistat rc;
1665 mlfiPriv &priv = *MLFIPRIV; 1665 mlfiPriv &priv = *MLFIPRIV;
1666 const char *host = NULL; 1666 const char *host = NULL;
1667 uint32_t ip; 1667 uint32_t ip;
1668 // process end of message 1668 // process end of message
1669 priv.eom = true; 1669 priv.eom = true;
1694 (priv.fromaddr) ? priv.fromaddr : token_asterisk, *s); 1694 (priv.fromaddr) ? priv.fromaddr : token_asterisk, *s);
1695 my_syslog(&priv, buf); 1695 my_syslog(&priv, buf);
1696 } 1696 }
1697 } 1697 }
1698 1698
1699 CONTEXT *con = NULL;
1700 const char *st;
1699 for (context_map::iterator i=priv.env_to.begin(); i!=priv.env_to.end(); i++) { 1701 for (context_map::iterator i=priv.env_to.begin(); i!=priv.env_to.end(); i++) {
1700 const char *rcpt = (*i).first; 1702 const char *rcpt = (*i).first;
1701 CONTEXT &con = *((*i).second); 1703 CONTEXT *next = (*i).second;
1702 const char *st = con.acceptable_content(*priv.memory, score, bulk, priv.queueid, priv.dkim_signers, priv.fromaddr, &priv, msg); 1704 if (con != next) {
1705 con = next;
1706 st = con->acceptable_content(*priv.memory, score, bulk, priv.queueid, priv.dkim_signers, priv.fromaddr, &priv, msg);
1707 }
1703 if (st == token_black) { 1708 if (st == token_black) {
1704 // bad html tags or excessive hosts or 1709 // bad html tags or excessive hosts or
1705 // high spam assassin score or dcc bulk threshold exceedeed 1710 // high spam assassin score or dcc bulk threshold exceedeed
1706 // or signed by a dkim signer that we don't like 1711 // or signed by a dkim signer that we don't like
1707 // or header from requires dkim signer that is missing 1712 // or header from requires dkim signer that is missing
1723 smfi_delrcpt(ctx, (char*)rcpt); 1728 smfi_delrcpt(ctx, (char*)rcpt);
1724 } 1729 }
1725 else { 1730 else {
1726 // still unknown 1731 // still unknown
1727 unknowns.insert(rcpt); 1732 unknowns.insert(rcpt);
1728 random |= con.get_host_random(); 1733 random |= con->get_host_random();
1729 limit = max(limit, con.get_host_limit()); 1734 limit = max(limit, con->get_host_limit());
1730 } 1735 }
1731 } 1736 }
1732 else if (st == token_white) { 1737 else if (st == token_white) {
1733 priv.have_whites = true; 1738 priv.have_whites = true;
1734 } 1739 }