Bug 180303

Summary: cannot forward mail from procmail to cyrus
Product: Red Hat Enterprise Linux 4 Reporter: Frank DiPrete <fdiprete>
Component: cyrus-imapdAssignee: Petr Rockai <prockai>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-12 11:11:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Frank DiPrete 2006-02-07 00:47:46 UTC
Description of problem:
annot configure procmail to forward to cyrus using deliver.
deliver rejects the mesage with exit code 65 (data format error?)

Version-Release number of selected component (if applicable):
cyrus-imapd-2.2.10-1.RHEL4.1
procmail v3.22 2001/09/10

How reproducible:
always

Steps to Reproduce:
1.forward from procmail to cyrus-imapd deliver
2.(see procmailrc below)
3.
  
Actual results:
mail is rejected by deliver with exit code 65 and procmail delivers it to
/var/spool/mail/user instead

Expected results:
delver via cyrus to imap mailbox

Additional info:

/etc/procmailrc

LOGFILE=/var/log/mail/procmail.log
VERBOSE=yes

# check for viruses with clamd
:0fw
| /usr/bin/clamassassin

# if virus is found dump it
:0:
* ^X-Virus-Status: Yes
/var/tmp/virusbucket

# send mail through spamd
:0fw
| /usr/bin/spamc

# if marked as spam dump it
:0:
* ^X-Spam-Status: Yes
/var/tmp/spambucket

#hand off to cyrus for delivery

:0W
| /usr/lib/cyrus-imapd/deliver -e -a $LOGNAME -m user.$LOGNAME

log:

procmail: [4426] Mon Feb  6 19:45:01 2006
procmail: Executing "/usr/bin/clamassassin"
/bin/sh: /usr/bin/clamassassin: No such file or directory
procmail: [4426] Mon Feb  6 19:45:01 2006
procmail: Error while writing to "/usr/bin/clamassassin"
procmail: Rescue of unfiltered data succeeded
procmail: [4426] Mon Feb  6 19:45:01 2006
procmail: No match on "^X-Virus-Status: Yes"
procmail: Executing "/usr/bin/spamc"
procmail: [4426] Mon Feb  6 19:45:02 2006
procmail: No match on "^X-Spam-Status: Yes"
procmail: Executing "/usr/lib/cyrus-imapd/deliver,-e,-a,fdiprete,-m,user.fdiprete"
procmail: Non-zero exitcode (65) from "/usr/lib/cyrus-imapd/deliver"
procmail: Assigning "LASTFOLDER=/usr/lib/cyrus-imapd/deliver -e -a fdiprete -m
user.fdiprete"
procmail: Assigning
"PATH=/home/fdiprete/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin"
procmail: Locking "/var/mail/fdiprete.lock"
procmail: Assigning "LASTFOLDER=/var/mail/fdiprete"
procmail: Opening "/var/mail/fdiprete"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/mail/fdiprete.lock"
procmail: Notified comsat: "fdiprete@0:/var/mail/fdiprete"
From root.net  Mon Feb  6 19:45:01 2006
 Subject: test rhel 4
  Folder: /var/mail/fdiprete

Comment 1 Frank DiPrete 2006-02-07 00:48:16 UTC
same problem on fedora c3:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=180302

Comment 2 Frank DiPrete 2006-02-07 14:24:07 UTC
Found a workaround. After removing the From header cyrus will accept the forward:

LOGFILE=/var/log/maillog
VERBOSE=no

# check for viruses with clamd
:0fw
| /usr/bin/clamassassin

# if virus is found dump it
:0:
* ^X-Virus-Status: Yes
/var/tmp/virusbucket

# send mail through spamd
:0fw
| /usr/bin/spamc

# if marked as spam dump it
:0:
* ^X-Spam-Status: Yes
/var/tmp/spambucket

# hand off to cyrus for delivery
# strip From header - borks cyrus deliver (arg!)
:0f
| formail -I "From "

:0w
| /usr/lib/cyrus-imapd/deliver -e -a $LOGNAME -m user.$LOGNAME

Comment 3 Petr Rockai 2006-05-12 11:11:59 UTC
That isn't a workaround. The From line is not part of the internet message 
format RFC and therefore is invalid. Cyrus correctly rejects such message. 
The problem is that procmail expects that the reading process wants to read 
mbox-formatted input, not just the message. Stripping the From line is 
therefore a correct solution.