Add one more check to the sendmail auto-start heuristic: check the

value of MTAHost in the submit.cf.  If it doesn't indicate localhost,
we probably don't need the sendmail listener.

Addresses PR bin/26391.
This commit is contained in:
atatat 2004-07-22 03:36:29 +00:00
parent d5cb507ae3
commit e0fb433b4f
1 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: sendmail,v 1.17 2004/07/15 03:47:18 atatat Exp $
# $NetBSD: sendmail,v 1.18 2004/07/22 03:36:29 atatat Exp $
#
# PROVIDE: mail
@ -106,6 +106,8 @@ check_need_sendmail()
{
_mta_path=$(awk '/^sendmail[ \t]/{print$2}' /etc/mailer.conf)
_sendmail_path="/usr/libexec/sendmail/sendmail"
_mta_host=$(sed -n '/^D{MTAHost}/s/.*\[\([^]\.]*\)\.*]/\1/p' \
/etc/mail/submit.cf 2>/dev/null | tr A-Z a-z)
if [ "${sendmail}" != "check" ]; then
echo "${sendmail}"
elif [ "${_mta_path}" != "${_sendmail_path}" -o \
@ -114,7 +116,12 @@ check_need_sendmail()
"$(stat -f "%Mp %Sg" "$_sendmail_path")" != "2 smmsp" ]; then
echo NO
else
echo YES
case "$_mta_host" in
localhost|127.0.0.1|::1|localhost.*)
echo YES;;
*)
echo NO;;
esac
fi
}