[exim] "${strlen" is not a known operator ...

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Ian Eiloart
Data:  
Para: Exim
Asunto: [exim] "${strlen" is not a known operator ...
Hi all,

I have these lines in a router (they’re designed to mitigate the "reply-all" problem after someone spams the entire campus):

    headers_remove = \
        Bcc \
        ${if  > { ${strlen:$header_To: } } {4096}  { : To }}\
        ${if  > { ${strlen:$header_Cc: } } {4096} { : Cc }}
    headers_add = \
        X-Sussex: true \
        \nX-Sussex-transport: remote_smtp \
        ${if  > { ${strlen:$header_To: } } {4096} {\nTo: address list masked by postmaster:; }}\
        ${if  > { ${strlen:$header_Cc: } } {4096} {\nCc: address list masked by postmaster:; }}

Exim 4.76 on FreeBSD is fine with them, but Exim 4.84 on Centos (with support for iconv()) complains like this:

 "failed to expand headers_add or headers_remove: "${strlen" is not a known operator (or a } is missing in a variable reference)"

Can anyone see what I’m doing wrong? $strlen certainly is a known operator. 

Now, actually, I’m using a series of macros in the config file to get here, but I’ve tried to do the substitutions above, to make it easier to parse:

#################################################################
## limit the number of recipients displayed in message headers ##
#################################################################
# Maximum permitted header lengths (unit is characters)(
MAX_CC = 4096
MAX_TO = 4096

# This condition tests that the To: header is less than MAX_TO characters.
LONG_TO_HEADERS = \
          > { ${strlen:{$header_To:} } } {MAX_TO} 

# This condition tests that the Cc: header is less than MAX_CC characters.
LONG_CC_HEADERS = \
          > { ${strlen:{$header_Cc:} } } {MAX_CC} 

# This is used by headers_remove          
REMOVE_LONG_HEADERS = \
    ${if  LONG_TO_HEADERS { : To }}\
    ${if  LONG_CC_HEADERS { : Cc }}

# This is used by headers_add

CONCEALED_STRING = address list masked by postmaster:;

REPLACE_LONG_HEADERS = \
    ${if  LONG_TO_HEADERS {\nTo: CONCEALED_STRING }}\
    ${if  LONG_CC_HEADERS {\nCc: CONCEALED_STRING }}

Then the router looks like this:

remote_lmtp:
    driver = smtp
    protocol = lmtp
    rcpt_include_affixes
    no_delay_after_cutoff
    headers_remove = \
        Bcc \
        REMOVE_LONG_HEADERS
    headers_add = \
        X-Sussex: true \
        \nX-Sussex-transport: remote_lmtp \
        REPLACE_LONG_HEADERS



-- 
Ian Eiloart
Postmaster, University of Sussex
+44 (0) 1273 87-3148