[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: exim-cvs
Asunto: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src match.c exim/exim-test/aux-var-src 0002.wild exim/exim-test/scripts/0000-Basic 0002 exim/exim-test/stdout 0002
ph10 2006/07/27 14:50:43 BST

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         match.c 
    exim-test/aux-var-src 0002.wild 
    exim-test/scripts/0000-Basic 0002 
    exim-test/stdout     0002 
  Log:
  Allow (?-i) to work as expected in a (n)wildlsearch key.


  Revision  Changes    Path
  1.384     +6 -0      exim/exim-doc/doc-txt/ChangeLog
  1.15      +9 -2      exim/exim-src/src/match.c
  1.2       +2 -0      exim/exim-test/aux-var-src/0002.wild
  1.5       +7 -0      exim/exim-test/scripts/0000-Basic/0002
  1.5       +7 -0      exim/exim-test/stdout/0002


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.383
  retrieving revision 1.384
  diff -u -r1.383 -r1.384
  --- ChangeLog    27 Jul 2006 11:29:32 -0000    1.383
  +++ ChangeLog    27 Jul 2006 13:50:43 -0000    1.384
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.383 2006/07/27 11:29:32 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.384 2006/07/27 13:50:43 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -139,6 +139,12 @@
         that require one. Thus, EHLORHUBARB was interpreted as a valid command.
         This bug exists in every version of Exim that I still have, right back to
         0.12.
  +
  +PH/26 (n)wildlsearch lookups are documented as being done case-insensitively.
  +      However, an attempt to turn on case-sensitivity in a regex key by
  +      including (?-i) didn't work because the subject string was already
  +      lowercased, and the effects were non-intuitive. It turns out that a
  +      one-line patch can be used to allow (?-i) to work as expected.



Exim version 4.62

  Index: match.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/match.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- match.c    4 Apr 2006 10:01:20 -0000    1.14
  +++ match.c    27 Jul 2006 13:50:43 -0000    1.15
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/match.c,v 1.14 2006/04/04 10:01:20 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/match.c,v 1.15 2006/07/27 13:50:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -74,7 +74,8 @@
                      returns ERROR)


   Contents of the argument block:
  -  subject        the subject string to be checked
  +  origsubject    the subject in its original casing
  +  subject        the subject string to be checked, lowercased if caseless
     expand_setup   if < 0, don't set up any numeric expansion variables;
                    if = 0, set $0 to whole subject, and either
                      $1 to what matches * or
  @@ -99,7 +100,7 @@
   int search_type, partial, affixlen, starflags;
   int expand_setup = cb->expand_setup;
   uschar *affix;
  -uschar *s = cb->subject;
  +uschar *s;
   uschar *filename = NULL;
   uschar *keyquery, *result, *semicolon;
   void *handle;
  @@ -107,6 +108,12 @@
   error = error;  /* Keep clever compilers from complaining */


if (valueptr != NULL) *valueptr = NULL; /* For non-lookup matches */
+
+/* For regular expressions, use cb->origsubject rather than cb->subject so that
+it works if the pattern uses (?-i) to turn off case-independence, overriding
+"caseless". */
+
+s = (pattern[0] == '^')? cb->origsubject : cb->subject;

/* If required to set up $0, initialize the data but don't turn on by setting
expand_nmax until the match is assured. */

  Index: 0002.wild
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/aux-var-src/0002.wild,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 0002.wild    7 Feb 2006 10:34:24 -0000    1.1
  +++ 0002.wild    27 Jul 2006 13:50:43 -0000    1.2
  @@ -9,3 +9,5 @@
   ^a\\.+b     ^a\\.+b
   \N^a\d+b    \N^a\d+b
   lsearch;DIR/aux-fixed/0002.quoted:  lookup succeeded
  +^(?-i)MiXeD-CD: Data found for case-dependent MiXeD-CD
  +^MiXeD-nCD: Data found for case-independent MiXeD-nCD


  Index: 0002
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/scripts/0000-Basic/0002,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- 0002    1 Mar 2006 11:40:51 -0000    1.4
  +++ 0002    27 Jul 2006 13:50:43 -0000    1.5
  @@ -387,6 +387,13 @@
   a\\:b:  ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
   a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}


+# Some tests of case-(in)dependence
+
+MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
+MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
+MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
+MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
+
# IP address (CIDR) lookups

   1.2.3.4:      ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}


  Index: 0002
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stdout/0002,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- 0002    1 Mar 2006 11:40:51 -0000    1.4
  +++ 0002    27 Jul 2006 13:50:43 -0000    1.5
  @@ -356,6 +356,13 @@
   > a\:b:  ^a\\.+b
   > a\:Xb: ^a\\.+b

>
+> # Some tests of case-(in)dependence
+>
+> MiXeD-CD: Data found for case-dependent MiXeD-CD
+> MixeD-CD: NOT FOUND
+> MiXeD-Ncd: Data found for case-independent MiXeD-nCD
+> MixeD-Ncd: Data found for case-independent MiXeD-nCD
+>
> # IP address (CIDR) lookups
>
   > 1.2.3.4:      data for 1.2.3.4