[exim-cvs] cvs commit: exim/exim-doc/doc-docbook spec.xfpt …

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-doc/doc-docbook spec.xfpt exim/exim-doc/doc-txt ChangeLog NewStuff exim/exim-src/src readconf.c
pdp 2010/06/07 08:09:11 BST

  Modified files:
    exim-doc/doc-docbook spec.xfpt 
    exim-doc/doc-txt     ChangeLog NewStuff 
    exim-src/src         readconf.c 
  Log:
  Allow Routers to have multiple conditions, IF each one yields a strict bool.
  Fixes: #816


  Revision  Changes    Path
  1.83      +11 -0     exim/exim-doc/doc-docbook/spec.xfpt
  1.628     +2 -0      exim/exim-doc/doc-txt/ChangeLog
  1.173     +9 -0      exim/exim-doc/doc-txt/NewStuff
  1.42      +28 -2     exim/exim-src/src/readconf.c


  Index: spec.xfpt
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-docbook/spec.xfpt,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- spec.xfpt    6 Jun 2010 02:08:50 -0000    1.82
  +++ spec.xfpt    7 Jun 2010 07:09:10 -0000    1.83
  @@ -1,4 +1,4 @@
  -. $Cambridge: exim/exim-doc/doc-docbook/spec.xfpt,v 1.82 2010/06/06 02:08:50 pdp Exp $
  +. $Cambridge: exim/exim-doc/doc-docbook/spec.xfpt,v 1.83 2010/06/07 07:09:10 pdp Exp $
   .
   . /////////////////////////////////////////////////////////////////////////////
   . This is the primary source of the Exim Manual. It is an xfpt document that is
  @@ -15669,6 +15669,12 @@
   If the result is any other value, the router is run (as this is the last
   precondition to be evaluated, all the other preconditions must be true).


+This option is unique in that multiple &%condition%& options may be present.
+In this case, the previous statement does not quite apply: the result of each
+&%condition%& option must be a string recognised by the &%bool%& expansion
+operator, or failure will be forced. The effect is to "and" the conditions
+together, as each must pass.
+
The &%condition%& option provides a means of applying custom conditions to the
running of routers. Note that in the case of a simple conditional expansion,
the default expansion values are exactly what is wanted. For example:
@@ -15679,6 +15685,11 @@
.code
condition = ${if >{$message_age}{600}{true}{}}
.endd
+A multiple condition example:
+.code
+condition = ${if >{$message_age}{600}}
+condition = ${if !eq{${lc:$local_part}}{postmaster}}
+.endd
If the expansion fails (other than forced failure) delivery is deferred. Some
of the other precondition options are common special cases that could in fact
be specified using &%condition%&.

  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.627
  retrieving revision 1.628
  diff -u -r1.627 -r1.628
  --- ChangeLog    6 Jun 2010 22:46:33 -0000    1.627
  +++ ChangeLog    7 Jun 2010 07:09:10 -0000    1.628
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.627 2010/06/06 22:46:33 pdp Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.628 2010/06/07 07:09:10 pdp Exp $


Change log file for Exim from version 4.21
-------------------------------------------
@@ -44,6 +44,8 @@

PP/14 Build without WITH_CONTENT_SCAN. Path from Andreas Metzler.

+PP/15 Bugzilla 816: support multiple condition rules on Routers.
+

Exim version 4.72
-----------------

  Index: NewStuff
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -r1.172 -r1.173
  --- NewStuff    6 Jun 2010 02:46:13 -0000    1.172
  +++ NewStuff    7 Jun 2010 07:09:10 -0000    1.173
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.172 2010/06/06 02:46:13 pdp Exp $
  +$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.173 2010/06/07 07:09:10 pdp Exp $


   New Features in Exim
   --------------------
  @@ -75,6 +75,15 @@
       then henceforth you will have to maintain your own local patches to strip
       the safeties off.


  + 8. Routers now support multiple "condition" tests, IF each router yields
  +    a string which the bool{} operator recognises.  Note that this is a departure
  +    from normal Router "condition" truth, requiring the stricter standard of
  +    "true" that ACLS use.  This might be relaxed in a future release if there
  +    is sufficient demand.
  +    When debugging, bear in mind that these are internally wrapped up into
  +    a longer, more complicated, string.  There's a reason that the bool{}
  +    logic is a dependency.
  +


Version 4.72
------------

  Index: readconf.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/readconf.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- readconf.c    7 Jun 2010 00:12:42 -0000    1.41
  +++ readconf.c    7 Jun 2010 07:09:10 -0000    1.42
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/readconf.c,v 1.41 2010/06/07 00:12:42 pdp Exp $ */
  +/* $Cambridge: exim/exim-src/src/readconf.c,v 1.42 2010/06/07 07:09:10 pdp Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1358,6 +1358,7 @@
   gid_t gid;
   BOOL boolvalue = TRUE;
   BOOL freesptr = TRUE;
  +BOOL extra_condition = FALSE;
   optionlist *ol, *ol2;
   struct passwd *pw;
   void *reset_point;
  @@ -1365,6 +1366,8 @@
   uschar *inttype = US"";
   uschar *sptr;
   uschar *s = buffer;
  +uschar *saved_condition, *strtemp;
  +uschar **str_target;
   uschar name[64];
   uschar name2[64];


  @@ -1422,8 +1425,11 @@
     {
     uschar *mname = name;
     if (Ustrncmp(mname, "no_", 3) == 0) mname += 3;
  -  log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
  -    "\"%s\" option set for the second time", mname);
  +  if (Ustrcmp(mname, "condition") == 0)
  +    extra_condition = TRUE;
  +  else
  +    log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN,
  +      "\"%s\" option set for the second time", mname);
     }


   ol->type |= opt_set | issecure;
  @@ -1504,6 +1510,26 @@
       control block and flags word. */


       case opt_stringptr:
  +    if (data_block == NULL)
  +      str_target = (uschar **)(ol->value);
  +    else
  +      str_target = (uschar **)((uschar *)data_block + (long int)(ol->value));
  +    if (extra_condition)
  +      {
  +      /* We already have a condition, we're conducting a crude hack to let multiple
  +      condition rules be chained together, despite storing them in text form. */
  +      saved_condition = *str_target;
  +      strtemp = string_sprintf("${if and{{bool{%s}}{bool{%s}}}}",
  +          saved_condition, sptr);
  +      *str_target = string_copy_malloc(strtemp);
  +      }
  +    else
  +      {
  +      *str_target = sptr;
  +      freesptr = FALSE;
  +      }
  +    break;
  +
       case opt_rewrite:
       if (data_block == NULL)
         *((uschar **)(ol->value)) = sptr;