envelope from characters

Issue #446 resolved
s s created an issue

Hi

We have piler 0.1.25-master-branch, build 857. I know this is outdated release and this issue may be resolved. I found that when was looking for some bulk messages in archive. Let me explain what i've found.

When a sender have these special characters: ['] or [&] then piler do not save full local part to the mysql db exim log:

2014-11-22 14:14:35 [31623] 1XsBSN-0008E2-HO => rcpt@domain.com F=<TEST'new@domain.com> P=<TEST'new@domain.com> R=route_archive T=remote_smtp S=965 H=X.X.X.X:25 C="250 Ok 4000000054709a5529f6ce3400a5c59bccf9 <rcpt@domain.com>" QT=0s DT=0s

piler maillog

Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: sent: 220 server.domain.com ESMTP#015
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: EHLO server.domain.com
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: sent: 250-server.domain.com#015#012250-PIPELINING#015#012250-SIZE#015#012250 8BITMIME#015
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: MAIL FROM:<TEST'new@domain.com> SIZE=2024
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: RCPT TO:<rcpt@domain.com>
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: DATA
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: sent: 250 Ok#015#012250 Ok#015#012354 Send mail data; end it with <CRLF>.<CRLF>#015
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: period found
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: (.)
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: parsed message
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: hdr_len: 954, offset: 3
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: round 0 in injection
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: processing message
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: stored '4000000054709a5529f6ce3400a5c59bccf9.m' 960/666 bytes
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: added 1 recipients
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: stored recipients, rc=0
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: stored indexdata, rc=0
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: stored metadata, rc=0
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: sent: 250 Ok 4000000054709a5529f6ce3400a5c59bccf9 <rcpt@domain.com>#015
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: from=TEST'new@domain.com, size=960, attachments=0, reference=, message-id=<E1XsBSN-0008E2-HO@server.domain.com>, retention=395, delay=0.00, delays=0.00/0.00/0.00/0.00/0.00/0.00, status=stored
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: got: QUIT
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: removed
Nov 22 14:14:35 server piler[5570]: 4000000054709a5529f6ce3400a5c59bccf9: sent: 221 server.domain.com Goodbye#015

mysql search

SELECT `from` FROM `v_messages` WHERE `piler_id` = '4000000054709a5529f6ce3400a5c59bccf9'

result is 'new@domain.com'. The 'TEST' part is missing.

Also it seems that these characters are allowed. http://www.remote.org/jochen/mail/info/chars.html

Thanks.

Comments (4)

  1. Janos SUTO repo owner

    The link you provided said that ' and & may be usable in email addresses. Anyway the parser rewrites them that's why you get only new@domain.com.

  2. Janos SUTO repo owner

    Try the following: edit src/parser_utils.c, and locate function translateLine(), and replace the following line

    if( (state->message_state == MSG_FROM || state->message_state == MSG_TO || state->message_state == MSG_CC || state->message_state == MSG_RECIPIENT) && *p == '_'){ continue; }
    

    with this:

    if( (state->message_state == MSG_FROM || state->message_state == MSG_TO || state->message_state == MSG_CC || state->message_state == MSG_RECIPIENT) && (*p == '_' || *p == '\'' || *p == '&') ){ continue; }
    

    Then recompile, and check if it works.

  3. Log in to comment