nm4 2008/12/12 14:51:47 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src expand.c
Log:
Make whitespace strings compare euqal to zero. fixes: bug #749
Revision Changes Path
1.559 +3 -0 exim/exim-doc/doc-txt/ChangeLog
1.97 +17 -0 exim/exim-src/src/expand.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.558
retrieving revision 1.559
diff -u -r1.558 -r1.559
--- ChangeLog 12 Dec 2008 14:44:25 -0000 1.558
+++ ChangeLog 12 Dec 2008 14:51:47 -0000 1.559
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.558 2008/12/12 14:44:25 nm4 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.559 2008/12/12 14:51:47 nm4 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -83,6 +83,9 @@
NM/10 Bugzilla 770: Problem on some platforms modifying the len parameter to accept()
Patch provided by Maxim Dounin
+NM/11 Bugzilla 749: Preserve old behaviour of blanks comparing equal to zero.
+ Patch provided by Phil Pennock
+
Exim version 4.69
-----------------
Index: expand.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/expand.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- expand.c 7 Aug 2008 11:05:03 -0000 1.96
+++ expand.c 12 Dec 2008 14:51:47 -0000 1.97
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/expand.c,v 1.96 2008/08/07 11:05:03 fanf2 Exp $ */
+/* $Cambridge: exim/exim-src/src/expand.c,v 1.97 2008/12/12 14:51:47 nm4 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -5874,6 +5874,23 @@
errno = 0;
expand_string_message = NULL; /* Indicates no error */
+
+/* Before Exim 4.64, strings consisting entirely of whitespace compared
+equal to 0. Unfortunately, people actually relied upon that, so preserve
+the behaviour explicitly. Stripping leading whitespace is a harmless
+noop change since strtol skips it anyway (provided that there is a number
+to find at all). */
+if (isspace(*s))
+ {
+ while (isspace(*s)) ++s;
+ if (*s == '\0')
+ {
+ DEBUG(D_expand)
+ debug_printf("treating blank string as number 0\n");
+ return 0;
+ }
+ }
+
value = strtol(CS s, CSS &endptr, 10);
if (endptr == s)