chiark / gitweb /
user-spam.m4: Fix indentation in the output.
[exim-config] / vhost.m4
index 07ca79eba51a766a0b5b1ba655a1156d11c0fb33..f98b904798b8419ab0fd04d1478c6ed6833f9c07 100644 (file)
--- a/vhost.m4
+++ b/vhost.m4
 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 m4_define(<:VHOST:>,
-       <:domains = partial0-lsearch; CONF_sysconf_dir/domains.conf
-       condition = DOMKV($1):>)
+       <:domains = ${if exists{CONF_sysconf_dir/domains.conf} \
+                        {partial0-lsearch; CONF_sysconf_dir/domains.conf} \
+                        {}}:>)
 m4_define(<:VHOST_FILTER:>,
        <:FILTER_BASE
-       VHOST(<:$1:>)
-       $2 = ${expand:DOMKV($1, {$value} fail)}:>)
+       VHOST
+       condition = DOMKV($2, {true}{false})
+       router_home_directory = DOMKV(home, {$value} fail)
+       $1 = ${expand:DOMKV($2)}:>)
 m4_define(<:VHOST_USER:>,
        <:user = DOMKV(owner, {$value}{CONF_filter_user})
        errors_to = DOMKV(errors_to, {$value} fail):>)
@@ -37,33 +40,61 @@ m4_define(<:VHOST_USER:>,
 
 SECTION(routers, route)m4_dnl
 ## If we're a front-end for some other domain, or we have special information
-## about the domain, then pass stuff along as instructed.
-route:
+## about the domain, then pass stuff along as instructed.  The hack for the
+## `transport' is very nasty; see the commentary for `smtp'.
+virtual_route:
        driver = manualroute
        self = fail
-       VHOST(route)
-       route_data = DOMKV(route, {$value} fail)
+       VHOST
+       condition = DOMKV(route, {true}{false})
+       route_data = <;DOMKV(route)
        same_domain_copy_routing = true
-       transport = smtp
+       transport = DOMKV(tls-min-dh-bits, {smtp_dhbits_$value}{smtp})
        no_more
 
 SECTION(routers, virtual)m4_dnl
 ## Remap recipients according to the virtual host's instructions.  This must
 ## be done in two passes, so that we can identify the correct user's spam
 ## threshold during address verification.
-virtual_verify_data:
-       VHOST_FILTER(redirect, data)
-       FILTER_VERIFY
-virtual_verify_file:
-       VHOST_FILTER(filter, file)
-       FILTER_VERIFY
+FILTER_ROUTER(virtual_data,
+       <:VHOST_FILTER(data, redirect):>,, <:
+       VHOST_USER:>)
+FILTER_ROUTER(virtual_file,
+       <:VHOST_FILTER(file, filter):>,, <:
+       VHOST_USER:>)
 
-virtual_filter_data:
-       VHOST_FILTER(redirect, data)
-       VHOST_USER
-virtual_filter_file:
-       VHOST_FILTER(filter, file)
-       VHOST_USER
+SECTION(routers, virtual-spam)m4_dnl
+## If we're dealing with a virtual host, see if we have special spam-limit
+## rules to apply.
+SPAMLIMIT_ROUTER(virtual_spam_limit_lookup)
+       VHOST
+       condition = DOMKV(spam-limit-file, {true}{false})
+       SPAMLIMIT_LOOKUP(DOMKV(spam-limit-file),
+               $local_part, $domain, $sender_address)
+SPAMLIMIT_ROUTER(virtual_spam_limit_userv)
+       VHOST
+       condition = DOMKV(spam-limit-userv, {true}{false})
+       SPAMLIMIT_USERV(DOMKV(spam-limit-userv),
+               $local_part, $domain, $sender_address)
+
+SECTION(routers, virtual-tail)m4_dnl
+## Last ditch effort for required local parts.  This is a bit strange because
+## we should only try this for `final' domains -- where we're not going to
+## route using the system-wide rules -- and we want the router to decline if
+## the local part isn't one of our required set so that routing as a whole
+## fails.
+virtual_endstop:
+       VHOST
+       condition = DOMKV(final, {$value}{true})
+       driver = redirect
+       no_more
+       data = ${if match_local_part{$local_part}{+required} \
+                   {DOMKV(errors_to, \
+                          {$value} \
+                          {DOMKV(owner, \
+                                 {$value} \
+                                 {postmaster})})} \
+                   {:unknown:}}
 
 DIVERT(null)
 ###----- That's all, folks --------------------------------------------------