Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!milton!hubert@cac.washington.edu From: hubert@cac.washington.edu (Steve Hubert) Newsgroups: comp.mail.sendmail Subject: Re: Sendmail 5.64 (Berkeley) coughs up an error on local SMTP Keywords: help! Message-ID: <9511@milton.u.washington.edu> Date: 18 Oct 90 21:35:05 GMT References: <6828@uwm.edu> Sender: hubert@milton.u.washington.edu Organization: University of Washington, Seattle Lines: 105 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";