[comp.unix.aux] Sendmail

jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) (07/21/90)

I have figured out the sendmail "problem" of it not recognizing and using
aliases in /etc/hosts. Basically, it's because res_search() doesn't do
as exhaustive a search as does gethostbyname(). So what I've done is
added sections that if res_search fails, try it again, but this time
use the "official" hostname as returned by gethostbyname() in the
nameserver query. This adds No time if the query is successful the 1st
time.

So this is IT! Done! Finished! (I've also added timezone capability
to arpadate instead of that stupid "-0400" in the date...

Be sure to read ./src/AUX_README and to change to BINARY mode when doing
your anon-ftp "get"...
--
=======================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagmac2.gsfc.nasa.gov               Greenbelt, MD 20771

"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
 the very, very top, and then it tends to slope away rather sharply."

jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) (07/25/90)

With many thanks to the individual from Apple who sent me a copy of the
"hack" required for sendmail (for A/UX 1.1 and 1.1.1) to work without
named, I have information about my port of 5.64 for A/UX. (this individual,
however, shall remain nameless... knowing how Apple is, I don't want to risk
that person getting into trouble for helping. You know who you are though,
so Thanks!)

There was a hack introduced at Apple on sendmail 5.59 for A/UX 1.1 and
1.1.1. This hack was required due to the way getmxrr() was used, which,
if it didn't see the host specified, returned a (-1) and an error code of
EX_NOHOST. This hack (or fix, actually) called gethostbyname() as an
extra check that the machine actually DID know the host. It did this
only if the call to getmxrr() failed.

This of course makes sense, since Apple couldn't REQUIRE that all A/UX sites
run named for sendmail to work, nor could they require users to recompile
sendmail if they went back and forth from/to nameserver support. This way,
/etc/hosts would be used if the nameserver query failed (whether it failed
since named wasn't running or because the host was not found).

In any case, whether intentionally or not, this fix also created the condition
of being able to use /etc/hosts aliases in mail messages whether named was
running or not. But you see, the whole thing started because I happen to use
/etc/hosts aliases a lot, so when I started on the port of 5.64 for A/UX,
I immediately noticed that this stopped, hence my original questions and
confusion.

My hack/fix of sendmail 5.64 is consistant with what was done for sendmail 5.59
for A/UX. The call to gethostbyname() is ONLY done if the getmxrr() query
returns as failed with an error code of HOST_NOT_FOUND (EX_NOHOST). If so,
gethostbyname() is called to get the "official" name for the host. gethost-
byname() also queries the nameserver, the Yellow Pages (I guess) and finally
/etc/hosts. If the return value of gethostbyname() is not NULL, then the
returned "official" host name is used for another call to getmxrr. If this
fails, then mail is not sent.

If your sendmail.cf file is very robust, then this fix is not required and will
never be used. You can use this port whether running named or not. And,
finally, whether right or wrong, it maintains the CONSISTANCY between the
behavior of sendmail 5.59 (1.1 and 1.1.1) and 5.64. This fix doesn't, in any
way, decrease the performance or capability of 5.64. It simply provides an
additional test, which, depending on your configuration, may never be used.
On the other hand, those of us who would like to upgrade our version of
sendmail, keep our sendmail.cf as is, and have behavior consistant with the
version we are used to, this port is the answer.

But hell, if you want to be a stickler about it, recompile WITHOUT having
TRY_ETC_HOSTS defined, and the fixes won't even be compiled in!

PS:	Did I mention that the port also fixes the standard time "problem"
	with sendmail, which prints time as -0400 instead of EDT... a simple
	fix, true, but it's there...

PPS:	Did I also mention that I have provided a program that prints out
	the system load average AS SENDMAIL sees it (well, as this port
	of sendmail sees it... I know of no consistant use/range for load
	average - if someone does, e-mail me). This way you can use the Ox
	and OX capabilities of sendmail.cf and know that the values of
	true meaning to your machine and environment..

PPS:	Did I forget to say "Thanks" for all those who e-mailed me suggestions
	and say a "Thanks a Bunch!" for those who e-mailed me their
	approval... Thanks! and Thanks a Bunch!
--
=======================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagmac2.gsfc.nasa.gov               Greenbelt, MD 20771

"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
 the very, very top, and then it tends to slope away rather sharply."