| 1 | ### -*-m4-*- |
| 2 | ### |
| 3 | ### User-configurable spam filtering for distorted.org.uk Exim configuration |
| 4 | ### |
| 5 | ### (c) 2012 Mark Wooding |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This program is free software; you can redistribute it and/or modify |
| 11 | ### it under the terms of the GNU General Public License as published by |
| 12 | ### the Free Software Foundation; either version 2 of the License, or |
| 13 | ### (at your option) any later version. |
| 14 | ### |
| 15 | ### This program is distributed in the hope that it will be useful, |
| 16 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | ### GNU General Public License for more details. |
| 19 | ### |
| 20 | ### You should have received a copy of the GNU General Public License |
| 21 | ### along with this program; if not, write to the Free Software Foundation, |
| 22 | ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 | |
| 24 | DIVERT(null) |
| 25 | ###-------------------------------------------------------------------------- |
| 26 | ### User-configurable spam thresholds. |
| 27 | |
| 28 | m4_define(<:USER_SPAMLIMIT_ROUTER:>, |
| 29 | <:SPAMLIMIT_ROUTER(fetch_spam_limit_$1_$2) |
| 30 | check_local_user |
| 31 | local_part_suffix = CONF_user_suffix_list |
| 32 | local_part_suffix_optional = true |
| 33 | $3:>) |
| 34 | |
| 35 | m4_define(<:USER_SPAMLIMIT_ROUTERS:>, |
| 36 | <:USER_SPAMLIMIT_ROUTER(<:lookup:>, <:$1:>, |
| 37 | <:$5SPAMLIMIT_LOOKUP(<:CONF_userconf_dir/spam-limit:>, |
| 38 | <:$2:>, <:$3:>, <:$4:>, <:user=$local_part:>):>) |
| 39 | USER_SPAMLIMIT_ROUTER(<:userv:>, <:$1:>, |
| 40 | <:$5SPAMLIMIT_USERV(<:$local_part:>, |
| 41 | <:$2:>, <:$3:>, <:$4:>, <:user=$local_part:>):>):>) |
| 42 | |
| 43 | m4_define(<:CURRENT_LOCAL_PART:>, |
| 44 | <:$local_part_prefix$local_part$local_part_suffix:>) |
| 45 | |
| 46 | m4_define(<:ORIGINAL_ADDRESS:>, <:$original_local_part@$original_domain:>) |
| 47 | m4_define(<:PARENT_ADDRESS:>, <:$parent_local_part@$parent_domain:>) |
| 48 | m4_define(<:CURRENT_ADDRESS:>, <:CURRENT_LOCAL_PART@$domain:>) |
| 49 | |
| 50 | SECTION(routers, allspam)m4_dnl |
| 51 | ## If we're verifying an address and the recipient has a `~/.mail/spam-limit' |
| 52 | ## file, then look up the recipient and sender addresses to find a plausible |
| 53 | ## limit and insert it into the `address_data' where the RCPT ACL can find |
| 54 | ## it. This router always declines, so it doesn't affect the overall outcome |
| 55 | ## of the verification. |
| 56 | ## |
| 57 | ## As a result of forwarding and aliasing, the original envelope recipient |
| 58 | ## may have been set a while ago, so we'll search through the history until |
| 59 | ## we find a match. |
| 60 | USER_SPAMLIMIT_ROUTERS(<:original:>, |
| 61 | <:$original_local_part:>, <:$original_domain:>, <:$sender_address:>, |
| 62 | <:condition = ${if !eq{ORIGINAL_ADDRESS}{PARENT_ADDRESS}} |
| 63 | :>) |
| 64 | USER_SPAMLIMIT_ROUTERS(<:parent:>, |
| 65 | <:$parent_local_part:>, <:$parent_domain:>, <:$sender_address:>, |
| 66 | <:condition = ${if !eq{PARENT_ADDRESS}{CURRENT_ADDRESS}} |
| 67 | :>) |
| 68 | USER_SPAMLIMIT_ROUTERS(<:current:>, |
| 69 | <:CURRENT_LOCAL_PART:>, <:$domain:>, <:$sender_address:>) |
| 70 | |
| 71 | DIVERT(null) |
| 72 | ###----- That's all, folks -------------------------------------------------- |