. /etc/profile
[[ -s ${QMAIL_CONTROLDIR}/conf-common ]] && \
. ${QMAIL_CONTROLDIR}/conf-common
[[ -s ${QMAIL_CONTROLDIR}/conf-${SERVICE}d ]] && \
. ${QMAIL_CONTROLDIR}/conf-${SERVICE}d
[[ "${SERVICE}" = send && -s ${QMAIL_CONTROLDIR}/conf-send ]] && \
. ${QMAIL_CONTROLDIR}/conf-send
if [[ -z "${QMAIL_DISABLE_SANITY_CHECK}" ]]
then
CONFIG_SANITY_GOOD=
if [[ -z "${QMAILDUID}" || -z "${NOFILESGID}" || -z "${SERVICE}" || -z "${QMAILLUID}" ]]
then
echo "SERVICE(${SERVICE}), QMAILDUID(${QMAILDUID}), NOFILESGID(${NOFILESGID}) or "\
"QMAILLUID(${QMAILLUID}) is unset in $0"
CONFIG_SANITY_GOOD=0
fi
if [[ -z "${LOG_OPTS}" || -z "${LOG_DEST}" ]]
then
echo "LOG_OPTS: ${LOG_OPTS}"
echo "LOG_DEST: ${LOG_DEST}"
echo "Error in logging setup!"
CONFIG_SANITY_GOOD=0
fi
if [[ "${SERVICE}" = smtp &&
! -f ${QMAIL_CONTROLDIR}/rcpthosts &&
-z "${QMAIL_DISABLE_SANITY_CHECK}" ]]
then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
CONFIG_SANITY_GOOD=0
fi
if [[ "${SERVICE}" != send && ! -f "${TCPSERVER_RULESCDB}" ]]
then
echo "No CDB file found (${TCPSERVER_RULESCDB})"
CONFIG_SANITY_GOOD=0
fi
if [[ -n "${CONFIG_SANITY_GOOD}" ]]
then
echo "Some error detected in ${SERVICE}, sleeping for 90 seconds for safety"
sleep 90s
exit 1
fi
else
echo "Failed to find sanity checker!"
sleep 30s
exit 1
fi