Subject: extra response in smtp_open throws later commands off

From: [email-masked]
Date: Tue, 30 Jul 1996 00:09:58 -0700

I'm writing a variation of smtp_mail that takes its input from a file, aot an ENVELOPE and BODY.

Below is a log of a send bug that I'm experiencing.
Note the response to a RSET is a 500 Command unrecognized.  This appears to be held over from the
EHLO thats sent in smtp_open, and it throws the responses out of sync with the commands that elicit them.  My program eventually aborts because it doesn't get the response it expects.  This doesn't always happen, but sometimes.

So the first part of the question is where is the bad command coming from?  Its in the queue as of the smtp_open call, because if I force the program thru an extra call to smtp_reply, the responses get back in synch and the send works okay.

The second part of the question is whether there is a more tolerant way to parse replies other than:

  do reply = smtp_reply (stream);
  while (stream->reply[3] == '-');

so that I can pull replies off the TCP queue until they are gone, aot until the syntax implies.  Is there any benefit to writing the reply function so that I can send a RSET and then pull off any queued up responses until the buffer is empty, or should I just find whats generating the 500 error, fix that and trust that things will stay in synch after that?

Has ayone seen this kind of behavior, or have clues as to how to track it down?

Adam
----------------------------------

OUT-> 36.21.0.128:25 )   EHLO 220 mailhub.Stanford.EDU ESMTP Sendmail 8.7.5/8.7.3; Mon, 29 Jul 1996 21:52:42 -0700 (PDT)
IN <- 36.21.0.128:25 )   250-mailhub.Stanford.EDU Hello [205.158.210.134], pleased to meet you
 
IN <- 36.21.0.128:25 )   250-EXPN
IN <- 36.21.0.128:25 )   250-8BITMIME
IN <- 36.21.0.128:25 )   250-SIZE
IN <- 36.21.0.128:25 )   250-DSN
IN <- 36.21.0.128:25 )   250-VERB
IN <- 36.21.0.128:25 )   250-ONEX
IN <- 36.21.0.128:25 )   250 HELP

OUT-> 36.21.0.128:25 )   RSET
IN <- 36.21.0.128:25 )   500 Command unrecognized

OUT-> 36.21.0.128:25 )   MAIL FROM:<[email-masked]> 
IN <- 36.21.0.128:25 )   250 Reset state

OUT-> 36.21.0.128:25 )   RCPT TO:<[email-masked]>
IN <- 36.21.0.128:25 )   250 <[email-masked]>... Sender ok

OUT-> 36.21.0.128:25 )   DATA
IN <- 36.21.0.128:25 )   250 Recipient ok

OUT-> 36.21.0.128:25 )   QUIT 
IN <- 36.21.0.128:25 )   354 Enter mail, end with "." on a line by itself
OUT-> 36.21.0.128:25 )   QUIT
IN <- 36.21.0.128:25 )   Asynch stream close initiated.