[exim] expansion problem with rfc2047 headers

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Stephen Gran
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [exim] expansion problem with rfc2047 headers
Hi all,

(sorry in advance - kind of long mail with the debug output).

I'm trying to match broken headers that are non-ascii and also not
rfc2047 compliant. I have this as a first pass:

  warn  condition      = ${if match {$h_Subject:}{\N[^[:print:]]{8}\N}}
        set acl_c1     = ${eval:$acl_c1+5}
        log_message    = mailer is not RFC 2047 compliant


and this is the -be expansion test:

steve@vancouver:~/public_html/d.o-exim$ exim -d+expand -be
Exim version 4.63 uid=1001 gid=1001 pid=12550 D=fbb95dfd
Berkeley DB: Sleepycat Software: Berkeley DB 4.3.29: (September 6, 2005)
Support for: crypteq iconv() IPv6 PAM Perl GnuTLS move_frozen_messages Content_Scanning Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl plaintext spa
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
changed uid/gid: -C, -D, -be or -bf forces real uid
uid=1001 gid=1001 pid=12550
auxiliary group list: 4 106 107 110 1001
configuration file is /etc/exim4/exim4.conf
log selectors = 00003ffc 001b9165
admin user

[...]

> ${if match{=?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=}{\N[^[:print:]]{8}\N}}

expanding: =?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=
result: =?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=
expanding: \N[^[:print:]]{8}\N
result: [^[:print:]]{8}
condition: match{=?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=}{\N[^[:print:]]{8}\N}
result: false
expanding: ${if match{=?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=}{\N[^[:print:]]{8}\N}}
result:

> ${if match{\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262}{\N[^[:print:]]{8}\N}}

expanding: \320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262
result: вввввввввввввв
expanding: \N[^[:print:]]{8}\N
result: [^[:print:]]{8}
condition: match{\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262}{\N[^[:print:]]{8}\N}
result: true
expanding: ${if match{\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262\320\262}{\N[^[:print:]]{8}\N}}
result: true
true

So, great - it matches unencoded text, but not encoded text. However,
with -bhc or at actual SMTP time, it matches even encoded text. With
this test mail:

> Date: Fri, 25 Jul 2008 14:43:36 +0100
> From: Stephen Gran <steve@???>
> To: Stephen Gran <steve@???>
> Subject: =?KOI8-R?Q?=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7=D7_mutt?=
> Message-ID: <20080725134335.GA16407@www.lobefin.net>
> MIME-Version: 1.0
> Content-Type: text/plain; charset=koi8-r
>
> test


I get this output:

processing "warn"
expanding: $h_Subject:
   result: вввввввввввввв mutt
expanding: \N[^[:print:]]{8}\N
   result: [^[:print:]]{8}
condition: match {$h_Subject:}{\N[^[:print:]]{8}\N}
   result: true
expanding: ${if match {$h_Subject:}{\N[^[:print:]]{8}\N}}
   result: true
check condition = ${if match {$h_Subject:}{\N[^[:print:]]{8}\N}}
                = true
expanding: $acl_c1+5
   result: +5
expanding: ${eval:$acl_c1+5}
   result: 5
check set acl_c1 = ${eval:$acl_c1+5}
                 = 5
warn: condition test succeeded
LOG: MAIN
  H=localhost [127.0.0.1] I=[89.16.166.17]:25 Warning: mailer is not RFC 2047 compliant


Any cluebats handy? Is this even a good idea?

Thanks,
--
--------------------------------------------------------------------------
|  Stephen Gran                  | You can't go home again, unless you set |
|  steve@???             | $HOME.                                  |
|  http://www.lobefin.net/~steve |                                         |

--------------------------------------------------------------------------