OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Address Extensions with virtual maps are always converted to lowercase.

From: Remko Molier (rmoliermore-it.com)
Date: Thu Jan 12 2006 - 12:53:20 CST


Hi,

For the last two days I have been - unsuccessfully - trying to get the
address extension in postfix to work for address extensions that use
capitals letters (e.g. rmolier+Junkmore-it.com) and are mapped
(virtual) to different e-mail addresses. In one way or the other postfix
always seems to convert them to lowercase.

The only way I have been able to make it work is by adding a line for every

-/etc/postfix/virtual:
...

rmoliermore-it.com mesomewhere.com, mesomewhereelse.com
rmolier+Junkmore-it.com me+Junksomewhere.com, me+Junksomewhereelse.com

....

By looking at the output of the cleanup process in verbose mode, I
figured out that this case conversion is taking place in the
mail_addr_map function:

Jan 12 18:25:29 torvalds postfix/cleanup[32692]: mail_addr_map:
rmolier+Junkmore-it.com -> 0: rmolier+junkmore-it.com
Jan 12 18:25:29 torvalds postfix/cleanup[32692]: been_here:
rmolier+Junkmore-it.com: 0
Jan 12 18:25:29 torvalds postfix/cleanup[32692]: been_here_check:
rmolier+junkmore-it.com: 1
Jan 12 18:25:29 torvalds postfix/cleanup[32692]: been_here:
rmolier+Junkmore-it.com?rmolier+junkmore-it.com: 0

Looking at the code, it made it obvious that in global/mail_addr_map.c
the extension, which is taken from the call to mail_addr_find() and
saved for propagating the extension to the addresses found is always in
lowercase.

The following patch for mail_addr_find.c fixes the problem:

--- mail_addr_find.c 2004-01-20 18:44:21.000000000 +0100
+++ updated/mail_addr_find.c 2006-01-12 19:44:47.000000000 +0100
-107,7 +107,7
     if (*var_rcpt_delim == 0) {
        bare_key = saved_ext = 0;
     } else {
- bare_key = strip_addr(full_key, &saved_ext, *var_rcpt_delim);
+ bare_key = lowercase(strip_addr(address, &saved_ext,
*var_rcpt_delim));
     }

     /*

The patch is for 2.1.5 but I have noticed that both 2.2 and 2.3 suffer
from the same problem.

Hope it helps somebody..

Regards,

Remko Molier