[milters] Archive

Lists Index Date Thread Search

Article: 67
From: Todd Lyons
Date: 2009-08-26 16:13:58 -0400
Subject: milter-date ignores -strict-date-syntax option

Hi, all!

I have milter-date in deployment, I'm getting valid customers whose
Date headers fail the syntax check.  There is a commandline option
-strict-date-syntax which is supposed to enable(+) or disable(-) that
syntax check.  I added "-strict-date-syntax" to the config file, but
it still enforces the syntax checks.  I see that in milter-date 0.22
the convertDate() function became the default.  Setting OLD_VERSION to
1 in order to use the old function no longer compiles for me now that
the convertDateToGMT() function is no longer in 0.24 source code nor
in the latest libsnert source code.

I'd like to modify the code so that if the strict date syntax option
is turned off, it will just skip that check entirely.  I am not a C
coder, so I'm not sure what data type the optStrictDateSyntax.value
is, and what its range of valid values are.  I would _assume_ it's a 0
for false and anything else for true, but I do not know enough about C
and the libs it is using to know if that is the case.

Does the following adjustment look correct?  I won't try anything
until I get some feedback from others who know the language.

$ diff -ruN -U 7 milter-date.c.orig milter-date.c
--- milter-date.c.orig	2009-08-26 12:56:45.000000000 -0700
+++ milter-date.c	2009-08-26 12:57:35.000000000 -0700
@@ -332,15 +332,15 @@
 getTimestamp(workspace data, const char *date, unsigned long *timestamp)
 	extern int convertDateToGMT(workspace data, const char *date,
unsigned long *timestamp, int strict);

 	if (convertDateToGMT(data, date, timestamp, optStrictDateSyntax.value)) {
-	if (convertDate(date, (time_t *) timestamp, NULL)) {
+	if (optStrictDateSyntax.value && convertDate(date, (time_t *)
timestamp, NULL)) {
 		(void) smfReply(&data->work, 550, "5.7.1", "\"%s\" does
not conform
to RFC 2822 section 3.3. Date and Time Specification", date);
 		return SMFIS_REJECT;


Regards...      Todd

Lists Index Date Thread Search