#!/bin/sh
# $Id: t-verp-0.sh,v 1.3 2007/02/02 02:07:11 ca Exp $
# Copyright (c) 2004, 2005 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
# ----------------------------------------
# test VERP handling
# run smtp1.sh with different parameters
# ----------------------------------------
#
test -s stop && exit 1
#
SD=`dirname $0`
if test "${SD}" = "."
then
SD=../chkmts
fi
. ${SD}/common.sh
I=""
OUT="t-owner-0.out"
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 working directory for alias file!
cd ../qmgr || exit 1
# create aliases
${CAT} > ${ALI} <<EOF
abuse: local:
postmaster: local:
user: local:
user++: local:
sender: local:
list0-user1: local:
list0-user2: local:
list3-user1: local:
list3-user2: local:
listl-user1: local:
listl-user2: local:
ownerlist0: local:
ownerlist1: local:
ownerlistl: local:
list0: <list0-user1@local.dom> <list1@local.dom> <list0-user2@some.dom>
verp-list0: ownerlist0
verp-list1: ownerlist1
list1: <list1-user1@remote.dom> <list1-user2@some.dom>
verp-list2@some.dom: <ownerlist2somedom@some.dom>
list2@some.dom: <list0@local.dom> <list1@local.dom> <list2-user0@some.dom>
verp-listl: ownerlistl
listl: <listl-user1@local.dom> <listl-user2@local.dom>
list3: <list3-user1@local.dom> <list3-user2@some.dom>
verp-list3: ownerlist3
list4: <list4-user1@local.dom> <list0-user2@some.dom>
verp-list4: ownerlist4
list4-user1: local:
EOF
# create map
rm -f ${ALIMAP}
${MM} < ${ALI}
# create mailertable (save old version?)
${CAT} > ${MT} <<EOF
local.dom [${MTA_LMTPIPV4D}]
some.dom [127.0.0.1]
other.dom [127.0.0.1]
some.dom [127.0.0.1]
remote.dom [127.0.0.1]
EOF
# ----------------------------------------
# test: send mail to local list, check Return-Path:
TEST=1
if echo " ${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
ERR=false
if ${SHELL} ${SD}/smtp1.sh -3 lmtpsock -Ssender@local.dom -Rlistl@local.dom -E 0 -X 0 -A 1
then
# on some systems the RPCTs may have been delivered in "reverse" order
# hence need to check both. it would be simpler to use:
# ${GREP} '^Return-Path: <owner-listl+listl-user[12]=local\.dom@local\.dom>'
# but then (theoretically) both files could contain the same sender...
if test -s ${B1}
then
if ${GREP} '^Return-Path: <owner-listl+listl-user1=local\.dom@local\.dom>' ${B1} >/dev/null
then
:
else
if ${GREP} '^Return-Path: <owner-listl+listl-user2=local\.dom@local\.dom>' ${B1} >/dev/null
then
:
else
echo "$0: ${TEST}: ${GREP} in ${B1} failed"
ERR=true
fi
fi
else
echo "$0: ${TEST}: ${B1} not found"
ERR=true
fi
if test -s ${B2}
then
if ${GREP} '^Return-Path: <owner-listl+listl-user2=local\.dom@local\.dom>' ${B2} >/dev/null
then
:
else
if ${GREP} '^Return-Path: <owner-listl+listl-user1=local\.dom@local\.dom>' ${B1} >/dev/null
then
:
else
echo "$0: ${TEST}: ${GREP} in ${B2} failed"
ERR=true
fi
fi
else
echo "$0: ${TEST}: ${B2} not found"
ERR=true
fi
else
ERR=true
fi
if ${ERR}
then
echo "$0: test ${TEST} failed"
ERRS=`expr ${ERRS} + 1 `
test X"${MTA_STOPONERROR}" != X && exit 1
fi
rm -f ${B1}
else
${VERBOSE} && echo "$0: test ${TEST} SKIPPED"
fi
rm -f ${MTMAP} ${ALIMAP}
# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
exit 0
else
echo "${ERRS} error(s)"
exit 1
fi
syntax highlighted by Code2HTML, v. 0.9.1