From: jpd@ucs.usl.edu (Dugal James P.)
Subject: UIUC/IDA sendmail 565c bug + FIX
Organization: Univ. of Southwestern La., Lafayette
Date: Tue, 17 Nov 1992 23:40:00 GMT

Here is a smtp trace from the KA9Q program, sending mail to a SunOS system
running sendmail 5.65c.  Note that the second MAIL FROM is lost (or more
properly, received out-of-order) by sendmail, resulting in a 503 error.
The KA9Q option SMTP BATCH was set on, which causes the HELO, MAIL FROM,
RCPT TO, and DATA commands to be sent in one transmission.

Connected
smtp sent: HELO smh323.ucs.usl.edu
smtp sent: MAIL FROM:<jpd@smh323.ucs.usl.edu>
smtp sent: RCPT TO:<jpd@ucs.usl.edu>
smtp sent: DATA
smtp recv: 220 armagnac.ucs.usl.edu 5.65c/IDA-1.4.4 Sendmail is ready at Tue, 17
 Nov 1992 14:02:51 -0600
smtp recv: 250 Hello smh323.ucs.usl.edu, pleased to meet you
smtp recv: 250 <jpd@smh323.ucs.usl.edu>... Sender ok
smtp recv: 250 <jpd@ucs.usl.edu>... Recipient ok
smtp recv: 354 Enter mail, end with "." on a line by itself
smtp sent: .
smtp recv: 250 Ok
sending job 45
smtp sent: MAIL FROM:<jpd@smh323.ucs.usl.edu>
smtp sent: RCPT TO:<jpd@ucs.usl.edu>
smtp sent: DATA
smtp recv: 250 <jpd@ucs.usl.edu>... Recipient ok
smtp recv: 503 Need valid MAIL command
smtp recv: 250 <jpd@smh323.ucs.usl.edu>... Sender ok
smtp sent: .
smtp sent: QUIT
smtp job /spool/mqueue/45.wrk returned to sender

===================================================================

Here is another trace from the KA9Q program, this time with the SMTP
BATCH option set to no, ie, lock-step mode.

Connected
smtp sent: HELO smh323.ucs.usl.edu
smtp sent: MAIL FROM:<jpd@smh323.ucs.usl.edu>
smtp sent: RCPT TO:<jpd@ucs.usl.edu>
smtp sent: DATA
smtp recv: 354 Enter mail, end with "." on a line by itself
smtp sent: .
smtp recv: 250 Ok
sending job 39
smtp sent: MAIL FROM:<jpd@smh323.ucs.usl.edu>
smtp recv: 250 <jpd@smh323.ucs.usl.edu>... Sender ok
smtp sent: RCPT TO:<jpd@ucs.usl.edu>
smtp recv: 250 <jpd@ucs.usl.edu>... Recipient ok
smtp sent: DATA
smtp recv: 354 Enter mail, end with "." on a line by itself
smtp sent: .
smtp recv: 250 Ok
sending job 41
smtp sent: MAIL FROM:<jpd@smh323.ucs.usl.edu>
smtp recv: 250 <jpd@smh323.ucs.usl.edu>... Sender ok
smtp sent: RCPT TO:<jpd@ucs.usl.edu>
smtp recv: 250 <jpd@ucs.usl.edu>... Recipient ok
smtp sent: DATA
smtp recv: 354 Enter mail, end with "." on a line by itself
smtp sent: .
smtp recv: 250 Ok
smtp sent: QUIT

===================================================================

I have looked at the srvrsmtp.c source, and found that when I changed it
to NOT spawn a child process in reponse to the MAIL FROM command, my
problem went away.  Here's a diff:

*** srvrsmtp.c.orig	Mon Jun 24 15:27:31 1991
--- srvrsmtp.c	Tue Nov 17 13:31:18 1992
***************
*** 267,275 ****
--- 277,288 ----
  				exit(0);
  			}
  
+ #ifdef notdef
+ /* ka9q smtp batch fails for 2nd MAIL in a connection */
  			/* fork a subprocess to process this command */
  			if (runinchild("SMTP-MAIL") > 0)
  				break;
+ #endif
  			define('s', sendinghost, CurEnv);
  			define('r', "SMTP", CurEnv);
  			initsys();
===============================================

Is there a more elegant fix, or at least a diagnosis of what's
happening and why this fixes the problem?

-- James Dugal,	N5KNX		Internet: jpd@usl.edu
Associate Director		Ham packet: n5knx @k5arh (land), UO-22 (sat.)
Computing Center		US Mail: PO Box 42770  Lafayette, LA  70504
University of Southwestern LA.	Tel. 318-231-6417	U.S.A.


-- 
-- James Dugal,	N5KNX		Internet: jpd@usl.edu
Associate Director		Ham packet: n5knx @k5arh (land), UO-22 (sat.)
Computing Center		US Mail: PO Box 42770  Lafayette, LA  70504
University of Southwestern LA.	Tel. 318-231-6417	U.S.A.