From e0fb433b4f8413ad63305790ee5800af76d89c46 Mon Sep 17 00:00:00 2001 From: atatat Date: Thu, 22 Jul 2004 03:36:29 +0000 Subject: [PATCH] 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. --- etc/rc.d/sendmail | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail index be7a56db5a99..f9f8f39092a1 100755 --- a/etc/rc.d/sendmail +++ b/etc/rc.d/sendmail @@ -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 }