Blame tests/p_exim/30_exim_mta_ehlo-test.sh

Christoph Galuschka d05160
#!/bin/sh
bb927b
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka d05160
bb927b
t_Log "Running $0 - exim can accept and deliver local email."
Christoph Galuschka d05160
Christoph Galuschka d05160
if [ $centos_ver == '5' ]
Christoph Galuschka d05160
  ret_val=1
Christoph Galuschka d05160
Christoph Galuschka d05160
  # send mail to localhost
bb927b
  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 "250 OK")
bb927b
  MTA_ACCEPT=$?
bb927b
  if [ $MTA_ACCEPT == 0 ]
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    t_Log 'Mail has been queued successfully'
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
bb927b
250 OK id=1XaR7Q-0005D8-Cm
bb927b
bb927b
  regex='250\ OK\ id\=([0-9A-Za-z-]*)'
bb927b
  if [[ $mail =~ $regex ]]
Christoph Galuschka d05160
    then
bb927b
    grep -q "${BASH_REMATCH[1]}: removed" /var/log/exim/main.log
bb927b
    DELIVERED=$?
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
bb927b
  if ([ $MTA_ACCEPT == 0  ] && [ $SPOOLFILE == 0 ])
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    ret_val=0
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
else
Christoph Galuschka d05160
  t_Log t_Log "This is not a C5 system - skipping"
Christoph Galuschka d05160
  ret_val=0
Christoph Galuschka d05160
fi
Christoph Galuschka d05160
Christoph Galuschka d05160
t_CheckExitStatus $ret_val