[Exim] [patch] +allow_address

Pàgina inicial
Delete this message
Reply to this message
Autor: J. Nick Koston
Data:  
A: exim-users
Assumpte: [Exim] [patch] +allow_address
    I don't know if anybody will find this useful (maybe I'm reinventing
the wheel), but I run a pop before relay system and it always annoyed me that
if the ip didn't have a reverse name it would always get rejected by exim to
relay. adding +allow_address in from of the hosts_accept_relay =
lsearch;/etc/relayhosts now lets that mail go though.. Its kinda bad that
users with bad rdns get rejected in this situation. However, there are many
reasons why you don't want this turned on :-)

        Nick



[[[[[[[[[[[[begin patch]]]]]]]]]]]]]]]]]]]]]
--- src/verify.c.orig   Tue Nov 30 04:31:41 1999
+++ src/verify.c        Wed Dec 15 13:18:37 1999
@@ -1232,7 +1232,7 @@


 static int
 check_host(char *ss, char *host_name, char *host_address, char *host_ipv4,
-  char *host_ident)
+  char *host_ident, BOOL allow_address)
 {
 int matchyield;
 int maskoffset;
@@ -1443,7 +1443,18 @@
   {
   if (sender_host_name == NULL)
     {
-    if (host_lookup_failed || !host_name_lookup()) return hm_ff;
+    if (host_lookup_failed || !host_name_lookup())
+      {
+      if (allow_address)
+        {
+        if (match_check_string(sender_host_address, ss, -1, TRUE, TRUE, NULL))
+          {
+          return matchyield;
+          }
+        }
+
+        return hm_ff;
+      }
     host_build_sender_fullhost();
     }


@@ -1522,6 +1533,7 @@
 BOOL endyield = FALSE;
 BOOL ffr = find_failed_return;
 BOOL log_unknown = FALSE;
+BOOL allow_address = FALSE;
 char *ss;
 char *list = *listptr;
 char *ot = NULL;
@@ -1566,12 +1578,17 @@
     continue;
     }


+  if (strcmp(ss, "+allow_address") == 0)
+    {
+    allow_address = TRUE;
+    continue;
+    }
   /* If the item does not start with / or !/ it is a single item (but allow
   for spaces after the !) */


   if (ss[strspn(ss, "! \t")] != '/')
     {
-    switch(check_host(ss, host_name, host_address, host_ipv4, host_ident))
+    switch(check_host(ss, host_name, host_address, host_ipv4, host_ident, allow_address))
       {
       case hm_yes:         /* matched a positive item */
       HDEBUG(2) debug_printf("%s yes (%s)\n", ot, ss);
@@ -1640,7 +1657,7 @@


       if (*ss == 0) continue;                           /* ignore empty */


-      switch(check_host(ss, host_name, host_address, host_ipv4, host_ident))
+      switch(check_host(ss, host_name, host_address, host_ipv4, host_ident, allow_address))
         {
         case hm_yes:         /* matched a positive item */
         HDEBUG(2) debug_printf("%s %s (%s in %s)\n", ot, yes? "yes" : "no",
--- src/expand.c.orig   Wed Dec 15 13:51:31 1999
+++ src/expand.c        Wed Dec 15 13:51:42 1999
@@ -819,7 +819,7 @@
     if (name[0] == 'p')
       {
       int rc = auth_call_pam(sub, &expand_string_message);
-      if (rc == ERROR) return s;
+      if (rc == ERROR) return NULL;
       *yield = (rc == OK) == testfor;
       }
     else   
[[[[[[[end patch]]]]]]]]]]]]]
--