bukys@rochester.UUCP (Liudvikas Bukys) (06/07/84)
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@rochester (arpa)