#!/bin/sh
# $Id: t-many-rcpts-1.sh,v 1.2 2007/10/23 04:01:23 ca Exp $
#
# ----------------------------------------
# test too many recipients
# uses smtp1.sh
# ----------------------------------------
#
test -s stop && exit 1
#

SD=`dirname $0`
if test "${SD}" = "."
then
   SD=../chkmts
fi
. ${SD}/common.sh
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
rm -f ${MTMAP}

TEST=1
# ----------------------------------------
# too many recipients: filling up RCB
if echo "${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
D="longhostnameinalongdomainname.someverylong.domain"
S="thisisthesenderaddress@${D}"

# create mailertable
${CAT} > ${MT} <<EOF
longhostnameinalongdomainname.someverylong.domain	[127.0.0.1]
EOF

if ${SHELL} ${SD}/smtp1.sh $@ -E 0 -A 0 -X 0 -S"$S" -n 1000 -Z smtpc2 -c "-Y $D"
then
    ${VERBOSE} && echo "test ${TEST} succeeded"
else
    echo "$0: test ${TEST} failed"
    ERRS=`expr ${ERRS} + 1 `
    test X"${MTA_STOPONERROR}" != X && exit 1
fi
fi


# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
  rm -f ${EDBROK}
  exit 0
else
  echo "${ERRS} error(s)"
  exit 1
fi


syntax highlighted by Code2HTML, v. 0.9.1