[comp.mail.sendmail] temporarily broken nameserver breaks sendmail daemon

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

DESCRIPTION:
If the nameserver is inaccessible when the sendmail daemon is
started it can come up with the wrong idea of its hostname.  This
will happen if the hostname is defined to be the short, unqualified
name instead of the FQ name.  In that case it will have an incorrect
idea of its hostname and will bounce mail with a configuration error
when the nameserver does come up.

FIX:
If you use the FQ name in your sethostname() call you don't have to
worry about it.  But, it can be fixed anyway in daemon.c by causing
sendmail to loop waiting for its nameserver to come up.

myhostname(hostbuf, size)
	char hostbuf[];
	int size;
{
	extern struct hostent *gethostbyname();
	struct hostent *hp;

	if (gethostname(hostbuf, size) < 0)
	{
		(void) strcpy(hostbuf, "localhost");
	}
#ifdef KEEPTRYING
	/*
	 * If the gethostbyname() call to the nameserver fails we should
	 * keep trying it instead of plowing ahead with the wrong
	 * information.  Hubert, Nov 89.
	 */
	while ((hp = gethostbyname(hostbuf)) == NULL) {
		setproctitle("gethostbyname(%s) unsuccessful, trying again", hostbuf);
		sleep(30);
	}
#else /* KEEPTRYING */
	hp = gethostbyname(hostbuf);
#endif /* KEEPTRYING */
	if (hp != NULL)
	{
		(void) strcpy(hostbuf, hp->h_name);
		return (hp->h_aliases);
	}
	else
		return (NULL);
}

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

In article <9455@milton.u.washington.edu> hubert@cac.washington.edu (Steve Hubert) writes:
>DESCRIPTION:
>If the nameserver is inaccessible when the sendmail daemon is
>started it can come up with the wrong idea of its hostname.  This
>
>If you use the FQ name in your sethostname() call you don't have to
>worry about it.  But, it can be fixed anyway in daemon.c by causing

  If you use a freeze file you shouldn't have to worry about it either,
as long as the nameserver is running when you build the freeze file.
When running from a freeze file, sendmail decides who it is based on the
macro expansion of $j, which is saved in the freeze file.

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