4.2 sendmail myhostname fixes
Liudvikas Bukys
bukys at rochester.UUCP
Thu Jun 7 08:15:05 AEST 1984
Index: usr.lib/sendmail/src/daemon.c 4.2 Fix
Description:
The myhostname() generated if DAEMON is defined has two problems:
(1) it calls gethostname() incorrectly (a holdover from pre-4.1a?);
(2) it assumes that hp->h_name is the same as `hostname`.
Repeat-By:
Go to a machine for which `hostname` is not the first name in
the /etc/hosts line. For example, on ur-seneca, whose
/etc/hosts line looks like
192.5.37.83 ur-seneca seneca sen
`hostname` is "seneca", not "ur-seneca".
Without this fix, sendmail's $w is (seneca) and $=w is (seneca sen).
With this fix, $w is (ur-seneca) and $=w is (ur-seneca seneca sen).
Fix:
------- OLD CODE ------- ------- ------- ------- ------- ------- ------- -------
{
extern struct hostent *gethostbyname();
struct hostent *hp;
auto int i = size;
gethostname(hostbuf, &i);
hp = gethostbyname(hostbuf);
if (hp != NULL)
return (hp->h_aliases);
else
return (NULL);
}
------- NEW CODE ------- ------- ------- ------- ------- ------- ------- -------
{
extern struct hostent *gethostbyname();
struct hostent *hp;
gethostname(hostbuf, size);
hp = gethostbyname(hostbuf);
if (hp != NULL) {
strncpy(hostbuf, hp->h_name, size);
return (hp->h_aliases);
} else
return (NULL);
}
------- -------- ------- ------- ------- ------- ------- ------- ------- -------
Brought to you by:
Liudvikas Bukys
rochester!bukys (uucp) via allegra, decvax, seismo
bukys at rochester (arpa)
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list