[Exim] dnslists modification (2nd time)

Pàgina inicial
Delete this message
Reply to this message
Autor: Wakko Warner
Data:  
A: exim-users
Assumpte: [Exim] dnslists modification (2nd time)
Sorry, Philip, I had to modify it =)

I revoke last patch for this I posted in favor of this one.

Usage:
    deny dnslists = some.blacklist.org!=127.0.0.3,127.0.0.4


This is only an example. This means that if the IP is on the blacklist and
matches the list, it will fail (thus will NOT deny).

If you have a question, feel free to ask me as I just ran out of time for
this email

Patch:
--- ../../exim4-4.20-orig/src/verify.c    Mon May 12 09:39:23 2003
+++ verify.c    Thu May 29 12:36:13 2003
@@ -2091,6 +2091,7 @@
   uschar *key;
   tree_node *t;
   dnsbl_cache_block *cb;
+  BOOL invert_result = FALSE;


HDEBUG(D_dnsbl) debug_printf("DNS list check: %s\n", domain);

@@ -2115,7 +2116,15 @@
/* See if there's a list of addresses supplied after the domain name */

   iplist = Ustrchr(domain, '=');
-  if (iplist != NULL) *iplist++ = 0;
+  if (iplist != NULL)
+    {
+    if (iplist > domain && iplist[-1] == '!')
+      {
+      invert_result = TRUE;
+      iplist[-1] = 0;
+      }
+    *iplist++ = 0;
+    }


   /* Construct the query by adding the domain onto either the sending host
   address, or the given key string. */
@@ -2222,13 +2231,13 @@
       behave as if the DNSBL lookup had not succeeded, i.e. the host is
       not on the list. */


-      if (da == NULL)
+      if (invert_result != (da == NULL))
         {
         HDEBUG(D_dnsbl)
       {
       debug_printf("DNS lookup for %s suceeded\n", query);
       debug_printf("=> but we are not accepting this block class because\n");
-          debug_printf("=> there was no match for %s\n", iplist);
+          debug_printf("=> there was %s match for %s\n", invert_result ? "an exclude" : "no", iplist);
       }
         continue;   /* With next DNSBL domain */
         }


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