| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | runandshow() { |
| 6 | count=0 |
| 7 | printf '===============\n%s: running ' $0 |
| 8 | for i in "$@" ; do |
| 9 | printf "argv[%i]=[%s] " "$count" "$i" |
| 10 | count=$(($count+1)) |
| 11 | done |
| 12 | echo |
| 13 | "$@" |
| 14 | } |
| 15 | |
| 16 | shouldfail() { |
| 17 | if runandshow "$@"; then |
| 18 | echo ... should have failed |
| 19 | exit 1 |
| 20 | else |
| 21 | : |
| 22 | fi |
| 23 | } |
| 24 | |
| 25 | exim=/usr/sbin/exim4 |
| 26 | |
| 27 | |
| 28 | runandshow $exim -bV |
| 29 | runandshow $exim -bt postmaster@localhost |
| 30 | |
| 31 | # Since example.com is not a local domain delivery should fail with the |
| 32 | # default dc_eximconfig_configtype=local |
| 33 | shouldfail $exim -bt [email protected] |
| 34 | runandshow $exim -be \ |
| 35 | '${lookup{exim4.conf.template}dsearch{/etc/exim4}{$value}fail}' |
| 36 | rc="$($exim -be \ |
| 37 | '${lookup{exim4.conf.template}dsearch{/etc/exim4}{$value}fail}')" |
| 38 | if [ "$rc" != "exim4.conf.template" ]; then |
| 39 | echo wrong expansion result $rc |
| 40 | false |
| 41 | fi |
| 42 | |
| 43 | runandshow $exim -be \ |
| 44 | '${run{/bin/echo -n foo}{success}{error}} runrc[$runrc] value[$value]' |
| 45 | rc="$($exim -be \ |
| 46 | '${run{/bin/echo -n foo}{success}{error}} runrc[$runrc] value[$value]')" |
| 47 | if [ "$rc" != "success runrc[0] value[foo]" ]; then |
| 48 | echo wrong expansion result $rc |
| 49 | false |
| 50 | fi |
| 51 | |
| 52 | runandshow swaks -s localhost -tlso -q ehlo |
| 53 | runandshow swaks -s localhost -tlso -f root@localhost -t postmaster@localhost \ |
| 54 | -q rcpt |
| 55 | shouldfail swaks -s localhost -tlso -f root@localhost \ |
| 56 | -t postmaster@localhost \ |
| 57 | --h-From 'From: Invalid Syntax <root@localhost' |
| 58 | shouldfail swaks -s localhost -tlso -f root@localhost \ |
| 59 | -t postmaster@localhost \ |
| 60 | --body @`dirname $0`/long-header.msg |