Victor Duchovni:
> On Sat, Nov 29, 2008 at 10:24:25PM -0600, Noel Jones wrote:
> 
> > john mickler wrote:
> > >
> > >As for the newline insertion mentioned on the website, I'm wondering
> > >if using a pcre instead of standard regex would allow this.  I'm going
> > >to translate and give it a try.
> > 
> > Don't bother.  The postfix REPLACE action does not support 
> > newlines in headers regardless of the map type used.
> > 
> > The only possible "workaround" is to add code to postfix 
> > supporting multi-line header insertion.
> 
> It should work if the newline is part of a ${n} sub-pattern match:
> 
>     # ${3} matches Newline + folding white-space
>     /^(Received): (.*?)(\n[\t\x20])(.*)$/
>           ${1}: ${2}${3}(my comment)${3}${4}
> 
> With test.pcre containing the above, "postmap -q" yields:
> 
>     $ postmap -q "$(printf "Received: %s\n\t%s\n" abc def)" pcre:test.pcre
>     Received: abc
>           (my comment)
>           def
> 
> showing the insertion of an additional line into the header. What is not
> possible is the insertion of a literal newline in the Postfix replacement
> text in indexed file, regexp table or policy service lookups.

That will likely remain impossible, because preserving newlines in
config files means having to put additional checks throughout
Postfix for all the cases where newlines would cause trouble.
Every map lookup would have to be scrutinized, and when adding
new code, someone would almost certainly overlook the possibility
of unexpected newlines and introduce bugs.

        Wietse

Reply via email to