[comp.mail.sendmail] Sendmail 5.64

jgreco@archimedes.math.uwm.edu (Joe Greco) (10/09/90)

Hello,

I've just brought up a "new" version of sendmail, 5.64, to replace the older
5.61 and give us MX record capabilities.

In testing it, I ran into a really odd situation.  Our sitewide
configuration specifies verbose delivery always....  I mailed myself on the
same machine and specified the same host, expecting that Sendmail would
either have to look up the host name or figure it out by itself, and I got:

(banach.root.p1-3) 6:02pm ~ 1 # mail jgreco@b 
Subject: test
test message
.
Cc: 
jgreco@b... Connecting to banach.math.uwm.edu via inet...
Trying 129.89.14.65...  connected.
220 banach.math.uwm.edu BSD Sendmail 5.61/2.01 ready to mangle your mail at Mon, 8 Oct 90 18:03:20 -0500
>>> HELO banach.math.uwm.edu
553 Local configuration error, hostname not recognized as local

I traced this down to line 200-205 in sendmail/src/srvrsmtp.c... it appears
to be a very simple error and should probably read: "553 can't specify local
host name" ... it appears to be a recursion trap.

But (imho) Sendmail really should allow this kind of behaviour.  I commented
out the offending code, as it doesn't seem to be something that is really
all that configurable.

... Joe

-------------------------------------------------------------------------------
Joe Greco - University of Wisconsin, Milwaukee - Department of Mathematics
jgreco@archimedes.math.uwm.edu		USnail: Joe Greco
Voice: 414/321-6184				9905 W. Montana Ave.
Data:  414/321-9287 (Happy Hacker's BBS) 	West Allis, WI  53227-3329
ICBM:  43 05 20 N 87 53 10 W
#include <witty_and_humorous_saying.h>
Disclaimer: I don't speak for the Math Department, the University, or myself.

vixie@wrl.dec.com (Paul Vixie) (10/09/90)

Yow.  You commented it out?

What'll happen if the subserver has the same problem some day, deciding
that the mail isn't local and connecting to a subserver, and ... so ... on?

Wouldn't it be easier to just rip off your hostname in S0?
--
Paul Vixie
DEC Western Research Lab	<vixie@wrl.dec.com>
Palo Alto, California		...!decwrl!vixie

jgreco@archimedes.math.uwm.edu (Joe Greco) (10/10/90)

In comp.mail.sendmail article <1990Oct9.080228.19314@wrl.dec.com>, vixie@wrl.dec.com (Paul Vixie) wrote:
:Yow.  You commented it out?

No.  I commented it out and posted.  :-)  If I wasn't worried about it, I
wouldn't have posted.

:What'll happen if the subserver has the same problem some day, deciding
:that the mail isn't local and connecting to a subserver, and ... so ... on?

What happens right now when you can't mail to yourself and specify the local
machine name?  Better to have future problems and fix things now.

:Wouldn't it be easier to just rip off your hostname in S0?

'cept I don't know the first thing about sendmail.cf, except for how to
stuff in the hostname...

What suprises me is that there would be a problem in something provided by
Berkeley (the sendmail.cf configured for internet)....  can anyone suggest a
(specific) fix? Thanks in advance,

... Joe

-------------------------------------------------------------------------------
Joe Greco - University of Wisconsin, Milwaukee - Department of Mathematics
jgreco@archimedes.math.uwm.edu		USnail: Joe Greco
Voice: 414/321-6184				9905 W. Montana Ave.
Data:  414/321-9287 (Happy Hacker's BBS) 	West Allis, WI  53227-3329
ICBM:  43 05 20 N 87 53 10 W
#include <witty_and_humorous_saying.h>
Disclaimer: I don't speak for the Math Department, the University, or myself.

TEMNGT23@ysub.ysu.edu (Lou Anschuetz) (10/10/90)

Hello, this is a slight "fork" in the discussion.  I have an NCR
tower 32/700 on which I have the Wollongong TCP/IP (new version 4.01)
installed.  We have the same problem, however, in that I get a
552 (and 553) error when attempting to use yfn.ysu.edu

/etc/hosts and /etc/HostName report yfn as the local name.  In
sendmail.cf after the Cw I have yfn also, and nothing following
the DD.  If I fool around much with sendmail.cf the sendmail daemon
fails to start to I have been mostly leaving it alone.  Any ideas
for this total TCP/IP novice would really be appreciated.

Thanks in advance....

Lou Anschuetz aka temngt23@ysub.ysu.edu, temngt23@ysub.bitnet and
   hopefully some day root@yfn.ysu.edu

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

In article <6828@uwm.edu> jgreco@archimedes.math.uwm.edu (Joe Greco) writes:
>Hello,
>
>I've just brought up a "new" version of sendmail, 5.64, to replace the older
>5.61 and give us MX record capabilities.
>
>jgreco@b... Connecting to banach.math.uwm.edu via inet...
>Trying 129.89.14.65...  connected.
>220 banach.math.uwm.edu BSD Sendmail 5.61/2.01 ready to mangle your mail at Mon, 8 Oct 90 18:03:20 -0500
>>>> HELO banach.math.uwm.edu
>553 Local configuration error, hostname not recognized as local
>
>I traced this down to line 200-205 in sendmail/src/srvrsmtp.c... it appears
>to be a very simple error and should probably read: "553 can't specify local
>host name" ... it appears to be a recursion trap.
>
>But (imho) Sendmail really should allow this kind of behaviour.  I commented
>out the offending code, as it doesn't seem to be something that is really
>all that configurable.
>
  Commenting out the code was a SERIOUS mistake.  That code is there
as you surmised, as a recursion trap.  Just wait till you have a bug in
'sendmail.cf' and find a rapidly growing number of 'sendmail.cf' processes
all talking to each other and forking.  And since the processes are owned
by root, per-user limitations won't help.  You'll probably have to crash the
system and restart it in single user mode, clear out the mail queue by hand,
and then go to muli-user mode.

  For what you were trying to do, all you needed was to use different
'sendmail.cf's for each version, and make sure that $j is differently defined
in each version.  The test is a comparison of the value of $j, and that is 
defined in 'sendmail.cf'.  (However the comparison may be a case-insensitive
comparison, so just changing the case my not hack it).  Since this seems to
have been mostly for testing, why not just have a technically wrong value
of $j in the test version.

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

hubert@cac.washington.edu (Steve Hubert) (10/19/90)

In article <6828@uwm.edu> jgreco@archimedes.math.uwm.edu (Joe Greco) writes:
>>>> HELO banach.math.uwm.edu
>553 Local configuration error, hostname not recognized as local
>
>I traced this down to line 200-205 in sendmail/src/srvrsmtp.c... it appears
>to be a very simple error and should probably read: "553 can't specify local
>host name" ... it appears to be a recursion trap.
>
>But (imho) Sendmail really should allow this kind of behaviour.  I commented
>out the offending code, as it doesn't seem to be something that is really
>all that configurable.


I agree with Neil that simply commenting out the code is probably not
what you want to do.  But I also agree with Joe's "ho" that it ought to be
ok for a local smtp client to connect to the sendmail server and introduce
itself with the correct hostname.  I changed my sendmail so that the client
checks for the recursion problem instead of the server.  The theory is that
this will still catch the case where sendmail is talking to itself but
it will let unrelated smtp clients through.  Define LOCALSMTP in the
following code to get the modified behavior.

===========
srvrsmtp.c
===========
		/* process command */
		switch (c->cmdcode)
		{
		  case CMDHELO:		/* hello -- introduce yourself */
			SmtpPhase = "HELO";
			setproctitle("%s: %s", CurHostName, inp);
#ifndef LOCALSMTP
/*
 * This block of code prevents a client smtp on this host from
 * communicating with our smtp server (unless it says hello with a
 * different name).  We don't want to exclude that
 * possibility.  It is perfectly reasonable for a client other than
 * sendmail to be local.  However, this block also serves to pick up
 * configuration errors which if missed cause loops.  That is a
 * good thing and we want it to continue.  Instead of doing it here
 * we will make usersmtp.c attempt to ascertain for itself whether it is
 * talking to a local sendmail and abort on its own.  The code in usersmtp.c
 * goes on the assumption that the definition of the macro 'e' in the
 * sendmail.cf file starts with $j, the hostname.  See usersmtp.c.  Hubert
 */
			if (!strcasecmp(p, MyHostName))
			{
				/*
				 * didn't know about alias,
				 * or connected to an echo server
				 */
				message("553", "Local configuration error, hostname not recognized as local");
				break;
			}
#endif /* !LOCALSMTP */
			if (RealHostName != NULL && strcasecmp(p, RealHostName))
			{
				char hostbuf[MAXNAME];

===========
usersmtp.c
===========
	if (setjmp(CtxGreeting) != 0)
		goto tempfail;
	gte = setevent((time_t) 300, greettimeout, 0);
	SmtpPhase = "greeting wait";
	setproctitle("%s %s: %s", CurEnv->e_id, CurHostName, SmtpPhase);
	r = reply(m);
	clrevent(gte);
	if (r < 0 || REPLYTYPE(r) != 2)
		goto tempfail;

#ifdef LOCALSMTP
	/*
	 * This block of code checks to see if the server we are talking
	 * to is on this host.  This shouldn't happen.
	 * The check was previously in srvrsmtp.c but it prevented other
	 * smtp clients on the same host from talking to the server, which
	 * we don't want to do.  We check by looking at the greeting
	 * message we get back from the server.  Skip the reply code with
	 * the +4 and compare the next piece with our hostname to see if
	 * they are the same.  There is an assumption here that the 'e'
	 * macro in sendmail.cf is defined to start with $j.  MyHostName
	 * is also derived from $j so these two things will be the same
	 * if this is our sendmail server.  In that case, close the
	 * connection and give the config error message that srvrsmtp.c
	 * used to produce.  Steve Hubert, 9/18/90.
	 */
	if (!strncmp(SmtpReplyBuffer+4, MyHostName, strlen(MyHostName))) {
		syslog(LOG_DEBUG,
	    "Local configuration error, hostname not recognized as local");
		fprintf(CurEnv->e_xfp,
	    "Local configuration error, hostname not recognized as local\n");
		smtpquit(m);
		return (EX_SOFTWARE);
	}
#endif /* LOCALSMTP */
	
	/*
	**  Send the HELO command.
	**	My mother taught me to always introduce myself.
	*/

	smtpmessage("HELO %s", m, MyHostName);
	SmtpPhase = "HELO wait";

jeffe@sandino.austin.ibm.com (Peter Jeffe 512.823.4091) (10/23/90)

In article <6828@uwm.edu> jgreco@archimedes.math.uwm.edu (Joe Greco) writes:
>220 banach.math.uwm.edu BSD Sendmail 5.61/2.01 ready to mangle your mail at Mon, 8 Oct 90 18:03:20 -0500
>>>> HELO banach.math.uwm.edu
>553 Local configuration error, hostname not recognized as local
>
>I traced this down to line 200-205 in sendmail/src/srvrsmtp.c... it appears
>to be a very simple error and should probably read: "553 can't specify local
>host name" ... it appears to be a recursion trap.

Well, it's not only a recursion trap but also a sanity check.  What it's
trying to tell you is that you've got a problem in your configuration file,
in that sendmail didn't recognize the recipient hostname as its own.  So
the daemon rejects the connection and tells you to fix your config file.

>But (imho) Sendmail really should allow this kind of behaviour.  I commented
>out the offending code, as it doesn't seem to be something that is really
>all that configurable.

But it definitely is configurable.  You don't have your local hostname
properly defined in your config file.  Use the sendmail -bt mode to
test how sendmail resolves a given address; e.g., entering "3,0
user@banach.math.uwm.edu" *should* show it resolving to the local
mailer, with a username of "user".  But in your case, it will probably
show it resolving to the inet mailer: this is your problem.  Find where
the local hostname and domain name are defined in the config file, and
make sure they are correct.  If you are unsure about this, feel free to
mail your config file to me (at the below address) and I'll give it a
shot.

-------------------------------------------------------------------------------
Peter Jeffe   ...uunet!cs.utexas.edu!ibmchs!auschs!sandino.austin.ibm.com!jeffe
        first they want a disclaimer, then they make you pee in a jar,
                   then they come for you in the night

pst@ack.Stanford.EDU (Paul Traina) (10/24/90)

There are two cases involved here...

(a) sendmail should NEVER EVER EVER talk to itself.  There is no reason
    for it to do so.  Anything that can be done by sending the message
    back to itself should be done in the .cf file.  Otherwise you run
    the risk of nasty infinite loops.

(b) some programs (like mh with sendmail/smtp) could possibly connect
    to the local host, send down a "valid" hostname in the HELO greeting,
    and get trapped.  The simple solution is to not issue a HELO,  but
    that my break the smtp RFC.  The other idea would be to issue HELO
    localhost, but some wise-ass :-) (you know who you are)  may have
    sendmail bitch about people sending down HELO messages with bogus
    sites in them.