Path: utzoo!utgpu!watserv1!watmath!att!rutgers!mit-eddie!uw-beaver!milton!hubert@cac.washington.edu From: hubert@cac.washington.edu (Steve Hubert) Newsgroups: comp.mail.sendmail Subject: temporarily broken nameserver breaks sendmail daemon Message-ID: <9455@milton.u.washington.edu> Date: 18 Oct 90 01:16:09 GMT Sender: hubert@milton.u.washington.edu Organization: University of Washington, Seattle Lines: 45 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); }