Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Bernhard Erdmann
Hi,

I have a Cyrus installation where Sieve writes an empty line into the 
header. Header and body of a mail are seperated by definition by a blank 
line.

By submitting an extra blank line between Message-ID: and Date:, Sieve 
writes From:, Date:, Subject: etc. into the body of the mail.

Server software is Cyrus 2.1.14 and Exim 3.36 on Linux.

- Sieve script:

#Mail filter rules for be
#Generated by be using SmartSieve 0.5.1-devel 2003/07/19 12:32:41
require ["vacation"];
vacation :days 4 :addresses ["[EMAIL PROTECTED]"] text:
junk
.
;
##PSEUDO script start
#vacation&&4&&"[EMAIL PROTECTED]"&&junk&&on
#mode&&basic
- autoreply mail:

[...]
Received: from cyrus by xxx with local (Exim 3.36 #2)
id 19dp5R-Aj-00
for [EMAIL PROTECTED]; Sat, 19 Jul 2003 12:37:09 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 19 Jul 2003 12:37:09 +0200
X-Sieve: CMU Sieve 2.2
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Re: junk
In-Reply-To: <[EMAIL PROTECTED]>
Auto-Submitted: auto-replied (vacation)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: by AMaViS 0.3.12
junk



Re: Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Ken Murchison


Bernhard Erdmann wrote:

Hi,

I have a Cyrus installation where Sieve writes an empty line into the 
header. Header and body of a mail are seperated by definition by a blank 
line.

By submitting an extra blank line between Message-ID: and Date:, Sieve 
writes From:, Date:, Subject: etc. into the body of the mail.

Server software is Cyrus 2.1.14 and Exim 3.36 on Linux.

- Sieve script:

#Mail filter rules for be
#Generated by be using SmartSieve 0.5.1-devel 2003/07/19 12:32:41
require ["vacation"];
vacation :days 4 :addresses ["[EMAIL PROTECTED]"] text:
junk
.
;
##PSEUDO script start
#vacation&&4&&"[EMAIL PROTECTED]"&&junk&&on
#mode&&basic
- autoreply mail:

[...]
Received: from cyrus by xxx with local (Exim 3.36 #2)
id 19dp5R-Aj-00
for [EMAIL PROTECTED]; Sat, 19 Jul 2003 12:37:09 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 19 Jul 2003 12:37:09 +0200
X-Sieve: CMU Sieve 2.2
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Re: junk
In-Reply-To: <[EMAIL PROTECTED]>
Auto-Submitted: auto-replied (vacation)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: by AMaViS 0.3.12


I'm not convinced that this is being caused by Cyrus.  Here a snippit of 
the code which produces the vacation response.  As you can see, there is 
no extra CRLF after the Message-ID (or before Date).

t = time(NULL);
p = getpid();
snprintf(outmsgid, sizeof(outmsgid), "<[EMAIL PROTECTED]>",
 (int) p, (int) t, global_outgoing_count++, config_servername);
fprintf(sm, "Message-ID: %s\r\n", outmsgid);

rfc822date_gen(datestr, sizeof(datestr), t);
fprintf(sm, "Date: %s\r\n", datestr);
fprintf(sm, "X-Sieve: %s\r\n", SIEVE_VERSION);
fprintf(sm, "From: <%s>\r\n", src->fromaddr);
fprintf(sm, "To: <%s>\r\n", src->addr);
--
Kenneth Murchison Oceana Matrix Ltd.
Software Engineer 21 Princeton Place
716-662-8973 x26  Orchard Park, NY 14127
--PGP Public Key--http://www.oceana.com/~ken/ksm.pgp


Re: Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Bernhard Erdmann
I'm not convinced that this is being caused by Cyrus.  Here a snippit of 
the code which produces the vacation response.  As you can see, there is 
no extra CRLF after the Message-ID (or before Date).

t = time(NULL);
p = getpid();
snprintf(outmsgid, sizeof(outmsgid), "<[EMAIL PROTECTED]>",
 (int) p, (int) t, global_outgoing_count++, config_servername);
fprintf(sm, "Message-ID: %s\r\n", outmsgid);

rfc822date_gen(datestr, sizeof(datestr), t);
fprintf(sm, "Date: %s\r\n", datestr);


Hi Ken,

if datestr should begin with crlf or if outmsgid should end with crlf, 
there would be the possibility of an extra blank line.

Regards
Bernie


Re: Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Bernhard Erdmann
I'm not convinced that this is being caused by Cyrus.  Here a snippit of 
the code which produces the vacation response.  As you can see, there is 
no extra CRLF after the Message-ID (or before Date).
You're right. I generated a bounce message using sieve. Exim was 
configured not to deliver any mail, so I could watch the bounce's header 
lines in Exim's spool.

This is the output of "exim -Mvh 19dvc2-lu-00" (show header of mail).:

 start 
19dvc2-lu-00-H
cyrus 76 12
<>
1058636114 0
-ident cyrus
-received_protocol local
-body_linecount 46
XX
1
[EMAIL PROTECTED]
141P Received: from cyrus by ente.berdmann.de with local (Exim 3.36 #1)
id 19dvc2-lu-00
for [EMAIL PROTECTED]; Sat, 19 Jul 2003 19:35:14 +0200
060I Message-ID: <[EMAIL PROTECTED]>
039  Date: Sat, 19 Jul 2003 19:35:14 +0200
024  X-Sieve: CMU Sieve 2.2
041* From: Mail Sieve Subsystem 
053F From: Mail Sieve Subsystem <[EMAIL PROTECTED]>
022T To: <[EMAIL PROTECTED]>
019  MIME-Version: 1.0
106  Content-Type: multipart/report; report-type=disposition-notification;
boundary="2906/ente.berdmann.de"
038  Subject: Automatically rejected mail
041  Auto-Submitted: auto-replied (rejected)
- end -
Very interesting is the line termination. 14 lines end on LF (\n, 0x0a) 
and starting with "060I Message-ID" the lines terminate with CRLF (\r\n, 
0x0d 0x0a).

After having delivered this mail into a cyrus box, there was an extra 
blank line between Message-ID: and Date:

So it doesn't seem to be Sieve's failure when generating the bounce 
mail. But someone else adds an extra line.

Return-Path: <>
Received: from ente.berdmann.de ([unix socket])
	by ente.berdmann.de (Cyrus v2.1.13) with LMTP; Sat, 19 Jul 2003 
19:41:22 +0200
X-Sieve: CMU Sieve 2.2
Received: from cyrus by ente.berdmann.de with local (Exim 3.36 #1)
	id 19dvc2-lu-00
	for [EMAIL PROTECTED]; Sat, 19 Jul 2003 19:35:14 +0200
Message-ID: <[EMAIL PROTECTED]>

Date: Sat, 19 Jul 2003 19:35:14 +0200
X-Sieve: CMU Sieve 2.2
From: Mail Sieve Subsystem <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=disposition-notification;
boundary="2906/ente.berdmann.de"
Subject: Automatically rejected mail
Auto-Submitted: auto-replied (rejected)
[...]


Re: Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Ken Murchison


Bernhard Erdmann wrote:

I'm not convinced that this is being caused by Cyrus.  Here a snippit 
of the code which produces the vacation response.  As you can see, 
there is no extra CRLF after the Message-ID (or before Date).

t = time(NULL);
p = getpid();
snprintf(outmsgid, sizeof(outmsgid), "<[EMAIL PROTECTED]>",
 (int) p, (int) t, global_outgoing_count++, config_servername);
fprintf(sm, "Message-ID: %s\r\n", outmsgid);

rfc822date_gen(datestr, sizeof(datestr), t);
fprintf(sm, "Date: %s\r\n", datestr);


Hi Ken,

if datestr should begin with crlf or if outmsgid should end with crlf, 
there would be the possibility of an extra blank line.
It doesn't matter if datestr starts with CRLF, since "Date:" is in front 
of it.  outmsgid clearly ends with ">".

--
Kenneth Murchison Oceana Matrix Ltd.
Software Engineer 21 Princeton Place
716-662-8973 x26  Orchard Park, NY 14127
--PGP Public Key--http://www.oceana.com/~ken/ksm.pgp


Re: Sieve writes an empty line in headers for reject/vacation

2003-07-19 Thread Bernhard Erdmann
I'm not convinced that this is being caused by Cyrus.  Here a snippit of 
the code which produces the vacation response.  As you can see, there is 
no extra CRLF after the Message-ID (or before Date).
I further tracked down the empty line. Seems like something is going 
wrong with the line termination.

I configured Exim to deliver using LMTP over TCP/IP instead of using a 
socket:

-- exim.conf:
local_lmtp:
  driver = smtp
  protocol = lmtp
  service = lmtp
  hosts = localhost
  hosts_override
  gethostbyname
  allow_localhost
-- cyrus.conf:
  lmtp  cmd="lmtpd -a" listen="lmtp" prefork=0
#  lmtpunix cmd="lmtpd" listen="/var/imap/socket/lmtp" prefork=0
Then I attached tcpdump/ethereal to the loopback interface. The 
communication between Exim and Cyrus is shown below.

The lines up to and including "Received: ... +0200" are terminated using 
\r\n. The following lines are terminated using \r\r\n.

220 ente.berdmann.de LMTP Cyrus v2.1.13 ready
LHLO ente.berdmann.de
250-ente.berdmann.de
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-SIZE
250-AUTH EXTERNAL
250 IGNOREQUOTA
MAIL FROM:<> SIZE=3054
RCPT TO:<[EMAIL PROTECTED]>
DATA
250 2.1.0 ok
250 2.1.5 ok
354 go ahead
Received: from cyrus by ente.berdmann.de with local (Exim 3.36 #1)
id 19dwYQ-uw-00
for [EMAIL PROTECTED]; Sat, 19 Jul 2003 20:35:34 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Sat, 19 Jul 2003 20:35:34 +0200
X-Sieve: CMU Sieve 2.2
From: Mail Sieve Subsystem <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=disposition-notification;
boundary="3529/ente.berdmann.de"
Subject: Automatically rejected mail
Auto-Submitted: auto-replied (rejected)
[...]