bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cfexecd 2.0.1 and RFC2822 non-compliance


From: J . K . Wight
Subject: cfexecd 2.0.1 and RFC2822 non-compliance
Date: Wed, 15 May 2002 09:59:03 +0100

I have discovered that cfexecd silently fails to send mail to sysadm
if the MTA on smtpserver strictly complies with RFC2822 in the matter
of line termination. RFC2822 stipulates (in Section 2.1) that:

   Messages are divided into lines of characters.  A line is a series of
   characters that is delimited with the two characters carriage-return
   and line-feed; that is, the carriage return (CR) character (ASCII
   value 13) followed immediately by the line feed (LF) character (ASCII
   value 10).  (The carriage-return/line-feed pair is usually written in
   this document as "CRLF".)

cfexecd sends lines terminated by LF alone. Section 2.3 of RFC2822
states that there must not be stray LF (or CR) characters:

   The body of a message is simply lines of US-ASCII characters.  The
   only two limitations on the body are as follows:

   - CR and LF MUST only occur together as CRLF; they MUST NOT appear
     independently in the body.

   - Lines of characters in the body MUST be limited to 998 characters,
     and SHOULD be limited to 78 characters, excluding the CRLF.

I only became aware of all of this when, trying to get to the root of
non-delivery, I eventually ran cfexcd under Linux strace - as running
with debugging on seemed to suggest that delivery was successful - and
discovered that the MTA - qmail in this case - was sending back the
following message:

   451 See http://pobox.com/~djb/docs/smtplf.html

Appended is a quick fix that gets delivery going, all else being well,
but does nothing to address the issue of cfexecd being lax about
detecting problems while conversing with the MTA.

Jim


*** cfexecd.c.orig      Tue Apr  2 11:56:51 2002
--- cfexecd.c   Wed May 15 09:28:08 2002
***************
*** 683,721 ****
     return;
     }
  
! sprintf(VBUFF,"HELO %s\n",VFQNAME); 
  Dialogue(sd,VBUFF);
  
! sprintf(VBUFF,"MAIL FROM: <address@hidden>\n",VFQNAME);
  Dialogue(sd,VBUFF);
  
! sprintf(VBUFF,"RCPT TO: <%s>\n",to);
  Dialogue(sd,VBUFF);
  
! Dialogue(sd,"DATA\n"); 
  
! sprintf(VBUFF,"Subject: (%s/%s)\n",VFQNAME,VIPADDRESS); 
  sent=send(sd,VBUFF,strlen(VBUFF),0);
! sprintf(VBUFF,"To: %s\n\n",to); 
  sent=send(sd,VBUFF,strlen(VBUFF),0);
  
  while(!feof(fp))
     {
     VBUFF[0] = '\0';
     fgets(VBUFF,bufsize,fp);
!    count++;
!    sent=send(sd,VBUFF,strlen(VBUFF),0);
!    
     if (count > 100)
        {
!       sprintf(VBUFF,"\n[Mail truncated by cfengine. File is at %s on 
%s]\n",file,VFQNAME);
        sent=send(sd,VBUFF,strlen(VBUFF),0);
        break;
        }
     } 
  
! Dialogue(sd,".\n"); 
! Dialogue(sd,"QUIT\n");
  
   
  fclose(fp);
--- 683,725 ----
     return;
     }
  
! sprintf(VBUFF,"HELO %s\r\n",VFQNAME); 
  Dialogue(sd,VBUFF);
  
! sprintf(VBUFF,"MAIL FROM: <address@hidden>\r\n",VFQNAME);
  Dialogue(sd,VBUFF);
  
! sprintf(VBUFF,"RCPT TO: <%s>\r\n",to);
  Dialogue(sd,VBUFF);
  
! Dialogue(sd,"DATA\r\n"); 
  
! sprintf(VBUFF,"Subject: (%s/%s)\r\n",VFQNAME,VIPADDRESS); 
  sent=send(sd,VBUFF,strlen(VBUFF),0);
! sprintf(VBUFF,"To: %s\r\n\r\n",to); 
  sent=send(sd,VBUFF,strlen(VBUFF),0);
  
  while(!feof(fp))
     {
     VBUFF[0] = '\0';
     fgets(VBUFF,bufsize,fp);
!    if (strlen(VBUFF) > 0)
!       {
!       VBUFF[strlen(VBUFF)-1] = '\r';
!       strcat(VBUFF, "\n");
!       count++;
!       sent=send(sd,VBUFF,strlen(VBUFF),0);
!       }
     if (count > 100)
        {
!       sprintf(VBUFF,"\r\n[Mail truncated by cfengine. File is at %s on 
%s]\r\n",file,VFQNAME);
        sent=send(sd,VBUFF,strlen(VBUFF),0);
        break;
        }
     } 
  
! Dialogue(sd,".\r\n"); 
! Dialogue(sd,"QUIT\r\n");
  
   
  fclose(fp);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]