[asterisk-bugs] [Asterisk 0016557]: Asterisk produces malformed email files for voicemail

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 8 11:39:48 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16557 
====================================================================== 
Reported By:                jcovert
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16557
Category:                   Applications/app_voicemail
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.6.0.20 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-01-06 09:29 CST
Last Modified:              2010-01-08 11:39 CST
====================================================================== 
Summary:                    Asterisk produces malformed email files for
voicemail
Description: 
Asterisk is inserting an extra <cr> into the voicemail attachment.  This
causes some mail relays to fail to forward the SMTP message.

While the correct line termination in an SMTP message IS <cr><lf>, the
conversion from the Unix <lf> line terminator to <cr><lf> is handled by
sendmail.  When sendmail gets a file which (mostly) has just <lf>
terminators up until the attachment, it sees the <cr><lf> in the attachment
portion and converts that to <cr><cr><lf>.  This confuses some mail relays
down the road and prevents delivery.

This is a problem in all versions, and the fix is trivial:

At line 418 of the current head, there appears

#define eol "\r\n" 

this should just be "\n"

The resulting SMTP message will still have <cr><lf> once it has been
processed by the sendmail command.

"eol" is used ONLY in "ochar" which is used only in "base_encode".

====================================================================== 

---------------------------------------------------------------------- 
 (0116313) ebroad (manager) - 2010-01-08 11:39
 https://issues.asterisk.org/view.php?id=16557#c116313 
---------------------------------------------------------------------- 
sSMTP(sendmail alternative) on Slackware behaves the same. Each mime line
ends with 0x0d 0x0d 0x0a(wireshark dump), which ends up with a truncated
attachment at the destination(SmarterMail). sSMTP has code to convert \n to
\r\n so it can play nice with qmail. 

A little research suggests that sendmail may replace LF with CRLF if it
receives mixed terminators. One thing I noticed is that ENDL, which is used
for the rest of the message body, is \n unless you are using IMAP
storage(line 4214). So \n for headers and body, and \r\n for mime lines may
cause sendmail to convert \r\n \r\r\n since it initially sees \n.
Additionally, based on an e-mail thread on postfix-users about an identical
issue with php mail(), postfix seems to exhibit the same behavior. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-08 11:39 ebroad         Note Added: 0116313                          
======================================================================




More information about the asterisk-bugs mailing list