[comp.mail.sendmail] '\n.\n' in body of mail

lws@comm.wang.com (Lyle Seaman) (12/08/90)

I've been trying to debug another implementation of an SMTP mail agent,
and one of the problems I'm facing is dealing with a '\n.\n' embedded
in the body of the mail.

It appears that Sendmail 5.61 deals correctly with this during the 
SMTP exchange of mail, but when I try to do something like 
'sendmail -t -v < item'    where item has a '\n.\n' in it, sendmail
truncates the mail at the dot, before it ever gets to SMTP.

Does anybody have any idea where this is occurring?

-- 
Lyle                      Wang             lws@comm.wang.com
508 967 2322         Lowell, MA, USA       uunet!comm.wang.com!lws
             The scum always rises to the top.

rickert@mp.cs.niu.edu (Neil Rickert) (12/14/90)

In article <1990Dec7.173846.4824@comm.wang.com> lws@comm.wang.com (Lyle Seaman) writes:
>I've been trying to debug another implementation of an SMTP mail agent,
>and one of the problems I'm facing is dealing with a '\n.\n' embedded
>in the body of the mail.
>
 Check 'sendmail.cf' and see if there is a line containing 'Oi'.  If there
is, simply remove the line, rebuild the freeze file if you are using one
(with 'sendmail -bz', and your problem should be solved.

 Next start monitoring everything that uses mail, to see if anything else
is now broken.  That 'Oi' might have been put there for a reason.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115.                                  +1-815-753-6940

csd35@seq1.keele.ac.uk (Jonathan Knight) (12/17/90)

From article <1990Dec14.141102.17655@mp.cs.niu.edu>, by rickert@mp.cs.niu.edu (Neil Rickert):
> In article <1990Dec7.173846.4824@comm.wang.com> lws@comm.wang.com (Lyle Seaman) writes:
>>I've been trying to debug another implementation of an SMTP mail agent,
>>and one of the problems I'm facing is dealing with a '\n.\n' embedded
>>in the body of the mail.
>  Check 'sendmail.cf' and see if there is a line containing 'Oi'.  If there
> is, simply remove the line, rebuild the freeze file if you are using one
> (with 'sendmail -bz', and your problem should be solved.

True.  But another one will begin (at least under Sun's version of sendmail).
I found that no mail could be transfered over our ethernet between sendmail's.
The problem is that sendmail assumes that a '.' on its own ends the DATA
input when using SMTP and the transmitting sendmail will send a '.' and
then wait for an OK message.  With Oi switched off the receiver just sits
there waiting for more data and so the connection times out without
sending the mail.
-- 
  ______    JANET :jonathan@uk.ac.keele.cs     Jonathan Knight,
    /       BITNET:jonathan%cs.kl.ac.uk@ukacrl Department of Computer Science
   / _   __ other :jonathan@cs.keele.ac.uk     University of Keele, Keele,
(_/ (_) / / UUCP  :...!ukc!kl-cs!jonathan      Staffordshire.  ST5 5BG.  U.K.

rickert@mp.cs.niu.edu (Neil Rickert) (12/18/90)

In article <757@keele.keele.ac.uk> csd35@seq1.keele.ac.uk (Jonathan Knight) writes:
>From article <1990Dec14.141102.17655@mp.cs.niu.edu>, by rickert@mp.cs.niu.edu (Neil Rickert):
>>  Check 'sendmail.cf' and see if there is a line containing 'Oi'.  If there
>> is, simply remove the line, rebuild the freeze file if you are using one
>> (with 'sendmail -bz', and your problem should be solved.
>
>True.  But another one will begin (at least under Sun's version of sendmail).

 If I recall I did add a warning that the 'Oi' might be there for a reason.

>I found that no mail could be transfered over our ethernet between sendmail's.
>The problem is that sendmail assumes that a '.' on its own ends the DATA
>input when using SMTP and the transmitting sendmail will send a '.' and
>then wait for an OK message.  With Oi switched off the receiver just sits
>there waiting for more data and so the connection times out without
>sending the mail.

  If Sun sendmails do this they are badly broken (which probably isn't news to
anyone).  The '.' to terminate the SMTP data phase is part of the SMTP
protocol, and is supposed to be implemented quite apart from the presence
of 'Oi' in 'sendmail.cf'.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

barnett@grymoire.crd.ge.com (Bruce Barnett) (12/19/90)

In article <1990Dec17.180410.2699@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:

    If I recall I did add a warning that the 'Oi' might be there for a reason.

Neil is right. The protocol states that a line with a \n.\n is the end
of the DATA section.

Typically, machines add a second dot to all lines that start with a
dot,
and the receiving system removed the extra dot.
Therefore, a line that has

	.pp

is converted into

	..pp

when the receiving machine converts back. There is a mailer flag
in the sendmail.cf file that specifies if the machine you connect to
understands this or not. 

If you have the flag set, and the remote machine does not understand
this convention, all lines that start with a dot will have two dots in
them.

If you don't have the flag set,and the remote machine expects this
convention, your mail might be truncated at any line that starts with
a dot.

I just checked - and the mailer flag you want to use or ommit is 'X'.
Here is the X flag on our ethernet mailer:

# mailer
# 	ether {
# 		Path = "[TCP]",
# 		Flags = { f_mult, f_strip, f_date, f_from, f_mesg, f_upperu, f_addrw, f_dot },
# 		Sender = RULESET_11,
# 		Recipient = RULESET_21,
# 		Argv = "TCP ${m_rhost}"
# 	};
Mether, P=[TCP], F=msDFMuCX, S=11, R=21, A=TCP $h
--
Bruce G. Barnett	barnett@crd.ge.com	uunet!crdgw1!barnett

lws@comm.wang.com (Lyle Seaman) (12/29/90)

Me again.  I started this off by wondering about why Sendmail truncates
input after the '\n.\n', and it's wandered a bit.  Some more details:

yes, it's running on a Sun, but it's not Sun's Sendmail.  I got rid of that.
No, there is no Oi flag currently, I put one in to try to deal with this,
but took it back out, because all deliveries were terminating ungracefully
when the connection went down.  
Yes, I'm using the X flag on the relevant mailer, but that's not the
problem.  The dots are being doubled going over the network, that's fine.

The problem is that I can't get a single dot ('\n.\n') INTO sendmail
("/usr/lib/sendmail -t <somefile") to see if that is doubled correctly,
and singled correctly by the other end...  

So I was trying to figure out why sendmail truncates stdin, and where.
If I do something like ("/usr/lib/sendmail -t -oi <somefile") isn't
that going to change the behavior of the code that handles the SMTP
protocol?  Hmmm.  Oi just says whether to take '\n.\n' as EOM, doesn't
it?  So the dot doubling should work the same way it used to.  And 
since this sendmail isn't receiving the '\n.\n', there shouldn't be
any problem with aborting connections.  Yeah, that just might work.

-- 
Lyle                  Wang           lws@capybara.comm.wang.com
508 967 2322     Lowell, MA, USA     Source code: the _ultimate_ documentation.