[Exim] dated addresses (ACL version)

Top Page
Delete this message
Reply to this message
Author: Kirill Miazine
Date:  
To: Kevin Reed
CC: exim-users
Old-Topics: [Exim] dated addresses (example)
Subject: [Exim] dated addresses (ACL version)
ACL version, more features!

Addresses of the following form are supported:

    * user-dated-YYYY@domain
    * user-dated-YYYYMM@domain
    * user-dated-YYYYMMMDD@domain
    * user-dated-EPOCH@domain


Example session:

=== start example session ===
220 thinkpad.krot.org ESMTP Exim 4.23 Thu, 25 Dec 2003 12:48:36 +0100
helo there
250 thinkpad.krot.org Hello km at there
mail from:<km@???>
250 OK
rcpt to:<km-dated-2002@???>
550 Invalid/expired dated address
rcpt to:<km-dated-2003@???>
250 Accepted
rcpt to:<km-dated-2004@???>
250 Accepted
rcpt to:<km-dated-200311@???>
550 Invalid/expired dated address
rcpt to:<km-dated-200312@???>
250 Accepted
rcpt to:<km-dated-200401@???>
250 Accepted
rcpt to:<km-dated-20031224@???>
550 Invalid/expired dated address
rcpt to:<km-dated-20031225@???>
250 Accepted
rcpt to:<km-dated-20031226@???>
250 Accepted
rcpt to:<km-dated-1072439180@???>
250 Accepted
rcpt to:<km-dated-1042439180@???>
550 Invalid/expired dated address
quit
221 thinkpad.krot.org closing connection
=== end example session ===

ACLs (modify domains to suit your needs):

=== start ACL ===

warn domains = *
     local_parts = ^.+-dated-0*(\\d{4,12})
     set acl_m0 = ${if match{$tod_log}{^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)}\
                    {y=$1 m=$1$2 d=$1$2$3 e=$tod_epoch}{}}
     set acl_m1 = ${if match{$local_part}{-dated-0*(\\d\{4,12\})}{$1}{}}
     condition = ${if eq{$acl_m1}{}{no}{yes}}
     set acl_m2 = ${strlen:$acl_m1}
     set acl_m3 = ${if =={$acl_m2}{4}\
                    {${if <{$acl_m1}{${extract{y}{$acl_m0}}}{nn}{yy}}}\
                    {${if =={$acl_m2}{6}\
                       {${if <{$acl_m1}{${extract{m}{$acl_m0}}}{nn}{yy}}}\
                       {${if =={$acl_m2}{8}\
                          {${if <{$acl_m1}{${extract{d}{$acl_m0}}}{nn}{yy}}}\
                          {${if <{$acl_m1}{${extract{e}{$acl_m0}}}{nn}{yy}}}\
                         }\
                       }\
                      }\
                    }\
                   }


accept condition = ${if eq{$acl_m3}{}{no}{yes}}
       endpass
       message = Invalid/expired dated address
       condition = ${if eq{$acl_m3}{yy}{yes}{no}}


=== end ACL ===

Have fun.

--
Kirill Miazine
mailto:km@krot.org
http://km.krot.org/