Both bool{} and bool_lax{} should ignore trailing whitespace.
authorPhil Pennock <pdp@exim.org>
Mon, 7 Jun 2010 08:42:15 +0000 (08:42 +0000)
committerPhil Pennock <pdp@exim.org>
Mon, 7 Jun 2010 08:42:15 +0000 (08:42 +0000)
doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
src/src/expand.c

index 8254bee5163c7fbd9f59c9c0baf7dedffd581d02..837813cecbf40a849b86316e62bd5bd6d5cd9b53 100644 (file)
@@ -1,4 +1,4 @@
-. $Cambridge: exim/doc/doc-docbook/spec.xfpt,v 1.84 2010/06/07 08:23:20 pdp Exp $
+. $Cambridge: exim/doc/doc-docbook/spec.xfpt,v 1.85 2010/06/07 08:42:15 pdp Exp $
 .
 . /////////////////////////////////////////////////////////////////////////////
 . This is the primary source of the Exim Manual. It is an xfpt document that is
 .
 . /////////////////////////////////////////////////////////////////////////////
 . This is the primary source of the Exim Manual. It is an xfpt document that is
@@ -9802,7 +9802,7 @@ zero.
 This condition turns a string holding a true or false representation into
 a boolean state.  It parses &"true"&, &"false"&, &"yes"& and &"no"&
 (case-insensitively); also positive integer numbers map to true if non-zero,
 This condition turns a string holding a true or false representation into
 a boolean state.  It parses &"true"&, &"false"&, &"yes"& and &"no"&
 (case-insensitively); also positive integer numbers map to true if non-zero,
-false if zero.  Leading whitespace is ignored.
+false if zero.  Leading and trailing whitespace is ignored.
 All other string values will result in expansion failure.
 
 When combined with ACL variables, this expansion condition will let you
 All other string values will result in expansion failure.
 
 When combined with ACL variables, this expansion condition will let you
@@ -9819,7 +9819,7 @@ Like &%bool%&, this condition turns a string into a boolean state.  But
 where &%bool%& accepts a strict set of strings, &%bool_lax%& uses the same
 loose definition that the Router &%condition%& option uses.  The empty string
 and the values &"false"&, &"no"& and &"0"& map to false, all others map to
 where &%bool%& accepts a strict set of strings, &%bool_lax%& uses the same
 loose definition that the Router &%condition%& option uses.  The empty string
 and the values &"false"&, &"no"& and &"0"& map to false, all others map to
-true.
+true.  Leading and trailing whitespace is ignored.
 
 Note that where &"bool{00}"& is false, &"bool_lax{00}"& is true.
 
 
 Note that where &"bool{00}"& is false, &"bool_lax{00}"& is true.
 
index e2904ba48c15a784a6ac93fce60e9a4b25d285cb..9f4a63470931283c810e700b89eb368ce19b6ed5 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.629 2010/06/07 08:23:20 pdp Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.630 2010/06/07 08:42:15 pdp Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -47,7 +47,8 @@ PP/14 Build without WITH_CONTENT_SCAN. Path from Andreas Metzler.
 PP/15 Bugzilla 816: support multiple condition rules on Routers.
 
 PP/16 Add bool_lax{} expansion operator and use that for combining multiple
 PP/15 Bugzilla 816: support multiple condition rules on Routers.
 
 PP/16 Add bool_lax{} expansion operator and use that for combining multiple
-      condition rules, instead of bool{}.
+      condition rules, instead of bool{}.  Make both bool{} and bool_lax{}
+      ignore trailing whitespace.
 
 
 Exim version 4.72
 
 
 Exim version 4.72
index 9f9cbb7befffed14bd4074ac55af4b8bc2ece200..7adf673afc01c1eb0b9883e912bd4c318baed0dd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.107 2010/06/07 08:23:20 pdp Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.108 2010/06/07 08:42:15 pdp Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -2502,7 +2502,7 @@ switch(cond_type)
   case ECOND_BOOL_LAX:
     {
     uschar *sub_arg[1];
   case ECOND_BOOL_LAX:
     {
     uschar *sub_arg[1];
-    uschar *t;
+    uschar *t, *t2;
     uschar *ourname;
     size_t len;
     BOOL boolvalue = FALSE;
     uschar *ourname;
     size_t len;
     BOOL boolvalue = FALSE;
@@ -2521,6 +2521,17 @@ switch(cond_type)
     t = sub_arg[0];
     while (isspace(*t)) t++;
     len = Ustrlen(t);
     t = sub_arg[0];
     while (isspace(*t)) t++;
     len = Ustrlen(t);
+    if (len)
+      {
+      /* trailing whitespace: seems like a good idea to ignore it too */
+      t2 = t + len - 1;
+      while (isspace(*t2)) t2--;
+      if (t2 != (t + len))
+        {
+        *++t2 = '\0';
+        len = t2 - t;
+        }
+      }
     DEBUG(D_expand)
       debug_printf("considering %s: %s\n", ourname, len ? t : US"<empty>");
     /* logic for the lax case from expand_check_condition(), which also does
     DEBUG(D_expand)
       debug_printf("considering %s: %s\n", ourname, len ? t : US"<empty>");
     /* logic for the lax case from expand_check_condition(), which also does