From c4957208f912028d0548494714851f82db8dcbf3 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Sep 29 2014 19:43:52 +0000 Subject: removed bash resourcing changed postfix smtp tests to use mail ID from SMTP-Dialog --- diff --git a/tests/0_common/20_upgrade_all.sh b/tests/0_common/20_upgrade_all.sh index bc410e4..49affe6 100755 --- a/tests/0_common/20_upgrade_all.sh +++ b/tests/0_common/20_upgrade_all.sh @@ -3,10 +3,5 @@ t_Log "Running $0 - test that all updates can be applied to this machine cleanly" yum -d0 -y upgrade -ret_val=$? -t_Log "Resourcing lib-functions - see CVE-2014-6271" -LIB_FUNCTIONS='./tests/0_lib/functions.sh' -source $LIB_FUNCTIONS - -t_CheckExitStatus $ret_val +t_CheckExitStatus $? diff --git a/tests/p_postfix/20_postfix_mta.sh b/tests/p_postfix/20_postfix_mta.sh index 7379b35..051a42b 100755 --- a/tests/p_postfix/20_postfix_mta.sh +++ b/tests/p_postfix/20_postfix_mta.sh @@ -3,14 +3,8 @@ t_Log "Running $0 - postfix can accept and deliver local email." -MAILSPOOL=/var/spool/mail/root - -# make shure spool file is empty -cat /dev/null > $MAILSPOOL -ret_val=1 - # send mail to localhost -echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep queued) if [ $? = 0 ] then t_Log 'Mail has been queued successfully' @@ -18,17 +12,17 @@ if [ $? = 0 ] fi sleep 1 -grep -q 't_functional test' $MAILSPOOL -if [ $? = 0 ] +regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +if [[ $mail =~ $regex ]] then - t_Log 'previously sent mail is in '$MAILSPOOL - SPOOLFILE=0 + grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + DELIVERED=$? fi -if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) +if ([ $MTA_ACCEPT = 0 ] && [ $DELIVERED = 0 ]) then ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' fi t_CheckExitStatus $ret_val - diff --git a/tests/p_postfix/30_postfix_mta_ehlo.sh b/tests/p_postfix/30_postfix_mta_ehlo.sh index f752998..ea5433f 100755 --- a/tests/p_postfix/30_postfix_mta_ehlo.sh +++ b/tests/p_postfix/30_postfix_mta_ehlo.sh @@ -3,14 +3,8 @@ t_Log "Running $0 - postfix can accept and deliver local email using ESMTP." -MAILSPOOL=/var/spool/mail/root - -# make shure spool file is empty -cat /dev/null > $MAILSPOOL -ret_val=1 - # send mail to localhost -echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep queued) if [ $? = 0 ] then t_Log 'Mail has been queued successfully' @@ -18,17 +12,17 @@ if [ $? = 0 ] fi sleep 1 -grep -q 't_functional test' $MAILSPOOL -if [ $? = 0 ] +regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +if [[ $mail =~ $regex ]] then - t_Log 'previously sent mail is in '$MAILSPOOL - SPOOLFILE=0 + grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + DELIVERED=$? fi -if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) +if ([ $MTA_ACCEPT = 0 ] && [ $DELIVERED = 0 ]) then ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' fi t_CheckExitStatus $ret_val -