ph10 2006/07/07 15:36:04 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src filter.c
exim-test/scripts/0000-Basic 0037
exim-test/stdout 0037
Added files:
exim-test/aux-fixed 0037.f-8 0037.f-9
Log:
Diagnose an error for "seen", "unseen", or "noerror" if not followed by
a command.
Revision Changes Path
1.372 +3 -0 exim/exim-doc/doc-txt/ChangeLog
1.11 +19 -0 exim/exim-src/src/filter.c
1.1 +5 -0 exim/exim-test/aux-fixed/0037.f-8 (new)
1.1 +3 -0 exim/exim-test/aux-fixed/0037.f-9 (new)
1.3 +8 -0 exim/exim-test/scripts/0000-Basic/0037
1.3 +14 -0 exim/exim-test/stdout/0037
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.371
retrieving revision 1.372
diff -u -r1.371 -r1.372
--- ChangeLog 7 Jul 2006 13:54:32 -0000 1.371
+++ ChangeLog 7 Jul 2006 14:36:04 -0000 1.372
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.371 2006/07/07 13:54:32 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.372 2006/07/07 14:36:04 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -85,6 +85,9 @@
PH/14 In the default configuration, change the use of "message" in ACL warn
statements to "add_header".
+
+PH/15 Diagnose a filter syntax error for "seen", "unseen", or "noerror" if not
+ not followed by a command (e.g. "seen endif").
Exim version 4.62
Index: filter.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/filter.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- filter.c 27 Jun 2006 14:34:26 -0000 1.10
+++ filter.c 7 Jul 2006 14:36:04 -0000 1.11
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/filter.c,v 1.10 2006/06/27 14:34:26 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/filter.c,v 1.11 2006/07/07 14:36:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1044,6 +1044,13 @@
case elif_command:
case else_command:
case endif_command:
+ if (seen_force || noerror_force)
+ {
+ *error_pointer = string_sprintf("\"seen\", \"unseen\", or \"noerror\" "
+ "near line %d is not followed by a command", line_number);
+ yield = FALSE;
+ }
+
if (expect_endif > 0)
had_else_endif = (command == elif_command)? had_elif :
(command == else_command)? had_else : had_endif;
@@ -1316,6 +1323,12 @@
case seen_command:
case unseen_command:
+ if (*ptr == 0)
+ {
+ *error_pointer = string_sprintf("\"seen\" or \"unseen\" "
+ "near line %d is not followed by a command", line_number);
+ yield = FALSE;
+ }
if (seen_force)
{
*error_pointer = string_sprintf("\"seen\" or \"unseen\" repeated "
@@ -1331,6 +1344,12 @@
/* So does noerror */
case noerror_command:
+ if (*ptr == 0)
+ {
+ *error_pointer = string_sprintf("\"noerror\" "
+ "near line %d is not followed by a command", line_number);
+ yield = FALSE;
+ }
noerror_force = TRUE;
was_noerror = TRUE;
break;
Index: 0037.f-8
====================================================================
#exim filter
if one is one then seen endif
if two is two then save /dev/null endif
Index: 0037.f-9
====================================================================
#exim filter
unseen
Index: 0037
===================================================================
RCS file: /home/cvs/exim/exim-test/scripts/0000-Basic/0037,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 0037 27 Jun 2006 14:34:27 -0000 1.2
+++ 0037 7 Jul 2006 14:36:04 -0000 1.3
@@ -177,4 +177,12 @@
# Check not prepend $home
exim -DFILTER_PREPEND_HOME=no_filter_prepend_home -bt prepend@???
****
+# Check error for (un)seen and no command
+1
+exim -bf DIR/aux-fixed/TESTNUM.f-8 </dev/null
+****
+# Check error for (un)seen at eof
+1
+exim -bf DIR/aux-fixed/TESTNUM.f-9 </dev/null
+****
no_msglog_check
Index: 0037
===================================================================
RCS file: /home/cvs/exim/exim-test/stdout/0037,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 0037 27 Jun 2006 14:34:27 -0000 1.2
+++ 0037 7 Jul 2006 14:36:04 -0000 1.3
@@ -261,3 +261,17 @@
transport = appendfile
prepend@??? -> relative
transport = appendfile
+Warning: no message headers read
+Return-path copied from sender
+Sender = CALLER@???
+Recipient = CALLER@???
+Testing Exim filter file "TESTSUITE/aux-fixed/0037.f-8"
+
+Filter error: "seen", "unseen", or "noerror" near line 5 is not followed by a command
+Warning: no message headers read
+Return-path copied from sender
+Sender = CALLER@???
+Recipient = CALLER@???
+Testing Exim filter file "TESTSUITE/aux-fixed/0037.f-9"
+
+Filter error: "seen" or "unseen" near line 4 is not followed by a command