/dev/rob0:
> Postfix 2.9.0-RC2, trying to send to an external address with an 
> apostrophe:
> 
> rob0@chestnut:~$ fortune -o | mail -so "Joe's"@example.net
> rob0@chestnut:~$ mailq
> ----Queue ID----- --Size-- ---Arrival Time---- 
> --Sender/Recipient------
> 3TZMM8068wzp1Qr        405 Fri Jan 27 08:05:08 rob0
>                                                Joe'[email protected]
> 
> and this is logged:
> 
> Jan 27 08:05:08 chestnut postfix/pickup[20923]: 3TZMM80HjFzBn8B2: 
> uid=1007 from=<rob0>
> Jan 27 08:05:08 chestnut postfix/cleanup[20967]: fatal: 
> dict_sqlite_lookup: /etc/postfix/query/maps-valias.query: SQL prepare 
> failed: near "s": syntax error?

Postfix runs the search string through sqlite3_mprintf("%q"), which
is documented to double single quotes to avoid SQL syntax troubles
when the string is used in a query like this:

    SELECT select_field FROM table WHERE where_field = '%s'

You can verify that this happens with verbose Postfix logging.

        Wietse

Reply via email to