Who am I? --------- My name is John Saunders and I run a modest ISP in Sydney Australia. I've used qmail since 0.92 and have come to regard it as a very powerful and secure MTA. My ISP uses qmail on all the servers, and now I have no more worries about sendmail security holes. mailto:john@nlc.net.au What is this patch? ------------------- This patch is for qmail 0.94 to allow qmail-smtpd to accept messages that are terminated with a single \n instead of the required \r\n sequence. This patch may also apply to other qmail versions. Why would I want to use this patch? ----------------------------------- I started logging error messages from qmail-smtpd and was horrified to find just how many broken MTAs there are out there. I was even more horrified to find out the number of messages qmail was bouncing because of this. I also had a number of customer problems about messages not being accepted. If you have customer complaints, or want to run a mail system with a reputation for getting the mail through, then you might want this patch. P.S. If you want to know how to log qmail-smtpd activity, then drop me an email and I'll tell you. Dan gave me his multitee program which makes it all possible. What do the RFCs (the internet rules) say? ------------------------------------------ The \r\n sequence is _required_ by the SMTP protocol. However a number of MTAs on the 'net today do not obey this rule. Typically some Windows MUAs (which is strange since \r\n is the natural Windows way of doing things) and some "custom" unix MTAs use a single \n to terminate lines. Also if sendmail is mis-configured it can also cause this. In fact the qmail error message mentions something about a mis-configured sendmail under Solaris. Why doesn't qmail support this already? --------------------------------------- Qmail is normally very strict about what it sends and receives, Dan did a good job and wrote an MTA that obeys the rules. However qmail expects other MTAs to do the right thing. Sadly this isn't the case in the real world. I prefer the "strict when sending, lax when receiving" rule which promotes better connectivity. The patch. ---------- After you unpack qmail, cd into the qmail-0.9x directory and run the patch command like this: $ patch -s -p0 <../qmail-smtpd-newline.patch Assuming that you have this file sitting in the parent directory. --- qmail-smtpd.c.orig Mon Dec 9 05:50:10 1996 +++ qmail-smtpd.c Sat Dec 21 00:41:44 1996 @@ -114,14 +114,25 @@ int flagmaybex; /* 1 if this line might match RECEIVED, if fih */ int flagmaybey; /* 1 if this line might match \r\n, if fih */ int flagmaybez; /* 1 if this line might match DELIVERED, if fih */ + int seencr; state = 1; *hops = 0; flaginheader = 1; - pos = 0; flagmaybex = flagmaybey = flagmaybez = 1; + pos = 0; flagmaybex = flagmaybey = flagmaybez = 1; seencr = 0; for (;;) { if (substdio_get(ssfrom,&ch,1) <= 0) die(); + if (ch == '\n') + { + if (seencr == 0) + { + substdio_seek(ssfrom,-1); + ch = '\r'; + } + } + if (ch == '\r') seencr = 1; + else seencr = 0; if (flaginheader) { if (pos < 9)