Package: ssmtp
Version: 2.61
Severity: important

I built SSMTP on Solaris 10 using the gcc 3.4.3 as supplied by Sun 
Microsystems.  I found that when I sent mails using PHP's mail() function 
through a web interface that the date was mangled.  There was no day of the 
month, but instead there was a %_d string in its place - "Date: Wed, %_d Mar 
2006 15:20:07 +010".  A sample mail is below.

The problem was reproducible when compiling with the Studio 10 C compiler from 
Sun.

I found the cause of the problem to be in the file arpadate.c on line 82:

     const char *format = "%a, %_d %b %Y %H:%M:%S %z";

In this line, the day number of the month is as a %_d, which seems to be 
incorrect.  I changed the line and removed the _ so that I had the following:

     const char *format = "%a, %d %b %Y %H:%M:%S %z";

After this change and a rebuild, ssmtp sent the mails with a correct and 
unmangled date - "Date: Wed, 15 Mar 2006 16:01:03 +0100"

I have been unable to verify if this bug exists on a Linux system as testing 
in the environment I have to work in is not possible.


Additional information which may be useful is as follows:

# uname -a
SunOS devel 5.10 Generic sun4u sparc SUNW,Sun-Fire-V440

# gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured 
with: /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure 
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as 
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ 
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)


The PHP script that was called in a browser is  (the actual receiver address 
has been manually changed to test.user for this post in order to avoid spam 
problems!):

<?php
$to      = '[EMAIL PROTECTED]';
$subject = 'Testmail';
$message = 'Body';

$date= date("d M y, G:i:s");

if ( mail($to, $subject, $message) == TRUE)
{
        echo "OK: $date, mail($to, $subject, $message)";
}
else
        echo "Failed";

?>


A mail that is generated by the buggy ssmtp code is as follows (the actual 
receiver address has been manually changed to test.user for this post in 
order to avoid spam problems!)

Return-Path: <[EMAIL PROTECTED]>
Received: from smtpa.meduniwien.ac.at (milena.srv.meduniwien.ac.at 
[149.148.224.62])
        by molly (Cyrus v2.2.3) with LMTPA; Wed, 15 Mar 2006 15:20:07 +0100
X-Sieve: CMU Sieve 2.2
Received: from localhost (localhost [127.0.0.1])
        by smtpa.meduniwien.ac.at (Postfix) with ESMTP id D6ED024C652
        for <[EMAIL PROTECTED]>; Wed, 15 Mar 2006 15:20:07 +0100 (CET)
Received: from smtpa.meduniwien.ac.at ([127.0.0.1])
 by localhost (milena [127.0.0.1]) (amavisd-new, port 10024) with LMTP
 id 02346-02-41 for <[EMAIL PROTECTED]>;
 Wed, 15 Mar 2006 15:20:07 +0100 (CET)
Received: from test-walda.srv.meduniwien.ac.at 
(test-walda.srv.meduniwien.ac.at [149.148.224.74])
        by smtpa.meduniwien.ac.at (Postfix) with SMTP id 65FCC24C621
        for <[EMAIL PROTECTED]>; Wed, 15 Mar 2006 15:20:07 +0100 (CET)
Received: by test-walda.srv.meduniwien.ac.at (sSMTP sendmail emulation); Wed, 
%_d Mar 2006 15:20:07 +010
From: "WebServer Reserved UID" <[EMAIL PROTECTED]>
Date: Wed, %_d Mar 2006 15:20:07 +010
To: [EMAIL PROTECTED]
Subject: Testmail
Message-Id: <[EMAIL PROTECTED]>
X-Virus-Scanned: by amavisd-new at meduniwien.ac.at
Content-Type: 
X-UID: 4538
X-Length: 1264

Body



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to