Re: [exim] hostlist +ignore_defer feature request

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Exim Mailing List
Αντικείμενο: Re: [exim] hostlist +ignore_defer feature request
On Wed, 20 Jun 2007, Dean Brooks wrote:

> Thing is, for a whitelist, I don't really care, and would prefer to
> be able to add:
>
>    +ignore_defer

>
> or something around the host names in that file.


I have implemented this (along with +include_defer for completeness) and
committed the patch, which I'll also put below (against 4.67). Please
test.

Philip

--
Philip Hazel, University of Cambridge Computing Service.



*** src/match.c   Tue Apr 17 14:06:39 2007
--- match.c    Tue Jun 26 10:23:34 2007
***************
*** 444,449 ****
--- 444,451 ----
  unsigned int *original_cache_bits = *cache_ptr;
  BOOL include_unknown = FALSE;
  BOOL ignore_unknown = FALSE;
+ BOOL include_defer = FALSE;
+ BOOL ignore_defer = FALSE;
  uschar *list;
  uschar *sss;
  uschar *ot = NULL;
***************
*** 553,562 ****
        }
      }


! /* If the host item is "+include_unknown", remember it in case there's a
! subsequent failed reverse lookup. */

!   else if (type == MCL_HOST)
      {
      if (Ustrcmp(ss, "+include_unknown") == 0)
        {
--- 555,565 ----
        }
      }


! /* If the host item is "+include_unknown" or "+ignore_unknown", remember it
! in case there's a subsequent failed reverse lookup. There is similar
! processing for "defer". */

!   else if (type == MCL_HOST && *ss == '+')
      {
      if (Ustrcmp(ss, "+include_unknown") == 0)
        {
***************
*** 570,575 ****
--- 573,590 ----
        include_unknown = FALSE;
        continue;
        }
+     if (Ustrcmp(ss, "+include_defer") == 0)
+       {
+       include_defer = TRUE;
+       ignore_defer = FALSE;
+       continue;
+       }
+     if (Ustrcmp(ss, "+ignore_defer") == 0)
+       {
+       ignore_defer = TRUE;
+       include_defer = FALSE;
+       continue;
+       }
      }


    /* Starting with ! specifies a negative item. It is theoretically possible
***************
*** 724,729 ****
--- 739,759 ----
          return yield;


          case DEFER:
+         if (error == NULL)
+           error = string_sprintf("DNS lookup of %s deferred", ss);
+         if (ignore_defer)
+           {
+           HDEBUG(D_lists) debug_printf("%s: item ignored by +ignore_defer\n",
+             error);
+           break;
+           }
+         HDEBUG(D_lists) debug_printf("%s %s (%s)\n", ot,
+           include_defer? "yes":"no", error);
+         if (include_defer)
+           {
+           log_write(0, LOG_MAIN, "%s: accepted by +include_defer", error);
+           return OK;
+           }
          goto DEFER_RETURN;


          /* The ERROR return occurs when checking hosts, when either a forward
***************
*** 823,829 ****
--- 853,874 ----
          return file_yield;


          case DEFER:
+         if (error == NULL)
+           error = string_sprintf("DNS lookup of %s deferred", ss);
+         if (ignore_defer)
+           {
+           HDEBUG(D_lists) debug_printf("%s: item ignored by +ignore_defer\n",
+             error);
+           break;
+           }
          (void)fclose(f);
+         HDEBUG(D_lists) debug_printf("%s %s (%s)\n", ot,
+           include_defer? "yes":"no", error);
+         if (include_defer)
+           {
+           log_write(0, LOG_MAIN, "%s: accepted by +include_defer", error);
+           return OK;
+           }
          goto DEFER_RETURN;


          case ERROR:          /* host name lookup failed - this can only */