#!/bin/sh
# $Id: t-mts-icc.sh,v 1.1 2007/10/16 04:20:14 ca Exp $
#
# ----------------------------------------
# test incoming concurrent connections restriction.
# uses smtp1.sh.
# ----------------------------------------
#
test -s stop && exit 1
#
if test "X"${MTA_TIMING} = "X"
then
echo "SKIPPED: $0: MTA_TIMING is not set"
exit 0
fi
SD=`dirname $0`
if test "${SD}" = "."
then
SD=../chkmts
fi
. ${SD}/common.sh
SCRIPTS=`cd ${SD} && pwd`
MM=../libsmmap/t-mm
I=""
ERRS=0
SKIP=""
if test X"`uname`" != "XOSF1"
then
while getopts s:V FLAG
do
case "${FLAG}" in
s) SKIP="${SKIP} ${OPTARG}";;
V) VERBOSE=true;;
esac
done
shift `expr ${OPTIND} - 1`
fi
# cd to right directory (where the programs will be executed).
cd ../qmgr || exit 1
killit()
{
rm -f ${QMGRCONFMAP}
exit 1
}
# create restrictions
${CAT} > ${QMGRCONF} <<EOF
icm:127.0.0.1 3
EOF
# create map
rm -f ${QMGRCONFMAP}
${MM} -t' ' -F ${QMGRCONFMAP} < ${QMGRCONF}
rm -f ${MTMAP}
trap killit 2
# run some test programs
# Note: when testing rates consider that there is one connection at
# the begin to see whether SMTPS is running!
# ----------------------------------------
#
TEST=1
if echo "${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
if ${SHELL} ${SCRIPTS}/smtp1.sh -Z "smtpc2" -c '-d 5 -W d=2 -m 10 -s 10' $@ -A 3 -E 3 -S"a@b.c" -R"x@y.z" -t 10
then
# XREF: qmgr/qss_nseid.c logging
if ${GREP} "open_se=3, max=3, status=exceeded, times=7" ${QML} > /dev/null
then
${VERBOSE} && echo "test ${TEST} succeeded"
else
ERRS=`expr ${ERRS} + 1 `
${VERBOSE} && echo "$0: test ${TEST}: missing 'exceeded' log entry"
test X"${MTA_STOPONERROR}" != X && exit 1
fi
else
ERRS=`expr ${ERRS} + 1 `
${VERBOSE} && echo "test ${TEST} failed"
test X"${MTA_STOPONERROR}" != X && exit 1
fi
fi
# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
exit 0
else
echo "${ERRS} error(s)"
exit 1
fi
syntax highlighted by Code2HTML, v. 0.9.1