Re: [Exim] sender_domains precondition in routers (was Sourc…

Top Page
Delete this message
Reply to this message
Author: Wakko Warner
Date:  
To: exim-users
Old-Topics: Re: [Exim] Source mod problem
Subject: Re: [Exim] sender_domains precondition in routers (was Source mod problem)
I got my problem solved ::hides::

I noticed atleast one other person needing sender_domains pre-condition in
routers. I found a need for it myself. I needed to check +local_domains
but didn't know how to do this on senders pre-condition.

I made a small patch for this. I only tested this once so I'd like some
feedback if you use it.

This patch is against exim 4.20. The patch may apply to 4.14 but I have not
tested that.

Patch follows.  cd to src and run patch -p0 < thispatch
--->cut<---
diff -u ../../exim4-4.20/src/globals.c ./globals.c
--- globals.c-orig    Mon May 12 09:39:19 2003
+++ globals.c    Tue Jun 10 21:19:51 2003
@@ -727,6 +730,7 @@
     NULL,                      /* require_files */
     NULL,                      /* router_home_directory */
     US"freeze",                /* self */
+    NULL,                      /* sender_domainss */
     NULL,                      /* senders */
     NULL,                      /* suffix */
     NULL,                      /* translate_ip_address */
diff -u ../../exim4-4.20/src/route.c ./route.c
--- route.c-orig    Mon May 12 09:39:21 2003
+++ route.c    Tue Jun 10 21:35:21 2003
@@ -98,6 +98,8 @@
                  (void *)offsetof(router_instance, router_home_directory) },
   { "self",               opt_stringptr|opt_public,
                  (void *)(offsetof(router_instance, self)) },
+  { "sender_domains",     opt_stringptr|opt_public,
+                 (void *)offsetof(router_instance, sender_domains) },
   { "senders",            opt_stringptr|opt_public,
                  (void *)offsetof(router_instance, senders) },
   #ifdef SUPPORT_TRANSLATE_IP_ADDRESS
@@ -728,6 +730,7 @@
 {
 int rc;
 uschar *check_local_part;
+uschar *sender_domain;


/* Reset variables to hold a home directory and data from lookup of a domain or
local part, and ensure search_find_defer is unset, in case there aren't any
@@ -852,6 +855,17 @@
anyway, we don't want too much stuff for skipped routers). */

 debug_print_string(r->debug_string);
+
+/* Skip if the sender_domains condition is not met. We leave this one till
+after the local user check so that $home is set - enabling the possiblity of
+letting individual recipients specify lists of acceptable/unacceptable
+sender domains. */
+
+if ((rc = route_check_dls(r->name, US"sender_domains", r->sender_domains,
+     &domainlist_anchor, sender_domain_cache, MCL_DOMAIN,
+     ((sender_domain = Ustrrchr(sender_address, '@')) ? ++sender_domain : US""),
+     NULL, TRUE, perror)) != OK)
+  return rc;


 /* Skip if the sender condition is not met. We leave this one till after the
 local user check so that $home is set - enabling the possiblity of letting
diff -u ../../exim4-4.20/src/structs.h ./structs.h
--- structs.h-orig    Mon May 12 09:39:22 2003
+++ structs.h    Tue Jun 10 21:20:25 2003
@@ -239,6 +239,7 @@
   uschar *router_home_directory;  /* For use while routing */
   uschar *self;                   /* Text option for handling self reference */
   uschar *senders;                /* Specific senders */
+  uschar *sender_domains;                /* Specific sender domains */
   uschar *suffix;                 /* Address suffix */
   uschar *translate_ip_address;   /* IP address translation fudgery */
   uschar *transport_name;         /* Transport name */
--->cut<---


--
Lab tests show that use of micro$oft causes cancer in lab animals