Re: [exim] Simple String Replace

Pàgina inicial
Delete this message
Reply to this message
Autor: Phil Pennock
Data:  
A: Brian Blood
CC: exim users
Assumpte: Re: [exim] Simple String Replace
On 2008-11-24 at 13:40 -0600, Brian Blood wrote:
> Since that marker could be anywhere in the template, I needed to have
> a simple find/replace and the closest I could come up with was to use
> sg{} like so:
>
>    set acl_m_temp_text = ${extract{spam_tag_subject} 
> {$acl_c_system_prefs}{$value}{@@SUBJ@@}}
>    set acl_c_temp_text = ${sg{$acl_c_temp_text}{@@SUBJ@@}{$h_Subject:}}

>
>
> and that would work. Most of the time.
> However, I found some errors with that when the subject contained a $
> like this one:
>
>    T="The electronic products the factory directly sells: laptop, LCD  
> TV, camera ,mobile,Mp4, GPS\033$B!$\033(Band so on."


Right. First Exim parses the line to construct the expression. Then
during substitution, the substitution string is expanded. That's why $1
can be used for back-references. *All* Exim variables can be expanded
during the substitution step. Eg, with:
Subject: X $tod_log X
your rule might yield:
[***SPAM***] X 2008-11-24 22:57:25 X

Use {\N$h_Subject:\N} to get the expansion past the first parsing (into
the expression) so that it's all data and is then expanded during the
replacement operation.

Or, as you note, keep untrusted data away from evaluation steps.

-Phil