From 2a3519d326563eb43ed64ec955b3df270d9342ad Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Dec 08 2012 11:00:49 +0000 Subject: added test to sendmail to use ESMTP reordered tests --- diff --git a/tests/p_sendmail/1-test-sendmail.sh b/tests/p_sendmail/1-test-sendmail.sh deleted file mode 100755 index 142955c..0000000 --- a/tests/p_sendmail/1-test-sendmail.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Author: Christoph Galuschka - -t_Log "Running $0 - testing if /usr/sbin/sendmail for sendmail is sane." - -mta=$(ls -H /usr/sbin/sendmail) - -if [ $mta == '/usr/sbin/sendmail' ] - then - t_Log "link to sendmail seems to be sane" - ret_val=0 -else - t_Log "link to sendmail seems to be wrong" - ret_val=1 -fi - -t_CheckExitStatus $ret_val diff --git a/tests/p_sendmail/10_sendmail_smtp.sh b/tests/p_sendmail/10_sendmail_smtp.sh new file mode 100755 index 0000000..dba02b1 --- /dev/null +++ b/tests/p_sendmail/10_sendmail_smtp.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Sendmail SMTP test." + +echo "helo test" | nc -w 3 localhost 25 | grep -q '250' + +t_CheckExitStatus $? diff --git a/tests/p_sendmail/15-test-sendmail.sh b/tests/p_sendmail/15-test-sendmail.sh new file mode 100755 index 0000000..142955c --- /dev/null +++ b/tests/p_sendmail/15-test-sendmail.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - testing if /usr/sbin/sendmail for sendmail is sane." + +mta=$(ls -H /usr/sbin/sendmail) + +if [ $mta == '/usr/sbin/sendmail' ] + then + t_Log "link to sendmail seems to be sane" + ret_val=0 +else + t_Log "link to sendmail seems to be wrong" + ret_val=1 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_sendmail/30_sendmail_mta_ehlo.sh b/tests/p_sendmail/30_sendmail_mta_ehlo.sh new file mode 100755 index 0000000..dfc7274 --- /dev/null +++ b/tests/p_sendmail/30_sendmail_mta_ehlo.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - sendmail 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" +if [ $? = 0 ] + then + t_Log 'Mail has been queued successfully' + MTA_ACCEPT=0 +fi + +sleep 1 +grep -q 't_functional test' $MAILSPOOL +if [ $? = 0 ] + then + t_Log 'previously sent mail is in '$MAILSPOOL + SPOOLFILE=0 +fi + +if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_sendmail/sendmail_smtp.sh b/tests/p_sendmail/sendmail_smtp.sh deleted file mode 100755 index dba02b1..0000000 --- a/tests/p_sendmail/sendmail_smtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Author: Athmane Madjoudj - -t_Log "Running $0 - Sendmail SMTP test." - -echo "helo test" | nc -w 3 localhost 25 | grep -q '250' - -t_CheckExitStatus $?