[Bug 235136] cron email header has bogus date value

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 15 Apr 2024 09:16:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235136

--- Comment #3 from Michael Osipov <michaelo@FreeBSD.org> ---
Here is the updated spec:
https://datatracker.ietf.org/doc/html/rfc5322#section-3.3

You are right, but I think that the issue with the format isn't in cron itself
regardless of th invalid time value.
This what I see: Date: Mon, 15 Apr 2024 10:59:00 +0200 (CEST)
That value isn't comming from cron:
> 560 #ifdef MAIL_DATE
> 561 /* Sat, 27 Feb 93 11:44:51 CST
> 562  * 123456789012345678901234567
> 563  */
> 564 char *
> 565 arpadate(clock)
> 566     time_t *clock;
> 567 {
> 568     time_t t = clock ?*clock :time(0L);
> 569     struct tm *tm = localtime(&t);
> 570     static char ret[32];    /* zone name might be >3 chars */
> 571
> 572     if (tm->tm_year >= 100)
> 573         tm->tm_year += 1900;
> 574
> 575     (void) snprintf(ret, sizeof(ret), "%s, %2d %s %d %02d:%02d:%02d %s",
> 576                DowNames[tm->tm_wday],
> 577                tm->tm_mday,
> 578                MonthNames[tm->tm_mon],
> 579                tm->tm_year,
> 580                tm->tm_hour,
> 581                tm->tm_min,
> 582                tm->tm_sec,
> 583                TZONE(*tm));
> 584     return ret;
> 585 }
> 586 #endif /*MAIL_DATE*/

TZONE macro looks fine to me. Now look into config.h:
 58
 59 /* #define MAIL_DATE */             /*-*/
 60             /* should we include an ersatz Date: header in
 61              * generated mail?  if you are using sendmail
 62              * for MAILCMD, it is better to let sendmail
 63              * generate the Date: header.
 64              */

So I consider the sendmail command is producing this value. If you are running
from stable can you enable that MAIL_DATE macro and see what happens? As it
really turns out: "Date: ..." isn't produced by cron at all.

-- 
You are receiving this mail because:
You are the assignee for the bug.